bug #34846: time-exceeded was sometimes not sent to original fragment

source, but to the sender of a packet fragment that triggered a buffer
purge.

Change-Id: I4bf20747bd900150491852649918a85cb7bf2aad
This commit is contained in:
Ivan Delamer 2011-11-29 12:49:43 -07:00
parent 85f8a59d7f
commit ce6fb83ef4

View File

@ -283,14 +283,11 @@ icmp6_send_response(struct pbuf *p, u8_t code, u32_t data, u8_t type)
IP6_HLEN + LWIP_ICMP6_DATASIZE); IP6_HLEN + LWIP_ICMP6_DATASIZE);
/* Get the destination address and netif for this ICMP message. */ /* Get the destination address and netif for this ICMP message. */
if (ip_current_netif() != NULL) { if ((ip_current_netif() == NULL) ||
netif = ip_current_netif(); ((code == ICMP6_TE_FRAG) && (type == ICMP6_TYPE_TE))) {
reply_dest = ip6_current_src_addr(); /* Special case, as ip6_current_xxx is either NULL, or points
} * to a different packet than the one that expired.
else { * We must use the addresses that are stored in the expired packet. */
/* We are not being called from input context, so we must determine
* addresses from the packet in question. reply_src is temporarily
* set to try and find the original netif where packet was accepted. */
ip6hdr = (struct ip6_hdr *)p->payload; ip6hdr = (struct ip6_hdr *)p->payload;
/* copy from packed address to aligned address */ /* copy from packed address to aligned address */
ip6_addr_copy(reply_dest_local, ip6hdr->src); ip6_addr_copy(reply_dest_local, ip6hdr->src);
@ -305,14 +302,18 @@ icmp6_send_response(struct pbuf *p, u8_t code, u32_t data, u8_t type)
return; return;
} }
} }
else {
netif = ip_current_netif();
reply_dest = ip6_current_src_addr();
/* Select an address to use as source. */ /* Select an address to use as source. */
reply_src = ip6_select_source_address(netif, reply_dest); reply_src = ip6_select_source_address(netif, reply_dest);
if (reply_src == NULL) { if (reply_src == NULL) {
/* drop */ /* drop */
pbuf_free(q); pbuf_free(q);
ICMP6_STATS_INC(icmp6.rterr); ICMP6_STATS_INC(icmp6.rterr);
return; return;
}
} }
/* calculate checksum */ /* calculate checksum */