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()
521 if (!M_WRITABLE(m) || M_LEADINGSPACE(m) < optlen) { in ip_insertoptions()
529 n->m_pkthdr.len += optlen; in ip_insertoptions()
534 m->m_len = optlen + sizeof(struct ip); in ip_insertoptions()
538 m->m_data -= optlen; in ip_insertoptions()
539 m->m_len += optlen; in ip_insertoptions()
540 m->m_pkthdr.len += optlen; in ip_insertoptions()
544 bcopy(p->ipopt_list, ip + 1, optlen); in ip_insertoptions()
545 *phlen = sizeof(struct ip) + optlen; in ip_insertoptions()
548 ip->ip_len = htons(ntohs(ip->ip_len) + optlen); in ip_insertoptions()
560 int opt, optlen, cnt; in ip_optcopy() local
565 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_optcopy()
572 optlen = 1; in ip_optcopy()
578 optlen = cp[IPOPT_OLEN]; in ip_optcopy()
579 KASSERT(optlen >= IPOPT_OLEN + sizeof(*cp) && optlen <= cnt, in ip_optcopy()
583 if (optlen > cnt) in ip_optcopy()
584 optlen = cnt; in ip_optcopy()
586 bcopy(cp, dp, optlen); in ip_optcopy()
587 dp += optlen; in ip_optcopy()
590 for (optlen = dp - (u_char *)(jp+1); optlen & 0x3; optlen++) in ip_optcopy()
592 return (optlen); in ip_optcopy()
603 int cnt, optlen; in ip_pcbopts() local
639 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_pcbopts()
644 optlen = 1; in ip_pcbopts()
648 optlen = cp[IPOPT_OLEN]; in ip_pcbopts()
649 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) in ip_pcbopts()
670 if (optlen < IPOPT_MINOFF - 1 + sizeof(struct in_addr)) in ip_pcbopts()
674 optlen -= sizeof(struct in_addr); in ip_pcbopts()
675 cp[IPOPT_OLEN] = optlen; in ip_pcbopts()
722 int opt, optlen, cnt, found_ra; in ip_checkrouteralert() local
727 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_checkrouteralert()
732 optlen = 1; in ip_checkrouteralert()
738 optlen = cp[IPOPT_OLEN]; in ip_checkrouteralert()
740 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) in ip_checkrouteralert()
747 if (optlen != IPOPT_OFFSET + sizeof(uint16_t) || in ip_checkrouteralert()