diff options
author | 2016-05-31 07:33:22 +0000 | |
---|---|---|
committer | 2016-05-31 07:33:22 +0000 | |
commit | b32ce2c2023bb4e3e264b15e412852e236e280ca (patch) | |
tree | 7ca9cf370f89027111c6eb804a90ae286e11f62e /sys | |
parent | To store MMC position, use samples (at device rate) as time units (diff) | |
download | wireguard-openbsd-b32ce2c2023bb4e3e264b15e412852e236e280ca.tar.xz wireguard-openbsd-b32ce2c2023bb4e3e264b15e412852e236e280ca.zip |
Inverse two conditions to not grabe the KERNEL_LOCK for every multicast
packet.
ok visa@, stsp@, sthen@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_output.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 17cdf846eea..6c8b47569f8 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.322 2016/05/04 13:22:51 vgross Exp $ */ +/* $OpenBSD: ip_output.c,v 1.323 2016/05/31 07:33:22 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -185,14 +185,17 @@ reroute: if ((IN_MULTICAST(ip->ip_dst.s_addr) || (ip->ip_dst.s_addr == INADDR_BROADCAST)) && imo != NULL && (ifp = if_get(imo->imo_ifidx)) != NULL) { - struct in_ifaddr *ia; mtu = ifp->if_mtu; - KERNEL_LOCK(); - IFP_TO_IA(ifp, ia); - if (ip->ip_src.s_addr == INADDR_ANY && ia) - ip->ip_src = ia->ia_addr.sin_addr; - KERNEL_UNLOCK(); + if (ip->ip_src.s_addr == INADDR_ANY) { + struct in_ifaddr *ia; + + KERNEL_LOCK(); + IFP_TO_IA(ifp, ia); + if (ia != NULL) + ip->ip_src = ia->ia_addr.sin_addr; + KERNEL_UNLOCK(); + } } else { struct in_ifaddr *ia; |