Lines Matching defs:ip
88 #include <netinet/ip.h>
190 * in response to bad packet ip.
200 struct ip *oip = mtod(n, struct ip *), *nip;
250 if (icmplen < sizeof(struct ip)) {
291 * Now, copy old ip header (without options)
294 if (m->m_data - sizeof(struct ip) < m->m_pktdat)
296 m->m_data -= sizeof(struct ip);
297 m->m_len += sizeof(struct ip);
300 nip = mtod(m, struct ip *);
301 bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip));
326 struct ip *ip = mtod(m, struct ip *);
336 icmplen = ip->ip_len;
348 inet_ntop(AF_INET, &ip->ip_src, buf, sizeof(buf)),
349 inet_ntop(AF_INET, &ip->ip_dst, ipv4str, sizeof(ipv4str)),
362 ip = mtod(m, struct ip *);
448 IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) {
527 switch (ip->ip_dst.s_addr) {
531 icmpdst.sin_addr = ip->ip_src;
535 icmpdst.sin_addr = ip->ip_dst;
550 if (ip->ip_src.s_addr == 0) {
552 ip->ip_src = satosin(&ia->ia_broadaddr)->sin_addr;
554 ip->ip_src = satosin(&ia->ia_dstaddr)->sin_addr;
559 ip->ip_len += hlen; /* since ip_input deducts this */
569 src = ntohl(ip->ip_src.s_addr);
586 IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) {
597 icmpgw.sin_addr = ip->ip_src;
642 * Reflect the ip packet back to the source
647 struct ip *ip = mtod(m, struct ip *);
651 int optlen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof(struct ip);
653 if (!in_canforward(ip->ip_src) &&
654 ((ntohl(ip->ip_src.s_addr) & IN_CLASSA_NET) !=
659 t = ip->ip_dst;
660 ip->ip_dst = ip->ip_src;
719 ip->ip_src = t;
720 ip->ip_ttl = ip_defttl;
733 cp = (u_char *) (ip + 1);
787 ip->ip_len -= optlen;
788 ip->ip_vhl = IP_VHL_BORING;
792 optlen += sizeof(struct ip);
793 bcopy((caddr_t)ip + optlen, (caddr_t)(ip + 1),
794 (unsigned)(m->m_len - sizeof(struct ip)));
804 * Send an icmp packet back to the ip level,
810 struct ip *ip = mtod(m, struct ip *);
822 hlen = IP_VHL_HL(ip->ip_vhl) << 2;
827 icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen);
839 inet_ntop(AF_INET, &ip->ip_dst, buf, sizeof(buf)),
840 inet_ntop(AF_INET, &ip->ip_src, ipv4str, sizeof(ipv4str)));
1088 struct ip *ip;
1101 ip = mtod(m, struct ip *);
1103 hlen = IP_VHL_HL(ip->ip_vhl) << 2;
1109 if (IP_VHL_V(ip->ip_vhl) != 4)
1111 if (hlen < 20 || hlen > 40 || ip->ip_len != m->m_pkthdr.len)
1114 if ((ip->ip_off & ~IP_DF) != 0)
1117 if (ip->ip_p != IPPROTO_ICMP)
1120 if (ip->ip_src.s_addr != INADDR_ANY) {
1128 TAILQ_FOREACH(ia, INADDR_HASH(ip->ip_src.s_addr),
1132 ip->ip_src.s_addr) {
1146 ip->ip_sum = 0;