Lines Matching refs:optptr
197 unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr); in ip_options_fragment() local
203 switch (*optptr) { in ip_options_fragment()
208 optptr++; in ip_options_fragment()
211 optlen = optptr[1]; in ip_options_fragment()
214 if (!IPOPT_COPIED(*optptr)) in ip_options_fragment()
215 memset(optptr, IPOPT_NOOP, optlen); in ip_options_fragment()
217 optptr += optlen; in ip_options_fragment()
248 unsigned char *optptr; in __ip_options_compile() local
254 optptr = (unsigned char *)&(ip_hdr(skb)[1]); in __ip_options_compile()
256 optptr = opt->__data; in __ip_options_compile()
257 iph = optptr - sizeof(struct iphdr); in __ip_options_compile()
260 switch (*optptr) { in __ip_options_compile()
262 for (optptr++, l--; l > 0; optptr++, l--) { in __ip_options_compile()
263 if (*optptr != IPOPT_END) { in __ip_options_compile()
264 *optptr = IPOPT_END; in __ip_options_compile()
271 optptr++; in __ip_options_compile()
275 pp_ptr = optptr; in __ip_options_compile()
278 optlen = optptr[1]; in __ip_options_compile()
280 pp_ptr = optptr; in __ip_options_compile()
283 switch (*optptr) { in __ip_options_compile()
287 pp_ptr = optptr + 1; in __ip_options_compile()
290 if (optptr[2] < 4) { in __ip_options_compile()
291 pp_ptr = optptr + 2; in __ip_options_compile()
296 pp_ptr = optptr; in __ip_options_compile()
300 if (optptr[2] != 4 || optlen < 7 || ((optlen-3) & 3)) { in __ip_options_compile()
301 pp_ptr = optptr + 1; in __ip_options_compile()
304 memcpy(&opt->faddr, &optptr[3], 4); in __ip_options_compile()
306 memmove(&optptr[3], &optptr[7], optlen-7); in __ip_options_compile()
308 opt->is_strictroute = (optptr[0] == IPOPT_SSRR); in __ip_options_compile()
309 opt->srr = optptr - iph; in __ip_options_compile()
313 pp_ptr = optptr; in __ip_options_compile()
317 pp_ptr = optptr + 1; in __ip_options_compile()
320 if (optptr[2] < 4) { in __ip_options_compile()
321 pp_ptr = optptr + 2; in __ip_options_compile()
324 if (optptr[2] <= optlen) { in __ip_options_compile()
325 if (optptr[2]+3 > optlen) { in __ip_options_compile()
326 pp_ptr = optptr + 2; in __ip_options_compile()
331 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in __ip_options_compile()
334 optptr[2] += 4; in __ip_options_compile()
337 opt->rr = optptr - iph; in __ip_options_compile()
341 pp_ptr = optptr; in __ip_options_compile()
345 pp_ptr = optptr + 1; in __ip_options_compile()
348 if (optptr[2] < 5) { in __ip_options_compile()
349 pp_ptr = optptr + 2; in __ip_options_compile()
352 if (optptr[2] <= optlen) { in __ip_options_compile()
354 if (optptr[2]+3 > optlen) { in __ip_options_compile()
355 pp_ptr = optptr + 2; in __ip_options_compile()
358 switch (optptr[3]&0xF) { in __ip_options_compile()
361 timeptr = &optptr[optptr[2]-1]; in __ip_options_compile()
363 optptr[2] += 4; in __ip_options_compile()
366 if (optptr[2]+7 > optlen) { in __ip_options_compile()
367 pp_ptr = optptr + 2; in __ip_options_compile()
372 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); in __ip_options_compile()
373 timeptr = &optptr[optptr[2]+3]; in __ip_options_compile()
377 optptr[2] += 8; in __ip_options_compile()
380 if (optptr[2]+7 > optlen) { in __ip_options_compile()
381 pp_ptr = optptr + 2; in __ip_options_compile()
386 memcpy(&addr, &optptr[optptr[2]-1], 4); in __ip_options_compile()
390 timeptr = &optptr[optptr[2]+3]; in __ip_options_compile()
393 optptr[2] += 8; in __ip_options_compile()
397 pp_ptr = optptr + 3; in __ip_options_compile()
409 } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) { in __ip_options_compile()
410 unsigned int overflow = optptr[3]>>4; in __ip_options_compile()
412 pp_ptr = optptr + 3; in __ip_options_compile()
416 optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); in __ip_options_compile()
420 opt->ts = optptr - iph; in __ip_options_compile()
424 pp_ptr = optptr + 1; in __ip_options_compile()
427 if (optptr[2] == 0 && optptr[3] == 0) in __ip_options_compile()
428 opt->router_alert = optptr - iph; in __ip_options_compile()
432 pp_ptr = optptr; in __ip_options_compile()
435 opt->cipso = optptr - iph; in __ip_options_compile()
436 if (cipso_v4_validate(skb, &optptr)) { in __ip_options_compile()
437 pp_ptr = optptr; in __ip_options_compile()
445 pp_ptr = optptr; in __ip_options_compile()
451 optptr += optlen; in __ip_options_compile()
485 unsigned char *optptr = opt->__data + opt->srr - sizeof(struct iphdr); in ip_options_undo() local
487 memmove(optptr + 7, optptr + 3, optptr[1] - 7); in ip_options_undo()
488 memcpy(optptr + 3, &opt->faddr, 4); in ip_options_undo()
491 unsigned char *optptr = opt->__data + opt->rr - sizeof(struct iphdr); in ip_options_undo() local
493 optptr[2] -= 4; in ip_options_undo()
494 memset(&optptr[optptr[2] - 1], 0, 4); in ip_options_undo()
497 unsigned char *optptr = opt->__data + opt->ts - sizeof(struct iphdr); in ip_options_undo() local
500 optptr[2] -= 4; in ip_options_undo()
501 memset(&optptr[optptr[2] - 1], 0, 4); in ip_options_undo()
502 if ((optptr[3] & 0xF) == IPOPT_TS_PRESPEC) in ip_options_undo()
503 optptr[2] -= 4; in ip_options_undo()
506 optptr[2] -= 4; in ip_options_undo()
507 memset(&optptr[optptr[2] - 1], 0, 4); in ip_options_undo()
541 unsigned char *optptr; in ip_forward_options() local
546 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
547 ip_rt_get_source(&optptr[optptr[2]-5], skb, rt); in ip_forward_options()
553 optptr = raw + opt->srr; in ip_forward_options()
555 for ( srrptr = optptr[2], srrspace = optptr[1]; in ip_forward_options()
561 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
567 ip_rt_get_source(&optptr[srrptr-1], skb, rt); in ip_forward_options()
568 optptr[2] = srrptr+4; in ip_forward_options()
574 optptr = raw + opt->ts; in ip_forward_options()
575 ip_rt_get_source(&optptr[optptr[2]-9], skb, rt); in ip_forward_options()
591 unsigned char *optptr = skb_network_header(skb) + opt->srr; in ip_options_rcv_srr() local
611 for (srrptr = optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) { in ip_options_rcv_srr()
616 memcpy(&nexthop, &optptr[srrptr-1], 4); in ip_options_rcv_srr()