summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichele <michele@openbsd.org>2007-01-08 13:52:38 +0000
committermichele <michele@openbsd.org>2007-01-08 13:52:38 +0000
commitbaf3e4abd4b7954811c8443fa3bcd00767f2e46a (patch)
treec46661d3c69577010902d8d9fcf5410517db06fb
parentadd a generic send/expect check using regular expression (see (diff)
downloadwireguard-openbsd-baf3e4abd4b7954811c8443fa3bcd00767f2e46a.tar.xz
wireguard-openbsd-baf3e4abd4b7954811c8443fa3bcd00767f2e46a.zip
discard packet and return if ifp is not a member of the bridge
this fix PR 5056 discussed with camield@ OK camield@ claudio@ henning@
-rw-r--r--sys/net/if_bridge.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 349c51c20d2..266ff1b9c72 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.156 2006/12/28 20:06:11 deraadt Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.157 2007/01/08 13:52:38 michele Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -1009,6 +1009,13 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
struct m_tag *mtag;
#endif /* IPSEC */
+ /* ifp must be a member interface of the bridge. */
+ sc = (struct bridge_softc *)ifp->if_bridge;
+ if (sc == NULL) {
+ m_freem(m);
+ return (0);
+ }
+
if (m->m_len < sizeof(*eh)) {
m = m_pullup(m, sizeof(*eh));
if (m == NULL)
@@ -1017,7 +1024,6 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
eh = mtod(m, struct ether_header *);
dst = (struct ether_addr *)&eh->ether_dhost[0];
src = (struct ether_addr *)&eh->ether_shost[0];
- sc = (struct bridge_softc *)ifp->if_bridge;
s = splnet();