aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Dorfman <dd@FreeBSD.org>2001-11-27 19:58:09 +0000
committerDima Dorfman <dd@FreeBSD.org>2001-11-27 19:58:09 +0000
commit0d4bef5dd43d0ffe8c74e94ff31870c4414dfbb1 (patch)
treeb8685fe28a8e426de5c2055411e2ff916e8663bf
parent19d2c78f34c92ee9dd4c9096e3f4b0c0534f34d5 (diff)
Notes
-rw-r--r--sys/netinet/ip_icmp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 331fe8187514..62bcd7e86c9c 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -623,10 +623,23 @@ icmp_reflect(m)
(struct sockaddr *)&icmpdst, m->m_pkthdr.rcvif);
/*
* The following happens if the packet was not addressed to us,
- * and was received on an interface with no IP address.
+ * and was received on an interface with no IP address:
+ * We find the first AF_INET address on the first non-loopback
+ * interface.
*/
if (ia == NULL)
- ia = TAILQ_FIRST(&in_ifaddrhead);
+ TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link)
+ if ((ia->ia_ifp->if_flags & IFF_LOOPBACK) == 0)
+ break;
+
+ /*
+ * If we still didn't find an address, punt. We could have an
+ * interface up and (and receiving packets) with no address.
+ */
+ if (ia == NULL) {
+ m_freem(m);
+ goto done;
+ }
match:
t = IA_SIN(ia)->sin_addr;
ip->ip_src = t;