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 <imb protected-networks.net>
This commit is contained in:
Gleb Smirnoff 2019-05-10 21:51:17 +00:00
parent c9d337083f
commit 54bb7ac0c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347466

View File

@ -361,7 +361,11 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
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) {
/*