diff options
author | 2017-03-14 10:27:10 +0000 | |
---|---|---|
committer | 2017-03-14 10:27:10 +0000 | |
commit | f41896e9aaa7d9d34a427f80648584608ad6f904 (patch) | |
tree | 1c17b6139874580c9b5688cdd294b991301f46e5 | |
parent | Remove some global variables that are not being used. (diff) | |
download | wireguard-openbsd-f41896e9aaa7d9d34a427f80648584608ad6f904.tar.xz wireguard-openbsd-f41896e9aaa7d9d34a427f80648584608ad6f904.zip |
Make mfc_find() more strict when looking for routes, fixes a problem
causing ip_mforward() not to send packets to the userland multicast
routing daemon.
Reported and tested by Paul de Weerd.
ok bluhm@, claudio@
-rw-r--r-- | sys/netinet/ip_mroute.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 612e41232ff..38b63812f22 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.c,v 1.110 2017/02/09 15:36:46 rzalamena Exp $ */ +/* $OpenBSD: ip_mroute.c,v 1.111 2017/03/14 10:27:10 rzalamena Exp $ */ /* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */ /* @@ -157,11 +157,14 @@ mfc_find(struct ifnet *ifp, struct in_addr *origin, struct in_addr *group, if (rt == NULL) return (NULL); - /* Return first ocurrence if interface is not specified. */ - if (ifp == NULL) - return (rt); - do { + /* Don't consider non multicast routes. */ + if (ISSET(rt->rt_flags, RTF_HOST | RTF_MULTICAST) != + (RTF_HOST | RTF_MULTICAST)) + continue; + /* Return first occurrence if interface is not specified. */ + if (ifp == NULL) + return (rt); if (rt->rt_ifidx == ifp->if_index) return (rt); } while ((rt = rtable_iterate(rt)) != NULL); |