Эх сурвалжийг харах

ping: fix compiling in dual-stack mode

Simon Goldschmidt 2 жил өмнө
parent
commit
5ec4c1d1f2

+ 4 - 3
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 */