diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-06-19 17:00:17 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-06-19 17:00:17 +0000 |
commit | 2bdc25e48b183793d46110c77a0cc4bbaa318902 (patch) | |
tree | 2d266f205918f62b07ef46d95bd68388257173e6 /sys/netinet6/ip6_input.c | |
parent | 1fe130d96b230fdfb29ea2ead7158fae6f80c8db (diff) |
The IP multicast forward functions return an errno, call the variable
error. Make the ip_mforward() return value consistent. Simplify
the caller logic in ipv6_input() like in IPv4.
OK mpi@
Diffstat (limited to 'sys/netinet6/ip6_input.c')
-rw-r--r-- | sys/netinet6/ip6_input.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 7018444ba98..b763c59e562 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.194 2017/05/31 05:59:09 mpi Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.195 2017/06/19 17:00:16 bluhm Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -381,6 +381,8 @@ ipv6_input(struct ifnet *ifp, struct mbuf *m) #ifdef MROUTING if (ip6_mforwarding && ip6_mrouter[ifp->if_rdomain]) { + int error; + if (ip6_hbhchcheck(m, &off, &nxt, &ours)) goto out; @@ -395,16 +397,20 @@ ipv6_input(struct ifnet *ifp, struct mbuf *m) * must be discarded, else it may be accepted below. */ KERNEL_LOCK(); - if (ip6_mforward(ip6, ifp, m)) { + error = ip6_mforward(ip6, ifp, m); + KERNEL_UNLOCK(); + if (error) { ip6stat_inc(ip6s_cantforward); - m_freem(m); - } else if (ours) { + goto bad; + } + + if (ours) { + KERNEL_LOCK(); ip6_deliver(&m, &off, nxt, AF_INET6); - } else { - m_freem(m); + KERNEL_UNLOCK(); + goto out; } - KERNEL_UNLOCK(); - goto out; + goto bad; } #endif if (!ours) { |