diff options
author | 2017-03-17 14:59:29 +0000 | |
---|---|---|
committer | 2017-03-17 14:59:29 +0000 | |
commit | 04f7bce9e1d57f6f4545713ef8889f0233037c08 (patch) | |
tree | f14330ae05edfeca086bd68688f983d982bbe52b | |
parent | choose_server() does not always return malloc'd memory so pass (diff) | |
download | wireguard-openbsd-04f7bce9e1d57f6f4545713ef8889f0233037c08.tar.xz wireguard-openbsd-04f7bce9e1d57f6f4545713ef8889f0233037c08.zip |
Be more strict on all route iterations, lets always make sure that we
are not going to get a unicast route by accident.
ok mpi@
-rw-r--r-- | sys/netinet/ip_mroute.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 38b63812f22..5236608831b 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.c,v 1.111 2017/03/14 10:27:10 rzalamena Exp $ */ +/* $OpenBSD: ip_mroute.c,v 1.112 2017/03/17 14:59:29 rzalamena Exp $ */ /* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */ /* @@ -293,6 +293,11 @@ get_sg_cnt(unsigned int rtableid, struct sioc_sg_req *req) req->pktcnt = req->bytecnt = req->wrong_if = 0; do { + /* Don't consider non multicast routes. */ + if (ISSET(rt->rt_flags, RTF_HOST | RTF_MULTICAST) != + (RTF_HOST | RTF_MULTICAST)) + continue; + mfc = (struct mfc *)rt->rt_llinfo; req->pktcnt += mfc->mfc_pkt_cnt; req->bytecnt += mfc->mfc_byte_cnt; @@ -1174,6 +1179,11 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp0, struct rtentry *rt) * - there are group members downstream on interface */ do { + /* Don't consider non multicast routes. */ + if (ISSET(rt->rt_flags, RTF_HOST | RTF_MULTICAST) != + (RTF_HOST | RTF_MULTICAST)) + continue; + mfc = (struct mfc *)rt->rt_llinfo; mfc->mfc_pkt_cnt++; mfc->mfc_byte_cnt += m->m_pkthdr.len; |