aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2008-04-25 19:45:42 +0000
committerSam Leffler <sam@FreeBSD.org>2008-04-25 19:45:42 +0000
commit009512791856bf423d24c4a0732b2827d1876278 (patch)
treeda68c3e158210582fccb70234c6db5b6e3703072
parent48c89a5a292bfcc763b4af421eebda2b3a7652b9 (diff)
downloadsrc-009512791856bf423d24c4a0732b2827d1876278.tar.gz
src-009512791856bf423d24c4a0732b2827d1876278.zip
hookup the parent device's if_input and if_output to stub routines
to catch unintended use (one might argue about if_output but it's behaviour is ill-defined without vap context) Noticed by: Paul B. Mahol
Notes
Notes: svn path=/head/; revision=178521
-rw-r--r--sys/net80211/ieee80211.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 952f420a8209..e488bce001d1 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -181,6 +181,22 @@ null_update_promisc(struct ifnet *ifp)
if_printf(ifp, "need promiscuous mode update callback\n");
}
+static int
+null_output(struct ifnet *ifp, struct mbuf *m,
+ struct sockaddr *dst, struct rtentry *rt0)
+{
+ if_printf(ifp, "discard raw packet\n");
+ m_freem(m);
+ return EIO;
+}
+
+static void
+null_input(struct ifnet *ifp, struct mbuf *m)
+{
+ if_printf(ifp, "if_input should not be called\n");
+ m_freem(m);
+}
+
/*
* Attach/setup the common net80211 state. Called by
* the driver on attach to prior to creating any vap's.
@@ -225,6 +241,9 @@ ieee80211_ifattach(struct ieee80211com *ic)
if_attach(ifp);
ifp->if_mtu = IEEE80211_MTU_MAX;
ifp->if_broadcastaddr = ieee80211broadcastaddr;
+ ifp->if_output = null_output;
+ ifp->if_input = null_input; /* just in case */
+ ifp->if_resolvemulti = NULL; /* NB: callers check */
ifa = ifaddr_byindex(ifp->if_index);
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));