Lines Matching refs:optlen
107 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()
162 if (optlen < IPOPT_OFFSET + sizeof(*cp)) { in ip_dooptions()
187 if (off > optlen - (int)sizeof(struct in_addr)) { in ip_dooptions()
278 if (optlen < IPOPT_OFFSET + sizeof(*cp)) { in ip_dooptions()
290 if (off > optlen - (int)sizeof(struct in_addr)) in ip_dooptions()
320 if (optlen < 4 || optlen > 40) { in ip_dooptions()
328 if (off > optlen - (int)sizeof(int32_t)) { in ip_dooptions()
345 sizeof(struct in_addr) > optlen) { in ip_dooptions()
362 sizeof(struct in_addr) > optlen) { in ip_dooptions()
515 unsigned optlen; in ip_insertoptions() local
517 optlen = opt->m_len - sizeof(p->ipopt_dst); in ip_insertoptions()
518 if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { in ip_insertoptions()
524 if (!M_WRITABLE(m) || M_LEADINGSPACE(m) < optlen) { in ip_insertoptions()
532 n->m_pkthdr.len += optlen; in ip_insertoptions()
537 m->m_len = optlen + sizeof(struct ip); in ip_insertoptions()
541 m->m_data -= optlen; in ip_insertoptions()
542 m->m_len += optlen; in ip_insertoptions()
543 m->m_pkthdr.len += optlen; in ip_insertoptions()
547 bcopy(p->ipopt_list, ip + 1, optlen); in ip_insertoptions()
548 *phlen = sizeof(struct ip) + optlen; in ip_insertoptions()
551 ip->ip_len = htons(ntohs(ip->ip_len) + optlen); in ip_insertoptions()
563 int opt, optlen, cnt; in ip_optcopy() local
568 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_optcopy()
575 optlen = 1; in ip_optcopy()
581 optlen = cp[IPOPT_OLEN]; in ip_optcopy()
582 KASSERT(optlen >= IPOPT_OLEN + sizeof(*cp) && optlen <= cnt, in ip_optcopy()
586 if (optlen > cnt) in ip_optcopy()
587 optlen = cnt; in ip_optcopy()
589 bcopy(cp, dp, optlen); in ip_optcopy()
590 dp += optlen; in ip_optcopy()
593 for (optlen = dp - (u_char *)(jp+1); optlen & 0x3; optlen++) in ip_optcopy()
595 return (optlen); in ip_optcopy()
606 int cnt, optlen; in ip_pcbopts() local
642 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_pcbopts()
647 optlen = 1; in ip_pcbopts()
651 optlen = cp[IPOPT_OLEN]; in ip_pcbopts()
652 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) in ip_pcbopts()
674 if (optlen < IPOPT_MINOFF - 1 + sizeof(struct in_addr)) in ip_pcbopts()
678 optlen -= sizeof(struct in_addr); in ip_pcbopts()
679 cp[IPOPT_OLEN] = optlen; in ip_pcbopts()
726 int opt, optlen, cnt, found_ra; in ip_checkrouteralert() local
731 for (; cnt > 0; cnt -= optlen, cp += optlen) { in ip_checkrouteralert()
736 optlen = 1; in ip_checkrouteralert()
742 optlen = cp[IPOPT_OLEN]; in ip_checkrouteralert()
744 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) in ip_checkrouteralert()
751 if (optlen != IPOPT_OFFSET + sizeof(uint16_t) || in ip_checkrouteralert()