mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 09:19:53 +00:00
ICMP: Fix responses were always sent to default netif because of uninitialized source IP (found by Coverity)
This commit is contained in:
parent
11b810721a
commit
1c1587eef6
@ -359,6 +359,7 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
|
||||
SMEMCPY((u8_t *)q->payload + sizeof(struct icmp_echo_hdr), (u8_t *)p->payload,
|
||||
IP_HLEN + ICMP_DEST_UNREACH_DATASIZE);
|
||||
|
||||
ip4_addr_copy(iphdr_src, iphdr->src);
|
||||
netif = ip4_route(&iphdr_src);
|
||||
if (netif != NULL) {
|
||||
/* calculate checksum */
|
||||
@ -369,7 +370,6 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
|
||||
}
|
||||
#endif
|
||||
ICMP_STATS_INC(icmp.xmit);
|
||||
ip4_addr_copy(iphdr_src, iphdr->src);
|
||||
ip4_output_if(q, NULL, &iphdr_src, ICMP_TTL, 0, IP_PROTO_ICMP, netif);
|
||||
}
|
||||
pbuf_free(q);
|
||||
|
Loading…
Reference in New Issue
Block a user