Lines Matching defs:ip
77 /* m->m_data points at ip packet header
78 * m->m_len length ip packet
79 * ip->ip_len length data (IPDU)
84 register struct ip *ip;
88 struct ip save_ip;
98 * Strip IP options, if any; should skip this,
103 if(iphlen > sizeof(struct ip)) {
105 iphlen = sizeof(struct ip);
109 * Get IP and UDP header together in first mbuf.
111 ip = mtod(m, struct ip *);
112 uh = (struct udphdr *)((caddr_t)ip + iphlen);
120 if (ip->ip_len != len) {
121 if (len > ip->ip_len) {
125 m_adj(m, len - ip->ip_len);
126 ip->ip_len = len;
134 if (slirp_should_drop(ntohl(ip->ip_dst.addr), ntohs(uh->uh_dport.port),
138 ntohl(ip->ip_src.addr),
140 ntohl(ip->ip_dst.addr),
149 ntohl(ip->ip_src.addr),
151 ntohl(ip->ip_dst.addr),
161 * Save a copy of the IP header in case we want restore it
164 save_ip = *ip;
171 memset(&((struct ipovly *)ip)->ih_mbuf, 0, sizeof(struct mbuf_ptr));
172 ((struct ipovly *)ip)->ih_x1 = 0;
173 ((struct ipovly *)ip)->ih_len = uh->uh_ulen;
175 * uh->uh_sum = cksum(m, len + sizeof (struct ip));
178 if(cksum(m, len + sizeof(struct ip))) {
220 so->so_laddr_ip != ip_geth(ip->ip_src)) {
225 tmp->so_laddr_ip == ip_geth(ip->ip_src)) {
226 tmp->so_faddr_ip = ip_geth(ip->ip_dst);
257 so->so_laddr_ip = ip_geth(ip->ip_src);
261 so->so_iptos = ip->ip_tos;
269 so->so_faddr_ip = ip_geth(ip->ip_dst); /* XXX */
285 *ip=save_ip;
295 *ip=save_ip;
337 ui->ui_len = htons(m->m_len - sizeof(struct ip)); /* + sizeof (struct udphdr)); */
353 ((struct ip *)ui)->ip_len = m->m_len;
355 ((struct ip *)ui)->ip_ttl = IPDEFTTL;
356 ((struct ip *)ui)->ip_tos = iptos;