From 54bb7ac0c4bc49c75c62871bd86a5a158bf84c73 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 10 May 2019 21:51:17 +0000 Subject: [PATCH] Fix regression from r347375: do not panic when sending an IP multicast packet from an interface that doesn't have IPv4 address. Reported by: Michael Butler --- sys/netinet/ip_output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 9b8c5b777213..82b208439cfb 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -361,7 +361,11 @@ again: mtu = ifp->if_mtu; IFP_TO_IA(ifp, ia, &in_ifa_tracker); isbroadcast = 0; /* fool gcc */ - src = IA_SIN(ia)->sin_addr; + /* Interface may have no addresses. */ + if (ia != NULL) + src = IA_SIN(ia)->sin_addr; + else + src.s_addr = INADDR_ANY; } else if (ro != NULL) { if (ro->ro_rt == NULL) { /*