Lines Matching refs:ip
94 register struct ip *ip;
101 ip = mtod(m, struct ip *);
102 Log2(("ip_dst=%RTnaipv4(len:%d) m_len = %d\n", ip->ip_dst, RT_N2H_U16(ip->ip_len), m->m_len));
116 if (m->m_len != RT_N2H_U16(ip->ip_len))
117 m->m_len = RT_N2H_U16(ip->ip_len);
122 if (mlen < sizeof(struct ip))
128 ip = mtod(m, struct ip *);
129 if (ip->ip_v != IPVERSION)
135 hlen = ip->ip_hl << 2;
136 if ( hlen < sizeof(struct ip)
144 /* keep ip header intact for ICMP reply
145 * ip->ip_sum = cksum(m, hlen);
146 * if (ip->ip_sum) {
157 NTOHS(ip->ip_len);
158 if (ip->ip_len < hlen)
164 NTOHS(ip->ip_id);
165 NTOHS(ip->ip_off);
173 if (mlen < ip->ip_len)
180 if (mlen > ip->ip_len)
181 m_adj(m, ip->ip_len - m->m_len);
184 if ((ip->ip_src.s_addr & RT_N2H_U32_C(0xe0000000)) == RT_N2H_U32_C(0xe0000000))
188 if (ip->ip_ttl==0 || ip->ip_ttl == 1)
195 ip->ip_ttl--;
202 if ( (ip->ip_dst.s_addr & RT_N2H_U32_C(0xe0000000)) == RT_N2H_U32_C(0xe0000000)
203 && ip->ip_dst.s_addr != 0xffffffff)
216 if (ip->ip_off & (IP_MF | IP_OFFMASK))
221 ip = mtod(m, struct ip *);
222 hlen = ip->ip_hl << 2;
225 ip->ip_len -= hlen;
231 switch (ip->ip_p)
250 ip->ip_dst, ip->ip_len));
262 struct ip *ip;
281 ip = mtod(m, struct ip *);
282 hlen = ip->ip_hl << 2;
284 hash = IPREASS_HASH(ip->ip_src.s_addr, ip->ip_id);
292 if (ip->ip_id == fp->ipq_id &&
293 ip->ip_src.s_addr == fp->ipq_src.s_addr &&
294 ip->ip_dst.s_addr == fp->ipq_dst.s_addr &&
295 ip->ip_p == fp->ipq_p)
337 ip->ip_len -= hlen;
338 if (ip->ip_off & IP_MF)
344 if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0)
353 ip->ip_off <<= 3;
382 fp->ipq_p = ip->ip_p;
383 fp->ipq_id = ip->ip_id;
384 fp->ipq_src = ip->ip_src;
385 fp->ipq_dst = ip->ip_dst;
395 #define GETIP(m) ((struct ip*)((m)->m_pkthdr.header))
401 if (GETIP(q)->ip_off > ip->ip_off)
415 i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off;
418 if (i >= ip->ip_len)
421 ip->ip_off += i;
422 ip->ip_len -= i;
437 for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off;
440 i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off;
494 ip = GETIP(q);
495 hlen = ip->ip_hl << 2;
517 ip = mtod(m, struct ip *); /*update ip pointer */
518 hlen = ip->ip_hl << 2;
526 * Create header for new ip packet by modifying header of first
531 ip->ip_len = next;
532 ip->ip_src = fp->ipq_src;
533 ip->ip_dst = fp->ipq_dst;
538 Assert((ip->ip_len == next));
637 struct ip *ip = mtod(m, struct ip *);
642 olen = (ip->ip_hl<<2) - sizeof(struct ip);
643 opts = (caddr_t)(ip + 1);
644 i = m->m_len - (sizeof(struct ip) + olen);
648 ip->ip_hl = sizeof(struct ip) >> 2;