mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
ping: fix compiling in dual-stack mode
This commit is contained in:
parent
9e2fb2806f
commit
5ec4c1d1f2
@ -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(arg);
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
LWIP_UNUSED_ARG(addr);
|
LWIP_UNUSED_ARG(addr);
|
||||||
|
LWIP_ASSERT("addr != NULL", addr != NULL);
|
||||||
LWIP_ASSERT("p != NULL", p != NULL);
|
LWIP_ASSERT("p != NULL", p != NULL);
|
||||||
|
|
||||||
if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) &&
|
if ((p->tot_len >= (IP_HLEN + sizeof(struct icmp_echo_hdr))) &&
|
||||||
pbuf_remove_header(p, PBUF_IP_HLEN) == 0) {
|
pbuf_remove_header(p, IP_HLEN) == 0) {
|
||||||
iecho = (struct icmp_echo_hdr *)p->payload;
|
iecho = (struct icmp_echo_hdr *)p->payload;
|
||||||
|
|
||||||
if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) {
|
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 */
|
return 1; /* eat the packet */
|
||||||
}
|
}
|
||||||
/* not eaten, restore original 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 */
|
return 0; /* don't eat the packet */
|
||||||
|
Loading…
Reference in New Issue
Block a user