Lines Matching refs:opt

36 void ip_options_build(struct sk_buff * skb, struct ip_options * opt,  in ip_options_build()  argument
41 memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options)); in ip_options_build()
42 memcpy(iph+sizeof(struct iphdr), opt->__data, opt->optlen); in ip_options_build()
43 opt = &(IPCB(skb)->opt); in ip_options_build()
44 opt->is_data = 0; in ip_options_build()
46 if (opt->srr) in ip_options_build()
47 memcpy(iph+opt->srr+iph[opt->srr+1]-4, &daddr, 4); in ip_options_build()
50 if (opt->rr_needaddr) in ip_options_build()
51 ip_rt_get_source(iph+opt->rr+iph[opt->rr+2]-5, rt); in ip_options_build()
52 if (opt->ts_needaddr) in ip_options_build()
53 ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt); in ip_options_build()
54 if (opt->ts_needtime) { in ip_options_build()
59 memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); in ip_options_build()
63 if (opt->rr) { in ip_options_build()
64 memset(iph+opt->rr, IPOPT_NOP, iph[opt->rr+1]); in ip_options_build()
65 opt->rr = 0; in ip_options_build()
66 opt->rr_needaddr = 0; in ip_options_build()
68 if (opt->ts) { in ip_options_build()
69 memset(iph+opt->ts, IPOPT_NOP, iph[opt->ts+1]); in ip_options_build()
70 opt->ts = 0; in ip_options_build()
71 opt->ts_needaddr = opt->ts_needtime = 0; in ip_options_build()
96 sopt = &(IPCB(skb)->opt); in ip_options_echo()
210 struct ip_options * opt = &(IPCB(skb)->opt); in ip_options_fragment() local
211 int l = opt->optlen; in ip_options_fragment()
231 opt->ts = 0; in ip_options_fragment()
232 opt->rr = 0; in ip_options_fragment()
233 opt->rr_needaddr = 0; in ip_options_fragment()
234 opt->ts_needaddr = 0; in ip_options_fragment()
235 opt->ts_needtime = 0; in ip_options_fragment()
245 int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) in ip_options_compile() argument
254 if (!opt) { in ip_options_compile()
255 opt = &(IPCB(skb)->opt); in ip_options_compile()
256 memset(opt, 0, sizeof(struct ip_options)); in ip_options_compile()
258 opt->optlen = ((struct iphdr *)iph)->ihl*4 - sizeof(struct iphdr); in ip_options_compile()
260 opt->is_data = 0; in ip_options_compile()
262 optptr = opt->is_data ? opt->__data : (unsigned char*)&(skb->nh.iph[1]); in ip_options_compile()
266 for (l = opt->optlen; l > 0; ) { in ip_options_compile()
272 opt->is_changed = 1; in ip_options_compile()
298 if (opt->srr) { in ip_options_compile()
307 memcpy(&opt->faddr, &optptr[3], 4); in ip_options_compile()
311 opt->is_strictroute = (optptr[0] == IPOPT_SSRR); in ip_options_compile()
312 opt->srr = optptr - iph; in ip_options_compile()
315 if (opt->rr) { in ip_options_compile()
334 opt->is_changed = 1; in ip_options_compile()
337 opt->rr_needaddr = 1; in ip_options_compile()
339 opt->rr = optptr - iph; in ip_options_compile()
342 if (opt->ts) { in ip_options_compile()
362 opt->ts = optptr - iph; in ip_options_compile()
365 opt->ts_needtime = 1; in ip_options_compile()
373 opt->ts = optptr - iph; in ip_options_compile()
378 opt->ts_needaddr = 1; in ip_options_compile()
379 opt->ts_needtime = 1; in ip_options_compile()
387 opt->ts = optptr - iph; in ip_options_compile()
396 opt->ts_needtime = 1; in ip_options_compile()
412 opt->is_changed = 1; in ip_options_compile()
420 opt->ts = optptr - iph; in ip_options_compile()
423 opt->is_changed = 1; in ip_options_compile()
433 opt->router_alert = optptr - iph; in ip_options_compile()
464 void ip_options_undo(struct ip_options * opt) in ip_options_undo() argument
466 if (opt->srr) { in ip_options_undo()
467 unsigned char * optptr = opt->__data+opt->srr-sizeof(struct iphdr); in ip_options_undo()
469 memcpy(optptr+3, &opt->faddr, 4); in ip_options_undo()
471 if (opt->rr_needaddr) { in ip_options_undo()
472 unsigned char * optptr = opt->__data+opt->rr-sizeof(struct iphdr); in ip_options_undo()
476 if (opt->ts) { in ip_options_undo()
477 unsigned char * optptr = opt->__data+opt->ts-sizeof(struct iphdr); in ip_options_undo()
478 if (opt->ts_needtime) { in ip_options_undo()
484 if (opt->ts_needaddr) { in ip_options_undo()
493 struct ip_options *opt; in ip_options_get() local
495 opt = kmalloc(sizeof(struct ip_options)+((optlen+3)&~3), GFP_KERNEL); in ip_options_get()
496 if (!opt) in ip_options_get()
498 memset(opt, 0, sizeof(struct ip_options)); in ip_options_get()
501 if (copy_from_user(opt->__data, data, optlen)) { in ip_options_get()
502 kfree(opt); in ip_options_get()
506 memcpy(opt->__data, data, optlen); in ip_options_get()
509 opt->__data[optlen++] = IPOPT_END; in ip_options_get()
510 opt->optlen = optlen; in ip_options_get()
511 opt->is_data = 1; in ip_options_get()
512 opt->is_setbyuser = 1; in ip_options_get()
513 if (optlen && ip_options_compile(opt, NULL)) { in ip_options_get()
514 kfree(opt); in ip_options_get()
519 *optp = opt; in ip_options_get()
525 struct ip_options * opt = &(IPCB(skb)->opt); in ip_forward_options() local
530 if (opt->rr_needaddr) { in ip_forward_options()
531 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
533 opt->is_changed = 1; in ip_forward_options()
535 if (opt->srr_is_hit) { in ip_forward_options()
538 optptr = raw + opt->srr; in ip_forward_options()
550 opt->is_changed = 1; in ip_forward_options()
556 if (opt->ts_needaddr) { in ip_forward_options()
557 optptr = raw + opt->ts; in ip_forward_options()
559 opt->is_changed = 1; in ip_forward_options()
562 if (opt->is_changed) { in ip_forward_options()
563 opt->is_changed = 0; in ip_forward_options()
570 struct ip_options *opt = &(IPCB(skb)->opt); in ip_options_rcv_srr() local
574 unsigned char * optptr = skb->nh.raw + opt->srr; in ip_options_rcv_srr()
579 if (!opt->srr) in ip_options_rcv_srr()
585 if (!opt->is_strictroute) in ip_options_rcv_srr()
595 icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((opt->srr+2)<<24)); in ip_options_rcv_srr()
614 opt->is_changed = 1; in ip_options_rcv_srr()
617 opt->srr_is_hit = 1; in ip_options_rcv_srr()
618 opt->is_changed = 1; in ip_options_rcv_srr()