ng_ether: Enter NET_EPOCH where required

We must enter NET_EPOCH before calling ether_output_frame(). Several of the
functions it calls (pfil_run_hooks, if_transmit) expect to be running in the
NET_EPOCH.

While here remove an unneeded EPOCH entry (which wasn't wide enough to cover
BRIDGE_INPUT).

PR:		248958
Reviewed by:	glebius, bz (previous version), melifaro (previous version)
Tested by:	manu
Differential Revision:	https://reviews.freebsd.org/D26226
This commit is contained in:
Kristof Provost 2020-09-02 11:49:22 +00:00
parent 3bebdc0564
commit 51e805c43c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365246
2 changed files with 8 additions and 3 deletions

View File

@ -711,7 +711,6 @@ ng_ether_rcv_lower(hook_p hook, item_p item)
static int
ng_ether_rcv_upper(hook_p hook, item_p item)
{
struct epoch_tracker et;
struct mbuf *m;
const node_p node = NG_HOOK_NODE(hook);
const priv_p priv = NG_NODE_PRIVATE(node);
@ -739,9 +738,7 @@ ng_ether_rcv_upper(hook_p hook, item_p item)
}
/* Route packet back in */
NET_EPOCH_ENTER(et);
ether_demux(ifp, m);
NET_EPOCH_EXIT(et);
return (0);
}

View File

@ -48,6 +48,7 @@
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#include <sys/epoch.h>
#include <sys/syslog.h>
#include <net/ethernet.h>
@ -761,6 +762,7 @@ ng_pppoe_connect(hook_p hook)
static int
ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook)
{
struct epoch_tracker et;
priv_p privp = NG_NODE_PRIVATE(node);
struct ngpppoe_init_data *ourmsg = NULL;
struct ng_mesg *resp = NULL;
@ -980,7 +982,9 @@ ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook)
neg->service.hdr.tag_len = htons((uint16_t)srvlen);
bcopy(ourmsg->data + srvpos, neg->service.data, srvlen);
neg->service_len = srvlen;
NET_EPOCH_ENTER(et);
pppoe_start(sp);
NET_EPOCH_EXIT(et);
break;
}
case NGM_PPPOE_LISTEN:
@ -1166,8 +1170,10 @@ ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook)
m->m_pkthdr.len = m->m_len = sizeof(*wh) + sizeof(*tag) +
ourmsg->data_len;
wh->ph.length = htons(sizeof(*tag) + ourmsg->data_len);
NET_EPOCH_ENTER(et);
NG_SEND_DATA_ONLY(error,
privp->ethernet_hook, m);
NET_EPOCH_EXIT(et);
}
break;
}
@ -1209,8 +1215,10 @@ ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook)
m->m_pkthdr.len = m->m_len = sizeof(*wh) + sizeof(*tag) +
ourmsg->data_len;
wh->ph.length = htons(sizeof(*tag) + ourmsg->data_len);
NET_EPOCH_ENTER(et);
NG_SEND_DATA_ONLY(error,
privp->ethernet_hook, m);
NET_EPOCH_EXIT(et);
}
break;
}