Lines Matching refs:ip
120 register struct ip *ip;
122 register int hlen = sizeof(struct ip);
146 ip = mtod(m, struct ip *);
147 LogFunc(("ip(src:%RTnaipv4, dst:%RTnaipv4)\n", ip->ip_src, ip->ip_dst));
151 ip->ip_v = IPVERSION;
152 ip->ip_off &= IP_DF;
153 ip->ip_id = RT_H2N_U16(ip_currid++);
154 ip->ip_hl = hlen >> 2;
160 rc = rt_lookup_in_cache(pData, ip->ip_dst.s_addr, eth_dst);
168 if ((u_int16_t)ip->ip_len <= if_mtu)
170 ip->ip_len = RT_H2N_U16((u_int16_t)ip->ip_len);
171 ip->ip_off = RT_H2N_U16((u_int16_t)ip->ip_off);
172 ip->ip_sum = 0;
173 ip->ip_sum = cksum(m, hlen);
191 LogFlowFunc(("ip(ip_src:%RTnaipv4, ip_dst:%RTnaipv4)\n",
192 ip->ip_src, ip->ip_dst));
201 if (ip->ip_off & IP_DF)
208 len = (if_mtu - hlen) &~ 7; /* ip databytes per packet */
224 mhlen = ip->ip_hl << 2;
225 Log(("NAT:ip:frag: mhlen = %d\n", mhlen));
226 for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len)
228 register struct ip *mhip;
237 mhip = mtod(m, struct ip *);
238 *mhip = *ip;
242 if (hlen > sizeof (struct ip))
244 mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip);
249 mhip->ip_off = ((off - mhlen) >> 3) + (ip->ip_off & ~IP_MF);
250 if (ip->ip_off & IP_MF)
252 if (off + len >= (u_int16_t)ip->ip_len)
253 len = (u_int16_t)ip->ip_len - off;
259 Log(("NAT:ip:frag: alloc = %d\n", len));
261 Log(("NAT:ip:frag: m_copydata(m0 = %p,off = %d, len = %d,)\n", m0, off, len));
266 Log(("NAT:ip:frag: m_copyback(m = %p,, len = %d,)\n", m, len));
286 m_adj(m, mhlen + firstlen - (u_int16_t)ip->ip_len);
287 Log(("NAT:ip:frag: m_adj(m(m_len:%d) = %p, len = %d)\n", m->m_len, m, mhlen + firstlen - (u_int16_t)ip->ip_len));
288 ip->ip_len = RT_H2N_U16((u_int16_t)mhlen + firstlen);
289 ip->ip_off = RT_H2N_U16((u_int16_t)(ip->ip_off | IP_MF));
290 ip->ip_sum = 0;
291 ip->ip_sum = cksum(m, mhlen);
328 Log(("NAT:ip:frag: if_encap(,,m(m_len = %d) = %p,0)\n", m->m_len, m));