Lines Matching refs:ip
105 struct ip *ip = mtod(m, struct ip *); in ip_dooptions() local
125 dst = ip->ip_dst; in ip_dooptions()
126 cp = (u_char *)(ip + 1); in ip_dooptions()
127 cnt = (ip->ip_hl << 2) - sizeof (struct ip); in ip_dooptions()
136 code = &cp[IPOPT_OLEN] - (u_char *)ip; in ip_dooptions()
141 code = &cp[IPOPT_OLEN] - (u_char *)ip; in ip_dooptions()
164 code = &cp[IPOPT_OLEN] - (u_char *)ip; in ip_dooptions()
168 code = &cp[IPOPT_OFFSET] - (u_char *)ip; in ip_dooptions()
171 ipaddr.sin_addr = ip->ip_dst; in ip_dooptions()
194 save_rte(m, cp, ip->ip_src); in ip_dooptions()
214 inet_ntoa_r(ip->ip_src, srcbuf), in ip_dooptions()
215 inet_ntoa_r(ip->ip_dst, dstbuf)); in ip_dooptions()
266 ip->ip_dst = ipaddr.sin_addr; in ip_dooptions()
271 forward = !IN_MULTICAST(ntohl(ip->ip_dst.s_addr)); in ip_dooptions()
280 code = &cp[IPOPT_OFFSET] - (u_char *)ip; in ip_dooptions()
284 code = &cp[IPOPT_OFFSET] - (u_char *)ip; in ip_dooptions()
293 (void)memcpy(&ipaddr.sin_addr, &ip->ip_dst, in ip_dooptions()
320 code = cp - (u_char *)ip; in ip_dooptions()
322 code = &cp[IPOPT_OLEN] - (u_char *)ip; in ip_dooptions()
326 code = &cp[IPOPT_OLEN] - (u_char *)ip; in ip_dooptions()
332 code = &cp[IPOPT_OFFSET] - (u_char *)ip; in ip_dooptions()
346 code = &cp[IPOPT_OFFSET] - (u_char *)ip; in ip_dooptions()
363 code = &cp[IPOPT_OFFSET] - (u_char *)ip; in ip_dooptions()
375 code = &cp[IPOPT_OFFSET + 1] - (u_char *)ip; in ip_dooptions()
485 struct ip *ip = mtod(m, struct ip *); in ip_stripoptions() local
488 olen = (ip->ip_hl << 2) - sizeof(struct ip); in ip_stripoptions()
492 ip->ip_len = htons(ntohs(ip->ip_len) - olen); in ip_stripoptions()
493 ip->ip_hl = sizeof(struct ip) >> 2; in ip_stripoptions()
495 bcopy((char *)ip + sizeof(struct ip) + olen, (ip + 1), in ip_stripoptions()
496 (size_t )(m->m_len - sizeof(struct ip))); in ip_stripoptions()
511 struct ip *ip = mtod(m, struct ip *); in ip_insertoptions() local
515 if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { in ip_insertoptions()
520 ip->ip_dst = p->ipopt_dst; in ip_insertoptions()
530 m->m_len -= sizeof(struct ip); in ip_insertoptions()
531 m->m_data += sizeof(struct ip); in ip_insertoptions()
534 m->m_len = optlen + sizeof(struct ip); in ip_insertoptions()
536 bcopy(ip, mtod(m, void *), sizeof(struct ip)); in ip_insertoptions()
541 bcopy(ip, mtod(m, void *), sizeof(struct ip)); in ip_insertoptions()
543 ip = mtod(m, struct ip *); in ip_insertoptions()
544 bcopy(p->ipopt_list, ip + 1, optlen); in ip_insertoptions()
545 *phlen = sizeof(struct ip) + optlen; in ip_insertoptions()
546 ip->ip_v = IPVERSION; in ip_insertoptions()
547 ip->ip_hl = *phlen >> 2; in ip_insertoptions()
548 ip->ip_len = htons(ntohs(ip->ip_len) + optlen); in ip_insertoptions()
557 ip_optcopy(struct ip *ip, struct ip *jp) in ip_optcopy() argument
562 cp = (u_char *)(ip + 1); in ip_optcopy()
564 cnt = (ip->ip_hl << 2) - sizeof (struct ip); in ip_optcopy()
720 struct ip *ip = mtod(m, struct ip *); in ip_checkrouteralert() local
725 cp = (u_char *)(ip + 1); in ip_checkrouteralert()
726 cnt = (ip->ip_hl << 2) - sizeof (struct ip); in ip_checkrouteralert()