Lines Matching refs:optptr

214 	unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr);  in ip_options_fragment()  local
220 switch (*optptr) { in ip_options_fragment()
225 optptr++; in ip_options_fragment()
228 optlen = optptr[1]; in ip_options_fragment()
231 if (!IPOPT_COPIED(*optptr)) in ip_options_fragment()
232 memset(optptr, IPOPT_NOOP, optlen); in ip_options_fragment()
234 optptr += optlen; in ip_options_fragment()
254 unsigned char * optptr; in ip_options_compile() local
261 optptr = (unsigned char *)&(ip_hdr(skb)[1]); in ip_options_compile()
263 optptr = opt->__data; in ip_options_compile()
264 iph = optptr - sizeof(struct iphdr); in ip_options_compile()
267 switch (*optptr) { in ip_options_compile()
269 for (optptr++, l--; l>0; optptr++, l--) { in ip_options_compile()
270 if (*optptr != IPOPT_END) { in ip_options_compile()
271 *optptr = IPOPT_END; in ip_options_compile()
278 optptr++; in ip_options_compile()
281 optlen = optptr[1]; in ip_options_compile()
283 pp_ptr = optptr; in ip_options_compile()
286 switch (*optptr) { in ip_options_compile()
290 pp_ptr = optptr + 1; in ip_options_compile()
293 if (optptr[2] < 4) { in ip_options_compile()
294 pp_ptr = optptr + 2; in ip_options_compile()
299 pp_ptr = optptr; in ip_options_compile()
303 if (optptr[2] != 4 || optlen < 7 || ((optlen-3) & 3)) { in ip_options_compile()
304 pp_ptr = optptr + 1; in ip_options_compile()
307 memcpy(&opt->faddr, &optptr[3], 4); in ip_options_compile()
309 memmove(&optptr[3], &optptr[7], optlen-7); 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()
316 pp_ptr = optptr; in ip_options_compile()
320 pp_ptr = optptr + 1; in ip_options_compile()
323 if (optptr[2] < 4) { in ip_options_compile()
324 pp_ptr = optptr + 2; in ip_options_compile()
327 if (optptr[2] <= optlen) { in ip_options_compile()
328 if (optptr[2]+3 > optlen) { in ip_options_compile()
329 pp_ptr = optptr + 2; in ip_options_compile()
333 memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); in ip_options_compile()
336 optptr[2] += 4; in ip_options_compile()
339 opt->rr = optptr - iph; in ip_options_compile()
343 pp_ptr = optptr; in ip_options_compile()
347 pp_ptr = optptr + 1; in ip_options_compile()
350 if (optptr[2] < 5) { in ip_options_compile()
351 pp_ptr = optptr + 2; in ip_options_compile()
354 if (optptr[2] <= optlen) { in ip_options_compile()
356 if (optptr[2]+3 > optptr[1]) { in ip_options_compile()
357 pp_ptr = optptr + 2; in ip_options_compile()
360 switch (optptr[3]&0xF) { in ip_options_compile()
362 opt->ts = optptr - iph; in ip_options_compile()
364 timeptr = (__be32*)&optptr[optptr[2]-1]; in ip_options_compile()
366 optptr[2] += 4; in ip_options_compile()
369 if (optptr[2]+7 > optptr[1]) { in ip_options_compile()
370 pp_ptr = optptr + 2; in ip_options_compile()
373 opt->ts = optptr - iph; in ip_options_compile()
375 memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); in ip_options_compile()
376 timeptr = (__be32*)&optptr[optptr[2]+3]; in ip_options_compile()
380 optptr[2] += 8; in ip_options_compile()
383 if (optptr[2]+7 > optptr[1]) { in ip_options_compile()
384 pp_ptr = optptr + 2; in ip_options_compile()
387 opt->ts = optptr - iph; in ip_options_compile()
390 memcpy(&addr, &optptr[optptr[2]-1], 4); in ip_options_compile()
394 timeptr = (__be32*)&optptr[optptr[2]+3]; in ip_options_compile()
397 optptr[2] += 8; in ip_options_compile()
401 pp_ptr = optptr + 3; in ip_options_compile()
415 unsigned overflow = optptr[3]>>4; in ip_options_compile()
417 pp_ptr = optptr + 3; in ip_options_compile()
420 opt->ts = optptr - iph; in ip_options_compile()
422 optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); in ip_options_compile()
429 pp_ptr = optptr + 1; in ip_options_compile()
432 if (optptr[2] == 0 && optptr[3] == 0) in ip_options_compile()
433 opt->router_alert = optptr - iph; in ip_options_compile()
437 pp_ptr = optptr; in ip_options_compile()
440 opt->cipso = optptr - iph; in ip_options_compile()
441 if (cipso_v4_validate(skb, &optptr)) { in ip_options_compile()
442 pp_ptr = optptr; in ip_options_compile()
450 pp_ptr = optptr; in ip_options_compile()
456 optptr += optlen; in ip_options_compile()
478 unsigned char * optptr = opt->__data+opt->srr-sizeof(struct iphdr); in ip_options_undo() local
479 memmove(optptr+7, optptr+3, optptr[1]-7); in ip_options_undo()
480 memcpy(optptr+3, &opt->faddr, 4); in ip_options_undo()
483 unsigned char * optptr = opt->__data+opt->rr-sizeof(struct iphdr); in ip_options_undo() local
484 optptr[2] -= 4; in ip_options_undo()
485 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
488 unsigned char * optptr = opt->__data+opt->ts-sizeof(struct iphdr); in ip_options_undo() local
490 optptr[2] -= 4; in ip_options_undo()
491 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
492 if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC) in ip_options_undo()
493 optptr[2] -= 4; in ip_options_undo()
496 optptr[2] -= 4; in ip_options_undo()
497 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
552 unsigned char * optptr; in ip_forward_options() local
557 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
558 ip_rt_get_source(&optptr[optptr[2]-5], rt); in ip_forward_options()
564 optptr = raw + opt->srr; in ip_forward_options()
566 for ( srrptr=optptr[2], srrspace = optptr[1]; in ip_forward_options()
572 if (memcmp(&rt->rt_dst, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
577 ip_rt_get_source(&optptr[srrptr-1], rt); in ip_forward_options()
579 optptr[2] = srrptr+4; in ip_forward_options()
583 optptr = raw + opt->ts; in ip_forward_options()
584 ip_rt_get_source(&optptr[optptr[2]-9], rt); in ip_forward_options()
600 unsigned char *optptr = skb_network_header(skb) + opt->srr; in ip_options_rcv_srr() local
620 for (srrptr=optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) { in ip_options_rcv_srr()
625 memcpy(&nexthop, &optptr[srrptr-1], 4); in ip_options_rcv_srr()
640 memcpy(&iph->daddr, &optptr[srrptr-1], 4); in ip_options_rcv_srr()