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()
57 if (opt->rr_needaddr) in ip_options_build()
58 ip_rt_get_source(iph + opt->rr + iph[opt->rr + 2] - 5, skb, rt); in ip_options_build()
59 if (opt->ts_needaddr) in ip_options_build()
60 ip_rt_get_source(iph + opt->ts + iph[opt->ts + 2] - 9, skb, rt); in ip_options_build()
61 if (opt->ts_needtime) { in ip_options_build()
65 memcpy(iph + opt->ts + iph[opt->ts + 2] - 5, &midtime, 4); in ip_options_build()
69 if (opt->rr) { in ip_options_build()
70 memset(iph + opt->rr, IPOPT_NOP, iph[opt->rr + 1]); in ip_options_build()
71 opt->rr = 0; in ip_options_build()
72 opt->rr_needaddr = 0; in ip_options_build()
74 if (opt->ts) { in ip_options_build()
75 memset(iph + opt->ts, IPOPT_NOP, iph[opt->ts + 1]); in ip_options_build()
76 opt->ts = 0; in ip_options_build()
77 opt->ts_needaddr = opt->ts_needtime = 0; in ip_options_build()
211 struct ip_options *opt = &(IPCB(skb)->opt); in ip_options_fragment() local
212 int l = opt->optlen; in ip_options_fragment()
232 opt->ts = 0; in ip_options_fragment()
233 opt->rr = 0; in ip_options_fragment()
234 opt->rr_needaddr = 0; in ip_options_fragment()
235 opt->ts_needaddr = 0; in ip_options_fragment()
236 opt->ts_needtime = 0; in ip_options_fragment()
255 struct ip_options *opt, struct sk_buff *skb, in __ip_options_compile() argument
269 optptr = opt->__data; in __ip_options_compile()
272 for (l = opt->optlen; l > 0; ) { in __ip_options_compile()
278 opt->is_changed = 1; in __ip_options_compile()
308 if (opt->srr) { in __ip_options_compile()
317 memcpy(&opt->faddr, &optptr[3], 4); in __ip_options_compile()
321 opt->is_strictroute = (optptr[0] == IPOPT_SSRR); in __ip_options_compile()
322 opt->srr = optptr - iph; in __ip_options_compile()
325 if (opt->rr) { in __ip_options_compile()
345 opt->is_changed = 1; in __ip_options_compile()
348 opt->rr_needaddr = 1; in __ip_options_compile()
350 opt->rr = optptr - iph; in __ip_options_compile()
353 if (opt->ts) { in __ip_options_compile()
375 opt->ts_needtime = 1; in __ip_options_compile()
388 opt->ts_needaddr = 1; in __ip_options_compile()
389 opt->ts_needtime = 1; in __ip_options_compile()
405 opt->ts_needtime = 1; in __ip_options_compile()
420 opt->is_changed = 1; in __ip_options_compile()
430 opt->is_changed = 1; in __ip_options_compile()
433 opt->ts = optptr - iph; in __ip_options_compile()
441 opt->router_alert = optptr - iph; in __ip_options_compile()
444 if ((!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) || opt->cipso) { in __ip_options_compile()
448 opt->cipso = optptr - iph; in __ip_options_compile()
479 struct ip_options *opt, struct sk_buff *skb) in ip_options_compile() argument
484 ret = __ip_options_compile(net, opt, skb, &info); in ip_options_compile()
495 void ip_options_undo(struct ip_options *opt) in ip_options_undo() argument
497 if (opt->srr) { in ip_options_undo()
498 unsigned char *optptr = opt->__data + opt->srr - sizeof(struct iphdr); in ip_options_undo()
501 memcpy(optptr + 3, &opt->faddr, 4); in ip_options_undo()
503 if (opt->rr_needaddr) { in ip_options_undo()
504 unsigned char *optptr = opt->__data + opt->rr - sizeof(struct iphdr); in ip_options_undo()
509 if (opt->ts) { in ip_options_undo()
510 unsigned char *optptr = opt->__data + opt->ts - sizeof(struct iphdr); in ip_options_undo()
512 if (opt->ts_needtime) { in ip_options_undo()
518 if (opt->ts_needaddr) { in ip_options_undo()
528 struct ip_options_rcu *opt; in ip_options_get() local
530 opt = kzalloc(sizeof(struct ip_options_rcu) + ((optlen + 3) & ~3), in ip_options_get()
532 if (!opt) in ip_options_get()
534 if (optlen && copy_from_sockptr(opt->opt.__data, data, optlen)) { in ip_options_get()
535 kfree(opt); in ip_options_get()
540 opt->opt.__data[optlen++] = IPOPT_END; in ip_options_get()
541 opt->opt.optlen = optlen; in ip_options_get()
542 if (optlen && ip_options_compile(net, &opt->opt, NULL)) { in ip_options_get()
543 kfree(opt); in ip_options_get()
547 *optp = opt; in ip_options_get()
553 struct ip_options *opt = &(IPCB(skb)->opt); in ip_forward_options() local
558 if (opt->rr_needaddr) { in ip_forward_options()
559 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
561 opt->is_changed = 1; in ip_forward_options()
563 if (opt->srr_is_hit) { in ip_forward_options()
566 optptr = raw + opt->srr; in ip_forward_options()
574 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
578 opt->is_changed = 1; in ip_forward_options()
579 ip_hdr(skb)->daddr = opt->nexthop; in ip_forward_options()
586 if (opt->ts_needaddr) { in ip_forward_options()
587 optptr = raw + opt->ts; in ip_forward_options()
589 opt->is_changed = 1; in ip_forward_options()
592 if (opt->is_changed) { in ip_forward_options()
593 opt->is_changed = 0; in ip_forward_options()
600 struct ip_options *opt = &(IPCB(skb)->opt); in ip_options_rcv_srr() local
604 unsigned char *optptr = skb_network_header(skb) + opt->srr; in ip_options_rcv_srr()
616 if (!opt->is_strictroute) in ip_options_rcv_srr()
626 icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((opt->srr+2)<<24)); in ip_options_rcv_srr()
645 opt->is_changed = 1; in ip_options_rcv_srr()
648 opt->srr_is_hit = 1; in ip_options_rcv_srr()
649 opt->nexthop = nexthop; in ip_options_rcv_srr()
650 opt->is_changed = 1; in ip_options_rcv_srr()