summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-04-12 06:20:31 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-04-12 06:20:31 +0000
commita388f5da8beb9b254abcb7d8a6b341a7fc59c35a (patch)
tree6f71b7a86037678b4f56e123466327af7558ce11 /sys/net
parent54e0002750ce3428adf1e12b64f3116b5fc87efb (diff)
Set bridge(4)'s if_output to a dummy function returning EAFNOSUPPORT as
it should not be used to output packets but we have to respect the ifp driver API to some extend. Prevent a panic found the hardway by espie@. ok claudio@, mikeb@, jsg@, krw@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_bridge.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index cdd2f453ef5..e880e793e5d 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.277 2016/03/30 12:16:30 dlg Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.278 2016/04/12 06:20:30 mpi Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -127,6 +127,8 @@ struct mbuf *bridge_ip(struct bridge_softc *, int, struct ifnet *,
struct ether_header *, struct mbuf *m);
int bridge_ifenqueue(struct bridge_softc *, struct ifnet *, struct mbuf *);
void bridge_ifinput(struct ifnet *, struct mbuf *);
+int bridge_dummy_output(struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *);
void bridge_fragment(struct bridge_softc *, struct ifnet *,
struct ether_header *, struct mbuf *);
#ifdef IPSEC
@@ -186,7 +188,7 @@ bridge_clone_create(struct if_clone *ifc, int unit)
ifp->if_softc = sc;
ifp->if_mtu = ETHERMTU;
ifp->if_ioctl = bridge_ioctl;
- ifp->if_output = NULL;
+ ifp->if_output = bridge_dummy_output;
ifp->if_start = NULL;
ifp->if_type = IFT_BRIDGE;
ifp->if_hdrlen = ETHER_HDR_LEN;
@@ -205,6 +207,14 @@ bridge_clone_create(struct if_clone *ifc, int unit)
}
int
+bridge_dummy_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
+ struct rtentry *rt)
+{
+ m_freem(m);
+ return (EAFNOSUPPORT);
+}
+
+int
bridge_clone_destroy(struct ifnet *ifp)
{
struct bridge_softc *sc = ifp->if_softc;