diff options
author | 2016-01-21 11:23:48 +0000 | |
---|---|---|
committer | 2016-01-21 11:23:48 +0000 | |
commit | 34dbf6d68f3cdb81bf9e00e1703c751f2deb0bb7 (patch) | |
tree | e5af64c9c5f1adad00933426db4d4893c7ff84e6 /sys/netinet/ip_output.c | |
parent | avoid uninitialised variable use (diff) | |
download | wireguard-openbsd-34dbf6d68f3cdb81bf9e00e1703c751f2deb0bb7.tar.xz wireguard-openbsd-34dbf6d68f3cdb81bf9e00e1703c751f2deb0bb7.zip |
Introduce in{,6}_hasmulti(), two functions to check in the hot path if
an interface joined a specific multicast group.
ok phessler@, visa@, dlg@
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 070a56b6bd1..385f908aa9b 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.316 2016/01/13 09:38:36 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.317 2016/01/21 11:23:48 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -241,7 +241,6 @@ reroute: if (IN_MULTICAST(ip->ip_dst.s_addr) || (ip->ip_dst.s_addr == INADDR_BROADCAST)) { - struct in_multi *inm; m->m_flags |= (ip->ip_dst.s_addr == INADDR_BROADCAST) ? M_BCAST : M_MCAST; @@ -295,9 +294,8 @@ reroute: ip->ip_src = ia->ia_addr.sin_addr; } - IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm); - if (inm != NULL && - (imo == NULL || imo->imo_loop)) { + if ((imo == NULL || imo->imo_loop) && + in_hasmulti(&ip->ip_dst, ifp)) { /* * If we belong to the destination multicast group * on the outgoing interface, and the caller did not |