Revision 3b46e624 slirp/ip_icmp.c
b/slirp/ip_icmp.c | ||
---|---|---|
105 | 105 |
} |
106 | 106 |
m->m_len += hlen; |
107 | 107 |
m->m_data -= hlen; |
108 |
|
|
108 |
|
|
109 | 109 |
/* icmpstat.icps_inhist[icp->icmp_type]++; */ |
110 | 110 |
/* code = icp->icmp_code; */ |
111 | 111 |
|
... | ... | |
135 | 135 |
so->so_iptos = ip->ip_tos; |
136 | 136 |
so->so_type = IPPROTO_ICMP; |
137 | 137 |
so->so_state = SS_ISFCONNECTED; |
138 |
|
|
138 |
|
|
139 | 139 |
/* Send the packet */ |
140 | 140 |
addr.sin_family = AF_INET; |
141 | 141 |
if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) { |
... | ... | |
173 | 173 |
icmpstat.icps_notsupp++; |
174 | 174 |
m_freem(m); |
175 | 175 |
break; |
176 |
|
|
176 |
|
|
177 | 177 |
default: |
178 | 178 |
icmpstat.icps_badtype++; |
179 | 179 |
m_freem(m); |
... | ... | |
226 | 226 |
/* check msrc */ |
227 | 227 |
if(!msrc) goto end_error; |
228 | 228 |
ip = mtod(msrc, struct ip *); |
229 |
#if DEBUG
|
|
229 |
#if DEBUG |
|
230 | 230 |
{ char bufa[20], bufb[20]; |
231 | 231 |
strcpy(bufa, inet_ntoa(ip->ip_src)); |
232 | 232 |
strcpy(bufb, inet_ntoa(ip->ip_dst)); |
... | ... | |
258 | 258 |
/* make the header of the reply packet */ |
259 | 259 |
ip = mtod(m, struct ip *); |
260 | 260 |
hlen= sizeof(struct ip ); /* no options in reply */ |
261 |
|
|
261 |
|
|
262 | 262 |
/* fill in icmp */ |
263 |
m->m_data += hlen;
|
|
263 |
m->m_data += hlen; |
|
264 | 264 |
m->m_len -= hlen; |
265 | 265 |
|
266 | 266 |
icp = mtod(m, struct icmp *); |
... | ... | |
269 | 269 |
else if(s_ip_len>ICMP_MAXDATALEN) /* maximum size */ |
270 | 270 |
s_ip_len=ICMP_MAXDATALEN; |
271 | 271 |
|
272 |
m->m_len=ICMP_MINLEN+s_ip_len; /* 8 bytes ICMP header */
|
|
272 |
m->m_len=ICMP_MINLEN+s_ip_len; /* 8 bytes ICMP header */ |
|
273 | 273 |
|
274 | 274 |
/* min. size = 8+sizeof(struct ip)+8 */ |
275 | 275 |
|
... | ... | |
304 | 304 |
/* fill in ip */ |
305 | 305 |
ip->ip_hl = hlen >> 2; |
306 | 306 |
ip->ip_len = m->m_len; |
307 |
|
|
307 |
|
|
308 | 308 |
ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0); /* high priority for errors */ |
309 | 309 |
|
310 | 310 |
ip->ip_ttl = MAXTTL; |
... | ... | |
313 | 313 |
ip->ip_src = alias_addr; |
314 | 314 |
|
315 | 315 |
(void ) ip_output((struct socket *)NULL, m); |
316 |
|
|
316 |
|
|
317 | 317 |
icmpstat.icps_reflect++; |
318 | 318 |
|
319 | 319 |
end_error: |
Also available in: Unified diff