summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2015-03-19 13:10:09 +0000
committerae <ae@FreeBSD.org>2015-03-19 13:10:09 +0000
commit24836ef695b4d0b47117fe6ed0d34b16e37a68aa (patch)
tree3a9555be53f11589ea98cf94bbc7030e1efad687 /sys
parenta81d6ed0b784f018a14c35109d57e973d67e38fe (diff)
downloadFreeBSD-src-24836ef695b4d0b47117fe6ed0d34b16e37a68aa.zip
FreeBSD-src-24836ef695b4d0b47117fe6ed0d34b16e37a68aa.tar.gz
MFC r279920:
Add if_input_default() method, that will be used for if_input initialization, when no input method specified before if_attach(). This prevents panics when if_input() method called directly e.g. from bpf(4) code. PR: 192426
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 417f8cb..5cc135b 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -162,6 +162,7 @@ static int ifconf(u_long, caddr_t);
static void if_freemulti(struct ifmultiaddr *);
static void if_init(void *);
static void if_grow(void);
+static void if_input_default(struct ifnet *, struct mbuf *);
static void if_route(struct ifnet *, int flag, int fam);
static int if_setflag(struct ifnet *, int, int, int *, int);
static int if_transmit(struct ifnet *ifp, struct mbuf *m);
@@ -665,7 +666,9 @@ if_attach_internal(struct ifnet *ifp, int vmove)
ifp->if_transmit = if_transmit;
ifp->if_qflush = if_qflush;
}
-
+ if (ifp->if_input == NULL)
+ ifp->if_input = if_input_default;
+
if (!vmove) {
#ifdef MAC
mac_ifnet_create(ifp);
@@ -3570,6 +3573,13 @@ if_transmit(struct ifnet *ifp, struct mbuf *m)
return (error);
}
+static void
+if_input_default(struct ifnet *ifp __unused, struct mbuf *m)
+{
+
+ m_freem(m);
+}
+
int
if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
{
OpenPOWER on IntegriCloud