217 |
#if IP_DEBUG |
#if IP_DEBUG |
218 |
/* LWIP_DEBUGF("ip_input: \n"); |
/* LWIP_DEBUGF("ip_input: \n"); |
219 |
ip_debug_print(p); |
ip_debug_print(p); |
220 |
LWIP_DEBUGF("ip_input: p->len %u p->tot_len %u\n", p->len, p->tot_len);*/ |
LWIP_DEBUGF("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/ |
221 |
#endif /* IP_DEBUG */ |
#endif /* IP_DEBUG */ |
222 |
|
|
223 |
|
|
237 |
/* send ICMP destination protocol unreachable */ |
/* send ICMP destination protocol unreachable */ |
238 |
icmp_dest_unreach(p, ICMP_DUR_PROTO); |
icmp_dest_unreach(p, ICMP_DUR_PROTO); |
239 |
pbuf_free(p); |
pbuf_free(p); |
240 |
LWIP_DEBUGF(IP_DEBUG, ("Unsupported transport protocol %u\n", |
LWIP_DEBUGF(IP_DEBUG, ("Unsupported transport protocol %"U16_F"\n", |
241 |
iphdr->nexthdr)); |
iphdr->nexthdr)); |
242 |
|
|
243 |
#ifdef IP_STATS |
#ifdef IP_STATS |
266 |
|
|
267 |
PERF_START; |
PERF_START; |
268 |
|
|
269 |
printf("len %u tot_len %u\n", p->len, p->tot_len); |
printf("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len); |
270 |
if (pbuf_header(p, IP_HLEN)) { |
if (pbuf_header(p, IP_HLEN)) { |
271 |
LWIP_DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n")); |
LWIP_DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n")); |
272 |
#ifdef IP_STATS |
#ifdef IP_STATS |
275 |
|
|
276 |
return ERR_BUF; |
return ERR_BUF; |
277 |
} |
} |
278 |
printf("len %u tot_len %u\n", p->len, p->tot_len); |
printf("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len); |
279 |
|
|
280 |
iphdr = p->payload; |
iphdr = p->payload; |
281 |
|
|
303 |
++lwip_stats.ip.xmit; |
++lwip_stats.ip.xmit; |
304 |
#endif /* IP_STATS */ |
#endif /* IP_STATS */ |
305 |
|
|
306 |
LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c (len %u)\n", netif->name[0], netif->name[1], p->tot_len)); |
LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c (len %"U16_F")\n", netif->name[0], netif->name[1], p->tot_len)); |
307 |
#if IP_DEBUG |
#if IP_DEBUG |
308 |
ip_debug_print(p); |
ip_debug_print(p); |
309 |
#endif /* IP_DEBUG */ |
#endif /* IP_DEBUG */ |
324 |
{ |
{ |
325 |
struct netif *netif; |
struct netif *netif; |
326 |
if ((netif = ip_route(dest)) == NULL) { |
if ((netif = ip_route(dest)) == NULL) { |
327 |
LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%lx\n", dest->addr)); |
LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%"X32_F"\n", dest->addr)); |
328 |
#ifdef IP_STATS |
#ifdef IP_STATS |
329 |
++lwip_stats.ip.rterr; |
++lwip_stats.ip.rterr; |
330 |
#endif /* IP_STATS */ |
#endif /* IP_STATS */ |
339 |
ip_debug_print(struct pbuf *p) |
ip_debug_print(struct pbuf *p) |
340 |
{ |
{ |
341 |
struct ip_hdr *iphdr = p->payload; |
struct ip_hdr *iphdr = p->payload; |
342 |
char *payload; |
u8_t *payload; |
343 |
|
|
344 |
payload = (char *)iphdr + IP_HLEN; |
payload = (u8_t *)iphdr + IP_HLEN; |
345 |
|
|
346 |
LWIP_DEBUGF(IP_DEBUG, ("IP header:\n")); |
LWIP_DEBUGF(IP_DEBUG, ("IP header:\n")); |
347 |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
348 |
LWIP_DEBUGF(IP_DEBUG, ("|%2d | %x%x | %x%x | (v, traffic class, flow label)\n", |
LWIP_DEBUGF(IP_DEBUG, ("|%2"S16_F" | %"X16_F"%"X16_F" | %"X16_F"%"X16_F" | (v, traffic class, flow label)\n", |
349 |
iphdr->v, |
iphdr->v, |
350 |
iphdr->tclass1, iphdr->tclass2, |
iphdr->tclass1, iphdr->tclass2, |
351 |
iphdr->flow1, iphdr->flow2)); |
iphdr->flow1, iphdr->flow2)); |
352 |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
353 |
LWIP_DEBUGF(IP_DEBUG, ("| %5u | %2u | %2u | (len, nexthdr, hoplim)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %5"U16_F" | %2"U16_F" | %2"U16_F" | (len, nexthdr, hoplim)\n", |
354 |
ntohs(iphdr->len), |
ntohs(iphdr->len), |
355 |
iphdr->nexthdr, |
iphdr->nexthdr, |
356 |
iphdr->hoplim)); |
iphdr->hoplim)); |
357 |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
358 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", |
359 |
ntohl(iphdr->src.addr[0]) >> 16 & 0xffff, |
ntohl(iphdr->src.addr[0]) >> 16 & 0xffff, |
360 |
ntohl(iphdr->src.addr[0]) & 0xffff)); |
ntohl(iphdr->src.addr[0]) & 0xffff)); |
361 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", |
362 |
ntohl(iphdr->src.addr[1]) >> 16 & 0xffff, |
ntohl(iphdr->src.addr[1]) >> 16 & 0xffff, |
363 |
ntohl(iphdr->src.addr[1]) & 0xffff)); |
ntohl(iphdr->src.addr[1]) & 0xffff)); |
364 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", |
365 |
ntohl(iphdr->src.addr[2]) >> 16 & 0xffff, |
ntohl(iphdr->src.addr[2]) >> 16 & 0xffff, |
366 |
ntohl(iphdr->src.addr[2]) & 0xffff)); |
ntohl(iphdr->src.addr[2]) & 0xffff)); |
367 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", |
368 |
ntohl(iphdr->src.addr[3]) >> 16 & 0xffff, |
ntohl(iphdr->src.addr[3]) >> 16 & 0xffff, |
369 |
ntohl(iphdr->src.addr[3]) & 0xffff)); |
ntohl(iphdr->src.addr[3]) & 0xffff)); |
370 |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
371 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", |
372 |
ntohl(iphdr->dest.addr[0]) >> 16 & 0xffff, |
ntohl(iphdr->dest.addr[0]) >> 16 & 0xffff, |
373 |
ntohl(iphdr->dest.addr[0]) & 0xffff)); |
ntohl(iphdr->dest.addr[0]) & 0xffff)); |
374 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", |
375 |
ntohl(iphdr->dest.addr[1]) >> 16 & 0xffff, |
ntohl(iphdr->dest.addr[1]) >> 16 & 0xffff, |
376 |
ntohl(iphdr->dest.addr[1]) & 0xffff)); |
ntohl(iphdr->dest.addr[1]) & 0xffff)); |
377 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", |
378 |
ntohl(iphdr->dest.addr[2]) >> 16 & 0xffff, |
ntohl(iphdr->dest.addr[2]) >> 16 & 0xffff, |
379 |
ntohl(iphdr->dest.addr[2]) & 0xffff)); |
ntohl(iphdr->dest.addr[2]) & 0xffff)); |
380 |
LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", |
LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", |
381 |
ntohl(iphdr->dest.addr[3]) >> 16 & 0xffff, |
ntohl(iphdr->dest.addr[3]) >> 16 & 0xffff, |
382 |
ntohl(iphdr->dest.addr[3]) & 0xffff)); |
ntohl(iphdr->dest.addr[3]) & 0xffff)); |
383 |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); |