Lines Matching refs:optptr
209 unsigned char * optptr = skb->nh.raw; in ip_options_fragment() local
215 switch (*optptr) { in ip_options_fragment()
220 optptr++; in ip_options_fragment()
223 optlen = optptr[1]; in ip_options_fragment()
226 if (!IPOPT_COPIED(*optptr)) in ip_options_fragment()
227 memset(optptr, IPOPT_NOOP, optlen); in ip_options_fragment()
229 optptr += optlen; in ip_options_fragment()
249 unsigned char * optptr; in ip_options_compile() local
259 optptr = iph + sizeof(struct iphdr); in ip_options_compile()
262 optptr = opt->is_data ? opt->__data : (unsigned char*)&(skb->nh.iph[1]); in ip_options_compile()
263 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 = (__u32*)&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 = (__u32*)&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 = (__u32*)&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()
439 pp_ptr = optptr; in ip_options_compile()
445 optptr += optlen; in ip_options_compile()
467 unsigned char * optptr = opt->__data+opt->srr-sizeof(struct iphdr); in ip_options_undo() local
468 memmove(optptr+7, optptr+3, optptr[1]-7); in ip_options_undo()
469 memcpy(optptr+3, &opt->faddr, 4); in ip_options_undo()
472 unsigned char * optptr = opt->__data+opt->rr-sizeof(struct iphdr); in ip_options_undo() local
473 optptr[2] -= 4; in ip_options_undo()
474 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
477 unsigned char * optptr = opt->__data+opt->ts-sizeof(struct iphdr); in ip_options_undo() local
479 optptr[2] -= 4; in ip_options_undo()
480 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
481 if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC) in ip_options_undo()
482 optptr[2] -= 4; in ip_options_undo()
485 optptr[2] -= 4; in ip_options_undo()
486 memset(&optptr[optptr[2]-1], 0, 4); in ip_options_undo()
526 unsigned char * optptr; in ip_forward_options() local
531 optptr = (unsigned char *)raw + opt->rr; in ip_forward_options()
532 ip_rt_get_source(&optptr[optptr[2]-5], rt); in ip_forward_options()
538 optptr = raw + opt->srr; in ip_forward_options()
540 for ( srrptr=optptr[2], srrspace = optptr[1]; in ip_forward_options()
546 if (memcmp(&rt->rt_dst, &optptr[srrptr-1], 4) == 0) in ip_forward_options()
551 ip_rt_get_source(&optptr[srrptr-1], rt); in ip_forward_options()
553 optptr[2] = srrptr+4; in ip_forward_options()
557 optptr = raw + opt->ts; in ip_forward_options()
558 ip_rt_get_source(&optptr[optptr[2]-9], rt); in ip_forward_options()
574 unsigned char * optptr = skb->nh.raw + opt->srr; in ip_options_rcv_srr() local
593 for (srrptr=optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) { in ip_options_rcv_srr()
598 memcpy(&nexthop, &optptr[srrptr-1], 4); in ip_options_rcv_srr()
613 memcpy(&iph->daddr, &optptr[srrptr-1], 4); in ip_options_rcv_srr()