HomeFreeBSD

Don't iterate over the ifnet addr list in ip_output()

Description

Don't iterate over the ifnet addr list in ip_output()

For almost every packet that is transmitted through ip_output(),
a call to in_broadcast() was made to decide if the destination
IP was a broadcast address. in_broadcast() iterates over the
ifnet's address to find a source IP matching the subnet of the
destination IP, and then checks if the IP is a broadcast in that
subnet.

This is completely redundant as we have already performed the
route lookup, so the source IP is already known. Just use that
address to directly check whether the destination IP is a
broadcast address or not.

MFC after: 2 months
Sponsored By: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7266

Details

Provenance
rstoneAuthored on
Differential Revision
D7266: Don't iterate over the ifnet addr list in ip_output()
Parents
rS304434: MFC r304433
Branches
Unknown
Tags
Unknown