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 Reviewed by: glebius MFC after: 1 week
This commit is contained in:
parent
edf3c81a5c
commit
b57d97215e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279920
10
sys/net/if.c
10
sys/net/if.c
@ -160,6 +160,7 @@ static void if_attachdomain1(struct ifnet *);
|
||||
static int ifconf(u_long, caddr_t);
|
||||
static void if_freemulti(struct ifmultiaddr *);
|
||||
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,6 +666,8 @@ if_attach_internal(struct ifnet *ifp, int vmove, struct if_clone *ifc)
|
||||
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
|
||||
@ -3516,6 +3519,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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user