Fix ip_output() on point-to-point links
In r304435, ip_output() was changed to use the result of the route lookup to decide whether the outgoing packet was a broadcast or not. This introduced a regression on interfaces where IFF_BROADCAST was not set (e.g. point-to-point links), as the algorithm could incorrectly treat the destination address as a broadcast address, and ip_output() would subsequently drop the packet as broadcasting on a non-IFF_BROADCAST interface is not allowed. Differential Revision: https://reviews.freebsd.org/D8303 Reviewed by: jtl Reported by: ambrisko MFC after: 2 weeks X-MFC-With: r304435 Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
f5355fadf7
commit
6c1bd55875
@ -350,7 +350,8 @@ again:
|
||||
have_ia_ref = 1;
|
||||
ifp = ia->ia_ifp;
|
||||
ip->ip_ttl = 1;
|
||||
isbroadcast = in_ifaddr_broadcast(dst->sin_addr, ia);
|
||||
isbroadcast = ifp->if_flags & IFF_BROADCAST ?
|
||||
in_ifaddr_broadcast(dst->sin_addr, ia) : 0;
|
||||
} else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
|
||||
imo != NULL && imo->imo_multicast_ifp != NULL) {
|
||||
/*
|
||||
@ -403,8 +404,10 @@ again:
|
||||
gw = (struct sockaddr_in *)rte->rt_gateway;
|
||||
if (rte->rt_flags & RTF_HOST)
|
||||
isbroadcast = (rte->rt_flags & RTF_BROADCAST);
|
||||
else
|
||||
else if (ifp->if_flags & IFF_BROADCAST)
|
||||
isbroadcast = in_ifaddr_broadcast(gw->sin_addr, ia);
|
||||
else
|
||||
isbroadcast = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user