Lines Matching refs:optptr

213 	unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr);  in ip_options_fragment()  local
219 switch (*optptr) { in ip_options_fragment()
224 optptr++; in ip_options_fragment()
227 optlen = optptr[1]; in ip_options_fragment()
230 if (!IPOPT_COPIED(*optptr)) in ip_options_fragment()
231 memset(optptr, IPOPT_NOOP, optlen); in ip_options_fragment()
233 optptr += optlen; in ip_options_fragment()
263 unsigned char *optptr; in ip_options_compile() local
269 optptr = (unsigned char *)&(ip_hdr(skb)[1]); in ip_options_compile()
271 optptr = opt->__data; in ip_options_compile()
272 iph = optptr - sizeof(struct iphdr); in ip_options_compile()
275 switch (*optptr) { in ip_options_compile()
277 for (optptr++, l--; l > 0; optptr++, l--) { in ip_options_compile()
278 if (*optptr != IPOPT_END) { in ip_options_compile()
279 *optptr = IPOPT_END; in ip_options_compile()
286 optptr++; in ip_options_compile()
290 pp_ptr = optptr; in ip_options_compile()
293 optlen = optptr[1]; in ip_options_compile()
295 pp_ptr = optptr; in ip_options_compile()
298 switch (*optptr) { in ip_options_compile()
302 pp_ptr = optptr + 1; in ip_options_compile()
305 if (optptr[2] < 4) { in ip_options_compile()
306 pp_ptr = optptr + 2; in ip_options_compile()
311 pp_ptr = optptr; in ip_options_compile()
315 if (optptr[2] != 4 || optlen < 7 || ((optlen-3) & 3)) { in ip_options_compile()
316 pp_ptr = optptr + 1; in ip_options_compile()
319 memcpy(&opt->faddr, &optptr[3], 4); in ip_options_compile()
321 memmove(&optptr[3], &optptr[7], optlen-7); in ip_options_compile()
323 opt->is_strictroute = (optptr[0] == IPOPT_SSRR); in ip_options_compile()
324 opt->srr = optptr - iph; in ip_options_compile()
328 pp_ptr = optptr; in ip_options_compile()
332 pp_ptr = optptr + 1; in ip_options_compile()
335 if (optptr[2] < 4) { in ip_options_compile()
336 pp_ptr = optptr + 2; in ip_options_compile()
339 if (optptr[2] <= optlen) { in ip_options_compile()
340 if (optptr[2]+3 > optlen) { in ip_options_compile()
341 pp_ptr = optptr + 2; in ip_options_compile()
346 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in ip_options_compile()
349 optptr[2] += 4; in ip_options_compile()
352 opt->rr = optptr - iph; in ip_options_compile()
356 pp_ptr = optptr; in ip_options_compile()
360 pp_ptr = optptr + 1; in ip_options_compile()
363 if (optptr[2] < 5) { in ip_options_compile()
364 pp_ptr = optptr + 2; in ip_options_compile()
367 if (optptr[2] <= optlen) { in ip_options_compile()
369 if (optptr[2]+3 > optlen) { in ip_options_compile()
370 pp_ptr = optptr + 2; in ip_options_compile()
373 switch (optptr[3]&0xF) { in ip_options_compile()
376 timeptr = &optptr[optptr[2]-1]; in ip_options_compile()
378 optptr[2] += 4; in ip_options_compile()
381 if (optptr[2]+7 > optlen) { in ip_options_compile()
382 pp_ptr = optptr + 2; in ip_options_compile()
387 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in ip_options_compile()
388 timeptr = &optptr[optptr[2]+3]; in ip_options_compile()
392 optptr[2] += 8; in ip_options_compile()
395 if (optptr[2]+7 > optlen) { in ip_options_compile()
396 pp_ptr = optptr + 2; in ip_options_compile()
401 memcpy(&addr, &optptr[optptr[2]-1], 4); in ip_options_compile()
405 timeptr = &optptr[optptr[2]+3]; in ip_options_compile()
408 optptr[2] += 8; in ip_options_compile()
412 pp_ptr = optptr + 3; in ip_options_compile()
425 } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) { in ip_options_compile()
426 unsigned int overflow = optptr[3]>>4; in ip_options_compile()
428 pp_ptr = optptr + 3; in ip_options_compile()
432 optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); in ip_options_compile()
436 opt->ts = optptr - iph; in ip_options_compile()
440 pp_ptr = optptr + 1; in ip_options_compile()
443 if (optptr[2] == 0 && optptr[3] == 0) in ip_options_compile()
444 opt->router_alert = optptr - iph; in ip_options_compile()
448 pp_ptr = optptr; in ip_options_compile()
451 opt->cipso = optptr - iph; in ip_options_compile()
452 if (cipso_v4_validate(skb, &optptr)) { in ip_options_compile()
453 pp_ptr = optptr; in ip_options_compile()
461 pp_ptr = optptr; in ip_options_compile()
467 optptr += optlen; in ip_options_compile()
489 unsigned char *optptr = opt->__data+opt->srr-sizeof(struct iphdr); in ip_options_undo() local
490 memmove(optptr+7, optptr+3, optptr[1]-7); in ip_options_undo()
491 memcpy(optptr+3, &opt->faddr, 4); in ip_options_undo()
494 unsigned char *optptr = opt->__data+opt->rr-sizeof(struct iphdr); in ip_options_undo() local
495 optptr[2] -= 4; in ip_options_undo()
496 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
499 unsigned char *optptr = opt->__data+opt->ts-sizeof(struct iphdr); in ip_options_undo() local
501 optptr[2] -= 4; in ip_options_undo()
502 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
503 if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC) in ip_options_undo()
504 optptr[2] -= 4; in ip_options_undo()
507 optptr[2] -= 4; in ip_options_undo()
508 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
563 unsigned char *optptr; in ip_forward_options() local
568 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
569 ip_rt_get_source(&optptr[optptr[2]-5], skb, rt); in ip_forward_options()
575 optptr = raw + opt->srr; in ip_forward_options()
577 for ( srrptr = optptr[2], srrspace = optptr[1]; in ip_forward_options()
583 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
589 ip_rt_get_source(&optptr[srrptr-1], skb, rt); in ip_forward_options()
590 optptr[2] = srrptr+4; in ip_forward_options()
596 optptr = raw + opt->ts; in ip_forward_options()
597 ip_rt_get_source(&optptr[optptr[2]-9], skb, rt); in ip_forward_options()
613 unsigned char *optptr = skb_network_header(skb) + opt->srr; in ip_options_rcv_srr() local
633 for (srrptr = optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) { in ip_options_rcv_srr()
638 memcpy(&nexthop, &optptr[srrptr-1], 4); in ip_options_rcv_srr()