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()
260 unsigned char *optptr; in ip_options_compile() local
266 optptr = (unsigned char *)&(ip_hdr(skb)[1]); in ip_options_compile()
268 optptr = opt->__data; in ip_options_compile()
269 iph = optptr - sizeof(struct iphdr); in ip_options_compile()
272 switch (*optptr) { in ip_options_compile()
274 for (optptr++, l--; l > 0; optptr++, l--) { in ip_options_compile()
275 if (*optptr != IPOPT_END) { in ip_options_compile()
276 *optptr = IPOPT_END; in ip_options_compile()
283 optptr++; in ip_options_compile()
287 pp_ptr = optptr; in ip_options_compile()
290 optlen = optptr[1]; in ip_options_compile()
292 pp_ptr = optptr; in ip_options_compile()
295 switch (*optptr) { in ip_options_compile()
299 pp_ptr = optptr + 1; in ip_options_compile()
302 if (optptr[2] < 4) { in ip_options_compile()
303 pp_ptr = optptr + 2; in ip_options_compile()
308 pp_ptr = optptr; in ip_options_compile()
312 if (optptr[2] != 4 || optlen < 7 || ((optlen-3) & 3)) { in ip_options_compile()
313 pp_ptr = optptr + 1; in ip_options_compile()
316 memcpy(&opt->faddr, &optptr[3], 4); in ip_options_compile()
318 memmove(&optptr[3], &optptr[7], optlen-7); in ip_options_compile()
320 opt->is_strictroute = (optptr[0] == IPOPT_SSRR); in ip_options_compile()
321 opt->srr = optptr - iph; in ip_options_compile()
325 pp_ptr = optptr; in ip_options_compile()
329 pp_ptr = optptr + 1; in ip_options_compile()
332 if (optptr[2] < 4) { in ip_options_compile()
333 pp_ptr = optptr + 2; in ip_options_compile()
336 if (optptr[2] <= optlen) { in ip_options_compile()
337 if (optptr[2]+3 > optlen) { in ip_options_compile()
338 pp_ptr = optptr + 2; in ip_options_compile()
343 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in ip_options_compile()
346 optptr[2] += 4; in ip_options_compile()
349 opt->rr = optptr - iph; in ip_options_compile()
353 pp_ptr = optptr; in ip_options_compile()
357 pp_ptr = optptr + 1; in ip_options_compile()
360 if (optptr[2] < 5) { in ip_options_compile()
361 pp_ptr = optptr + 2; in ip_options_compile()
364 if (optptr[2] <= optlen) { in ip_options_compile()
366 if (optptr[2]+3 > optlen) { in ip_options_compile()
367 pp_ptr = optptr + 2; in ip_options_compile()
370 switch (optptr[3]&0xF) { in ip_options_compile()
373 timeptr = &optptr[optptr[2]-1]; in ip_options_compile()
375 optptr[2] += 4; in ip_options_compile()
378 if (optptr[2]+7 > optlen) { in ip_options_compile()
379 pp_ptr = optptr + 2; in ip_options_compile()
384 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in ip_options_compile()
385 timeptr = &optptr[optptr[2]+3]; in ip_options_compile()
389 optptr[2] += 8; in ip_options_compile()
392 if (optptr[2]+7 > optlen) { in ip_options_compile()
393 pp_ptr = optptr + 2; in ip_options_compile()
398 memcpy(&addr, &optptr[optptr[2]-1], 4); in ip_options_compile()
402 timeptr = &optptr[optptr[2]+3]; in ip_options_compile()
405 optptr[2] += 8; in ip_options_compile()
409 pp_ptr = optptr + 3; in ip_options_compile()
421 } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) { in ip_options_compile()
422 unsigned int overflow = optptr[3]>>4; in ip_options_compile()
424 pp_ptr = optptr + 3; in ip_options_compile()
428 optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); in ip_options_compile()
432 opt->ts = optptr - iph; in ip_options_compile()
436 pp_ptr = optptr + 1; in ip_options_compile()
439 if (optptr[2] == 0 && optptr[3] == 0) in ip_options_compile()
440 opt->router_alert = optptr - iph; in ip_options_compile()
444 pp_ptr = optptr; in ip_options_compile()
447 opt->cipso = optptr - iph; in ip_options_compile()
448 if (cipso_v4_validate(skb, &optptr)) { in ip_options_compile()
449 pp_ptr = optptr; in ip_options_compile()
457 pp_ptr = optptr; in ip_options_compile()
463 optptr += optlen; in ip_options_compile()
485 unsigned char *optptr = opt->__data+opt->srr-sizeof(struct iphdr); in ip_options_undo() local
486 memmove(optptr+7, optptr+3, optptr[1]-7); in ip_options_undo()
487 memcpy(optptr+3, &opt->faddr, 4); in ip_options_undo()
490 unsigned char *optptr = opt->__data+opt->rr-sizeof(struct iphdr); in ip_options_undo() local
491 optptr[2] -= 4; in ip_options_undo()
492 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
495 unsigned char *optptr = opt->__data+opt->ts-sizeof(struct iphdr); in ip_options_undo() local
497 optptr[2] -= 4; in ip_options_undo()
498 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
499 if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC) in ip_options_undo()
500 optptr[2] -= 4; in ip_options_undo()
503 optptr[2] -= 4; in ip_options_undo()
504 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
559 unsigned char *optptr; in ip_forward_options() local
564 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
565 ip_rt_get_source(&optptr[optptr[2]-5], skb, rt); in ip_forward_options()
571 optptr = raw + opt->srr; in ip_forward_options()
573 for ( srrptr = optptr[2], srrspace = optptr[1]; in ip_forward_options()
579 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
585 ip_rt_get_source(&optptr[srrptr-1], skb, rt); in ip_forward_options()
586 optptr[2] = srrptr+4; in ip_forward_options()
592 optptr = raw + opt->ts; in ip_forward_options()
593 ip_rt_get_source(&optptr[optptr[2]-9], skb, rt); in ip_forward_options()
609 unsigned char *optptr = skb_network_header(skb) + opt->srr; in ip_options_rcv_srr() local
629 for (srrptr = optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) { in ip_options_rcv_srr()
634 memcpy(&nexthop, &optptr[srrptr-1], 4); in ip_options_rcv_srr()