Home | History | Annotate | Download | only in slirp

Lines Matching defs:ip

74   register struct ip *ip=mtod(m, struct ip *);
75 int icmplen=ip->ip_len;
112 ip->ip_len += hlen; /* since ip_input subtracts this */
113 if (ip->ip_dst.s_addr == alias_addr.s_addr) {
127 so->so_faddr = ip->ip_dst;
129 so->so_laddr = ip->ip_src;
131 so->so_iptos = ip->ip_tos;
159 } /* if ip->ip_dst.s_addr == alias_addr.s_addr */
187 * RFC 1122: 3.2.2 MUST send at least the IP header and 8 bytes of header. MAY send more (we do).
189 * MUST NOT reply to a multicast/broadcast IP address.
196 * It is reported as the bad ip packet. The header should
199 * packet. The maximum payload is 576-20(ip hdr)-8(icmp hdr)=548
208 register struct ip *ip;
220 ip = mtod(msrc, struct ip *);
223 strcpy(bufa, inet_ntoa(ip->ip_src));
224 strcpy(bufb, inet_ntoa(ip->ip_dst));
228 if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */
230 shlen=ip->ip_hl << 2;
231 s_ip_len=ip->ip_len;
232 if(ip->ip_p == IPPROTO_ICMP) {
233 icp = (struct icmp *)((char *)ip + shlen);
244 new_m_size=sizeof(struct ip )+ICMP_MINLEN+msrc->m_len+ICMP_MAXDATALEN;
251 ip = mtod(m, struct ip *);
252 hlen= sizeof(struct ip ); /* no options in reply */
266 /* min. size = 8+sizeof(struct ip)+8 */
273 memcpy(&icp->icmp_ip, msrc->m_data, s_ip_len); /* report the ip packet */
296 /* fill in ip */
297 ip->ip_hl = hlen >> 2;
298 ip->ip_len = m->m_len;
300 ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0); /* high priority for errors */
302 ip->ip_ttl = MAXTTL;
303 ip->ip_p = IPPROTO_ICMP;
304 ip->ip_dst = ip->ip_src; /* ip adresses */
305 ip->ip_src = alias_addr;
317 * Reflect the ip packet back to the source
322 register struct ip *ip = mtod(m, struct ip *);
323 int hlen = ip->ip_hl << 2;
324 int optlen = hlen - sizeof(struct ip );
328 * Send an icmp packet back to the ip level,
336 icp->icmp_cksum = cksum(m, ip->ip_len - hlen);
341 /* fill in ip */
345 * mbuf's data back, and adjust the IP length.
347 memmove((caddr_t)(ip + 1), (caddr_t)ip + hlen,
350 ip->ip_hl = hlen >> 2;
351 ip->ip_len -= optlen;
355 ip->ip_ttl = MAXTTL;
358 icmp_dst = ip->ip_dst;
359 ip->ip_dst = ip->ip_src;
360 ip->ip_src = icmp_dst;