Lines Matching refs:opt

44 void ip_options_build(struct sk_buff *skb, struct ip_options *opt,  in ip_options_build()  argument
49 memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options)); in ip_options_build()
50 memcpy(iph + sizeof(struct iphdr), opt->__data, opt->optlen); in ip_options_build()
51 opt = &(IPCB(skb)->opt); in ip_options_build()
53 if (opt->srr) in ip_options_build()
54 memcpy(iph + opt->srr + iph[opt->srr + 1] - 4, &daddr, 4); in ip_options_build()
56 if (opt->rr_needaddr) in ip_options_build()
57 ip_rt_get_source(iph + opt->rr + iph[opt->rr + 2] - 5, skb, rt); in ip_options_build()
58 if (opt->ts_needaddr) in ip_options_build()
59 ip_rt_get_source(iph + opt->ts + iph[opt->ts + 2] - 9, skb, rt); in ip_options_build()
60 if (opt->ts_needtime) { in ip_options_build()
64 memcpy(iph + opt->ts + iph[opt->ts + 2] - 5, &midtime, 4); in ip_options_build()
198 struct ip_options *opt = &(IPCB(skb)->opt); in ip_options_fragment() local
199 int l = opt->optlen; in ip_options_fragment()
219 opt->ts = 0; in ip_options_fragment()
220 opt->rr = 0; in ip_options_fragment()
221 opt->rr_needaddr = 0; in ip_options_fragment()
222 opt->ts_needaddr = 0; in ip_options_fragment()
223 opt->ts_needtime = 0; in ip_options_fragment()
242 struct ip_options *opt, struct sk_buff *skb, in __ip_options_compile() argument
256 optptr = opt->__data; in __ip_options_compile()
259 for (l = opt->optlen; l > 0; ) { in __ip_options_compile()
265 opt->is_changed = 1; in __ip_options_compile()
295 if (opt->srr) { in __ip_options_compile()
304 memcpy(&opt->faddr, &optptr[3], 4); in __ip_options_compile()
308 opt->is_strictroute = (optptr[0] == IPOPT_SSRR); in __ip_options_compile()
309 opt->srr = optptr - iph; in __ip_options_compile()
312 if (opt->rr) { in __ip_options_compile()
332 opt->is_changed = 1; in __ip_options_compile()
335 opt->rr_needaddr = 1; in __ip_options_compile()
337 opt->rr = optptr - iph; in __ip_options_compile()
340 if (opt->ts) { in __ip_options_compile()
362 opt->ts_needtime = 1; in __ip_options_compile()
375 opt->ts_needaddr = 1; in __ip_options_compile()
376 opt->ts_needtime = 1; in __ip_options_compile()
392 opt->ts_needtime = 1; in __ip_options_compile()
407 opt->is_changed = 1; in __ip_options_compile()
417 opt->is_changed = 1; in __ip_options_compile()
420 opt->ts = optptr - iph; in __ip_options_compile()
428 opt->router_alert = optptr - iph; in __ip_options_compile()
431 if ((!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) || opt->cipso) { in __ip_options_compile()
435 opt->cipso = optptr - iph; in __ip_options_compile()
466 struct ip_options *opt, struct sk_buff *skb) in ip_options_compile() argument
471 ret = __ip_options_compile(net, opt, skb, &info); in ip_options_compile()
482 void ip_options_undo(struct ip_options *opt) in ip_options_undo() argument
484 if (opt->srr) { in ip_options_undo()
485 unsigned char *optptr = opt->__data + opt->srr - sizeof(struct iphdr); in ip_options_undo()
488 memcpy(optptr + 3, &opt->faddr, 4); in ip_options_undo()
490 if (opt->rr_needaddr) { in ip_options_undo()
491 unsigned char *optptr = opt->__data + opt->rr - sizeof(struct iphdr); in ip_options_undo()
496 if (opt->ts) { in ip_options_undo()
497 unsigned char *optptr = opt->__data + opt->ts - sizeof(struct iphdr); in ip_options_undo()
499 if (opt->ts_needtime) { in ip_options_undo()
505 if (opt->ts_needaddr) { in ip_options_undo()
515 struct ip_options_rcu *opt; in ip_options_get() local
517 opt = kzalloc(sizeof(struct ip_options_rcu) + ((optlen + 3) & ~3), in ip_options_get()
519 if (!opt) in ip_options_get()
521 if (optlen && copy_from_sockptr(opt->opt.__data, data, optlen)) { in ip_options_get()
522 kfree(opt); in ip_options_get()
527 opt->opt.__data[optlen++] = IPOPT_END; in ip_options_get()
528 opt->opt.optlen = optlen; in ip_options_get()
529 if (optlen && ip_options_compile(net, &opt->opt, NULL)) { in ip_options_get()
530 kfree(opt); in ip_options_get()
534 *optp = opt; in ip_options_get()
540 struct ip_options *opt = &(IPCB(skb)->opt); in ip_forward_options() local
545 if (opt->rr_needaddr) { in ip_forward_options()
546 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
548 opt->is_changed = 1; in ip_forward_options()
550 if (opt->srr_is_hit) { in ip_forward_options()
553 optptr = raw + opt->srr; in ip_forward_options()
561 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
565 opt->is_changed = 1; in ip_forward_options()
566 ip_hdr(skb)->daddr = opt->nexthop; in ip_forward_options()
573 if (opt->ts_needaddr) { in ip_forward_options()
574 optptr = raw + opt->ts; in ip_forward_options()
576 opt->is_changed = 1; in ip_forward_options()
579 if (opt->is_changed) { in ip_forward_options()
580 opt->is_changed = 0; in ip_forward_options()
587 struct ip_options *opt = &(IPCB(skb)->opt); in ip_options_rcv_srr() local
591 unsigned char *optptr = skb_network_header(skb) + opt->srr; in ip_options_rcv_srr()
603 if (!opt->is_strictroute) in ip_options_rcv_srr()
613 icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((opt->srr+2)<<24)); in ip_options_rcv_srr()
632 opt->is_changed = 1; in ip_options_rcv_srr()
635 opt->srr_is_hit = 1; in ip_options_rcv_srr()
636 opt->nexthop = nexthop; in ip_options_rcv_srr()
637 opt->is_changed = 1; in ip_options_rcv_srr()