Lines Matching refs:optlen
106 int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; in ip_dooptions() local
126 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_dooptions()
131 optlen = 1; in ip_dooptions()
137 optlen = cp[IPOPT_OLEN]; in ip_dooptions()
138 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) { in ip_dooptions()
161 if (optlen < IPOPT_OFFSET + sizeof(*cp)) { in ip_dooptions()
186 if (off > optlen - (int)sizeof(struct in_addr)) { in ip_dooptions()
277 if (optlen < IPOPT_OFFSET + sizeof(*cp)) { in ip_dooptions()
289 if (off > optlen - (int)sizeof(struct in_addr)) in ip_dooptions()
319 if (optlen < 4 || optlen > 40) { in ip_dooptions()
327 if (off > optlen - (int)sizeof(int32_t)) { in ip_dooptions()
343 sizeof(struct in_addr) > optlen) { in ip_dooptions()
360 sizeof(struct in_addr) > optlen) { in ip_dooptions()
510 unsigned optlen; in ip_insertoptions() local
512 optlen = opt->m_len - sizeof(p->ipopt_dst); in ip_insertoptions()
513 if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { in ip_insertoptions()
519 if (!M_WRITABLE(m) || M_LEADINGSPACE(m) < optlen) { in ip_insertoptions()
527 n->m_pkthdr.len += optlen; in ip_insertoptions()
532 m->m_len = optlen + sizeof(struct ip); in ip_insertoptions()
536 m->m_data -= optlen; in ip_insertoptions()
537 m->m_len += optlen; in ip_insertoptions()
538 m->m_pkthdr.len += optlen; in ip_insertoptions()
542 bcopy(p->ipopt_list, ip + 1, optlen); in ip_insertoptions()
543 *phlen = sizeof(struct ip) + optlen; in ip_insertoptions()
546 ip->ip_len = htons(ntohs(ip->ip_len) + optlen); in ip_insertoptions()
558 int opt, optlen, cnt; in ip_optcopy() local
563 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_optcopy()
570 optlen = 1; in ip_optcopy()
576 optlen = cp[IPOPT_OLEN]; in ip_optcopy()
577 KASSERT(optlen >= IPOPT_OLEN + sizeof(*cp) && optlen <= cnt, in ip_optcopy()
581 if (optlen > cnt) in ip_optcopy()
582 optlen = cnt; in ip_optcopy()
584 bcopy(cp, dp, optlen); in ip_optcopy()
585 dp += optlen; in ip_optcopy()
588 for (optlen = dp - (u_char *)(jp+1); optlen & 0x3; optlen++) in ip_optcopy()
590 return (optlen); in ip_optcopy()
601 int cnt, optlen; in ip_pcbopts() local
637 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_pcbopts()
642 optlen = 1; in ip_pcbopts()
646 optlen = cp[IPOPT_OLEN]; in ip_pcbopts()
647 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) in ip_pcbopts()
668 if (optlen < IPOPT_MINOFF - 1 + sizeof(struct in_addr)) in ip_pcbopts()
672 optlen -= sizeof(struct in_addr); in ip_pcbopts()
673 cp[IPOPT_OLEN] = optlen; in ip_pcbopts()
720 int opt, optlen, cnt, found_ra; in ip_checkrouteralert() local
725 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_checkrouteralert()
730 optlen = 1; in ip_checkrouteralert()
736 optlen = cp[IPOPT_OLEN]; in ip_checkrouteralert()
738 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) in ip_checkrouteralert()
745 if (optlen != IPOPT_OFFSET + sizeof(uint16_t) || in ip_checkrouteralert()