From 5ec4c1d1f2d5a942dc449307089796692e9def28 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Tue, 10 Oct 2023 20:15:49 +0200 Subject: [PATCH] ping: fix compiling in dual-stack mode --- contrib/apps/ping/ping.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/apps/ping/ping.c b/contrib/apps/ping/ping.c index a4995492..ceb97396 100644 --- a/contrib/apps/ping/ping.c +++ b/contrib/apps/ping/ping.c @@ -298,10 +298,11 @@ ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr) LWIP_UNUSED_ARG(arg); LWIP_UNUSED_ARG(pcb); LWIP_UNUSED_ARG(addr); + LWIP_ASSERT("addr != NULL", addr != NULL); LWIP_ASSERT("p != NULL", p != NULL); - if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) && - pbuf_remove_header(p, PBUF_IP_HLEN) == 0) { + if ((p->tot_len >= (IP_HLEN + sizeof(struct icmp_echo_hdr))) && + pbuf_remove_header(p, IP_HLEN) == 0) { iecho = (struct icmp_echo_hdr *)p->payload; if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) { @@ -315,7 +316,7 @@ ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr) return 1; /* eat the packet */ } /* not eaten, restore original packet */ - pbuf_add_header(p, PBUF_IP_HLEN); + pbuf_add_header(p, IP_HLEN); } return 0; /* don't eat the packet */