Lines Matching defs:ip
82 /* m->m_data points at ip packet header
83 * m->m_len length ip packet
84 * ip->ip_len length data (IPDU)
89 register struct ip *ip;
92 struct ip save_ip;
98 ip = mtod(m, struct ip *);
99 Log2(("%RTnaipv4 iphlen = %d\n", ip->ip_dst, iphlen));
109 if (iphlen > sizeof(struct ip))
112 iphlen = sizeof(struct ip);
118 ip = mtod(m, struct ip *);
119 uh = (struct udphdr *)((caddr_t)ip + iphlen);
126 Assert((ip->ip_len + iphlen == m_length(m, NULL)));
128 if (ip->ip_len != len)
130 if (len > ip->ip_len)
133 Log3(("NAT: IP(id: %hd) has bad size\n", ip->ip_id));
136 m_adj(m, len - ip->ip_len);
137 ip->ip_len = len;
144 save_ip = *ip;
152 memset(((struct ipovly *)ip)->ih_x1, 0, 9);
153 ((struct ipovly *)ip)->ih_len = uh->uh_ulen;
156 uh->uh_sum = cksum(m, len + sizeof (struct ip));
164 Log3(("NAT: IP(id: %hd) has bad (udp) cksum\n", ip->ip_id));
181 LogFunc(("uh src: %RTnaipv4:%d, dst: %RTnaipv4:%d\n", ip->ip_src, RT_H2N_U16_C(uh->uh_sport), ip->ip_dst, RT_H2N_U16_C(uh->uh_dport)));
184 && CTL_CHECK(ip->ip_dst.s_addr, CTL_DNS))
187 src.sin_addr.s_addr = ip->ip_dst.s_addr;
189 dst.sin_addr.s_addr = ip->ip_src.s_addr;
204 && CTL_CHECK(ip->ip_dst.s_addr, CTL_TFTP))
216 && CTL_CHECK(ip->ip_dst.s_addr, CTL_DNS)
228 || so->so_laddr.s_addr != ip->ip_src.s_addr)
235 && tmp->so_laddr.s_addr == ip->ip_src.s_addr)
259 Log2(("NAT: IP(id: %hd) failed to create socket\n", ip->ip_id));
265 ip->ip_id, errno, strerror(errno)));
274 so->so_laddr = ip->ip_src;
277 so->so_iptos = ip->ip_tos;
285 so->so_faddr = ip->ip_dst; /* XXX */
293 && CTL_CHECK(ip->ip_dst.s_addr, CTL_DNS)
304 ttl = ip->ip_ttl = save_ip.ip_ttl;
357 *ip = save_ip;
359 errno, strerror(errno), ip->ip_dst));
372 *ip = save_ip;
379 ip->ip_id, &ip->ip_dst, ip->ip_len));
424 ui->ui_len = RT_H2N_U16(mlen - sizeof(struct ip));
441 ((struct ip *)ui)->ip_len = mlen;
442 ((struct ip *)ui)->ip_ttl = ip_defttl;
443 ((struct ip *)ui)->ip_tos = iptos;