Lines Matching refs:optptr
210 unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr); in ip_options_fragment() local
216 switch (*optptr) { in ip_options_fragment()
221 optptr++; in ip_options_fragment()
224 optlen = optptr[1]; in ip_options_fragment()
227 if (!IPOPT_COPIED(*optptr)) in ip_options_fragment()
228 memset(optptr, IPOPT_NOOP, optlen); in ip_options_fragment()
230 optptr += optlen; in ip_options_fragment()
261 unsigned char *optptr; in __ip_options_compile() local
267 optptr = (unsigned char *)&(ip_hdr(skb)[1]); in __ip_options_compile()
269 optptr = opt->__data; in __ip_options_compile()
270 iph = optptr - sizeof(struct iphdr); in __ip_options_compile()
273 switch (*optptr) { in __ip_options_compile()
275 for (optptr++, l--; l > 0; optptr++, l--) { in __ip_options_compile()
276 if (*optptr != IPOPT_END) { in __ip_options_compile()
277 *optptr = IPOPT_END; in __ip_options_compile()
284 optptr++; in __ip_options_compile()
288 pp_ptr = optptr; in __ip_options_compile()
291 optlen = optptr[1]; in __ip_options_compile()
293 pp_ptr = optptr; in __ip_options_compile()
296 switch (*optptr) { in __ip_options_compile()
300 pp_ptr = optptr + 1; in __ip_options_compile()
303 if (optptr[2] < 4) { in __ip_options_compile()
304 pp_ptr = optptr + 2; in __ip_options_compile()
309 pp_ptr = optptr; in __ip_options_compile()
313 if (optptr[2] != 4 || optlen < 7 || ((optlen-3) & 3)) { in __ip_options_compile()
314 pp_ptr = optptr + 1; in __ip_options_compile()
317 memcpy(&opt->faddr, &optptr[3], 4); in __ip_options_compile()
319 memmove(&optptr[3], &optptr[7], optlen-7); 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()
326 pp_ptr = optptr; in __ip_options_compile()
330 pp_ptr = optptr + 1; in __ip_options_compile()
333 if (optptr[2] < 4) { in __ip_options_compile()
334 pp_ptr = optptr + 2; in __ip_options_compile()
337 if (optptr[2] <= optlen) { in __ip_options_compile()
338 if (optptr[2]+3 > optlen) { in __ip_options_compile()
339 pp_ptr = optptr + 2; in __ip_options_compile()
344 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in __ip_options_compile()
347 optptr[2] += 4; in __ip_options_compile()
350 opt->rr = optptr - iph; in __ip_options_compile()
354 pp_ptr = optptr; in __ip_options_compile()
358 pp_ptr = optptr + 1; in __ip_options_compile()
361 if (optptr[2] < 5) { in __ip_options_compile()
362 pp_ptr = optptr + 2; in __ip_options_compile()
365 if (optptr[2] <= optlen) { in __ip_options_compile()
367 if (optptr[2]+3 > optlen) { in __ip_options_compile()
368 pp_ptr = optptr + 2; in __ip_options_compile()
371 switch (optptr[3]&0xF) { in __ip_options_compile()
374 timeptr = &optptr[optptr[2]-1]; in __ip_options_compile()
376 optptr[2] += 4; in __ip_options_compile()
379 if (optptr[2]+7 > optlen) { in __ip_options_compile()
380 pp_ptr = optptr + 2; in __ip_options_compile()
385 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in __ip_options_compile()
386 timeptr = &optptr[optptr[2]+3]; in __ip_options_compile()
390 optptr[2] += 8; in __ip_options_compile()
393 if (optptr[2]+7 > optlen) { in __ip_options_compile()
394 pp_ptr = optptr + 2; in __ip_options_compile()
399 memcpy(&addr, &optptr[optptr[2]-1], 4); in __ip_options_compile()
403 timeptr = &optptr[optptr[2]+3]; in __ip_options_compile()
406 optptr[2] += 8; in __ip_options_compile()
410 pp_ptr = optptr + 3; in __ip_options_compile()
422 } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) { in __ip_options_compile()
423 unsigned int overflow = optptr[3]>>4; in __ip_options_compile()
425 pp_ptr = optptr + 3; in __ip_options_compile()
429 optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); in __ip_options_compile()
433 opt->ts = optptr - iph; in __ip_options_compile()
437 pp_ptr = optptr + 1; in __ip_options_compile()
440 if (optptr[2] == 0 && optptr[3] == 0) in __ip_options_compile()
441 opt->router_alert = optptr - iph; in __ip_options_compile()
445 pp_ptr = optptr; in __ip_options_compile()
448 opt->cipso = optptr - iph; in __ip_options_compile()
449 if (cipso_v4_validate(skb, &optptr)) { in __ip_options_compile()
450 pp_ptr = optptr; in __ip_options_compile()
458 pp_ptr = optptr; in __ip_options_compile()
464 optptr += optlen; in __ip_options_compile()
498 unsigned char *optptr = opt->__data+opt->srr-sizeof(struct iphdr); in ip_options_undo() local
499 memmove(optptr+7, optptr+3, optptr[1]-7); in ip_options_undo()
500 memcpy(optptr+3, &opt->faddr, 4); in ip_options_undo()
503 unsigned char *optptr = opt->__data+opt->rr-sizeof(struct iphdr); in ip_options_undo() local
504 optptr[2] -= 4; in ip_options_undo()
505 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
508 unsigned char *optptr = opt->__data+opt->ts-sizeof(struct iphdr); in ip_options_undo() local
510 optptr[2] -= 4; in ip_options_undo()
511 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
512 if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC) in ip_options_undo()
513 optptr[2] -= 4; in ip_options_undo()
516 optptr[2] -= 4; in ip_options_undo()
517 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
572 unsigned char *optptr; in ip_forward_options() local
577 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
578 ip_rt_get_source(&optptr[optptr[2]-5], skb, rt); in ip_forward_options()
584 optptr = raw + opt->srr; in ip_forward_options()
586 for ( srrptr = optptr[2], srrspace = optptr[1]; in ip_forward_options()
592 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
598 ip_rt_get_source(&optptr[srrptr-1], skb, rt); in ip_forward_options()
599 optptr[2] = srrptr+4; in ip_forward_options()
605 optptr = raw + opt->ts; in ip_forward_options()
606 ip_rt_get_source(&optptr[optptr[2]-9], skb, rt); in ip_forward_options()
622 unsigned char *optptr = skb_network_header(skb) + opt->srr; in ip_options_rcv_srr() local
642 for (srrptr = optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) { in ip_options_rcv_srr()
647 memcpy(&nexthop, &optptr[srrptr-1], 4); in ip_options_rcv_srr()