Skip to content

Commit

Permalink
Merge branch 'freebsd/12-stable/master' into hardened/12-stable/master
Browse files Browse the repository at this point in the history
* freebsd/12-stable/master:
  MFC r350568:
  MFC r350567:
  • Loading branch information
opntr-auto committed Aug 7, 2019
2 parents 9f19329 + 31085ae commit 94662bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
26 changes: 15 additions & 11 deletions sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ VNET_DEFINE(ipf_main_softc_t, ipfmain) = {
# include <sys/conf.h>
# include <net/pfil.h>

static eventhandler_tag ipf_arrivetag, ipf_departtag;
VNET_DEFINE_STATIC(eventhandler_tag, ipf_arrivetag);
VNET_DEFINE_STATIC(eventhandler_tag, ipf_departtag);
#define V_ipf_arrivetag VNET(ipf_arrivetag)
#define V_ipf_departtag VNET(ipf_departtag)
#if 0
/*
* Disable the "cloner" event handler; we are getting interface
Expand All @@ -108,7 +111,8 @@ static eventhandler_tag ipf_arrivetag, ipf_departtag;
* If it turns out to be needed, well need a dedicated event handler
* for it to deal with the ifc and the correct vnet.
*/
static eventhandler_tag ipf_clonetag;
VNET_DEFINE_STATIC(eventhandler_tag, ipf_clonetag);
#define V_ipf_clonetag VNET(ipf_clonetag)
#endif

static void ipf_ifevent(void *arg, struct ifnet *ifp);
Expand Down Expand Up @@ -1384,30 +1388,30 @@ int ipf_pfil_hook(void) {
void
ipf_event_reg(void)
{
ipf_arrivetag = EVENTHANDLER_REGISTER(ifnet_arrival_event, \
V_ipf_arrivetag = EVENTHANDLER_REGISTER(ifnet_arrival_event, \
ipf_ifevent, NULL, \
EVENTHANDLER_PRI_ANY);
ipf_departtag = EVENTHANDLER_REGISTER(ifnet_departure_event, \
V_ipf_departtag = EVENTHANDLER_REGISTER(ifnet_departure_event, \
ipf_ifevent, NULL, \
EVENTHANDLER_PRI_ANY);
#if 0
ipf_clonetag = EVENTHANDLER_REGISTER(if_clone_event, ipf_ifevent, \
V_ipf_clonetag = EVENTHANDLER_REGISTER(if_clone_event, ipf_ifevent, \
NULL, EVENTHANDLER_PRI_ANY);
#endif
}

void
ipf_event_dereg(void)
{
if (ipf_arrivetag != NULL) {
EVENTHANDLER_DEREGISTER(ifnet_arrival_event, ipf_arrivetag);
if (V_ipf_arrivetag != NULL) {
EVENTHANDLER_DEREGISTER(ifnet_arrival_event, V_ipf_arrivetag);
}
if (ipf_departtag != NULL) {
EVENTHANDLER_DEREGISTER(ifnet_departure_event, ipf_departtag);
if (V_ipf_departtag != NULL) {
EVENTHANDLER_DEREGISTER(ifnet_departure_event, V_ipf_departtag);
}
#if 0
if (ipf_clonetag != NULL) {
EVENTHANDLER_DEREGISTER(if_clone_event, ipf_clonetag);
if (V_ipf_clonetag != NULL) {
EVENTHANDLER_DEREGISTER(if_clone_event, V_ipf_clonetag);
}
#endif
}
Expand Down
6 changes: 5 additions & 1 deletion sys/contrib/ipfilter/netinet/mlfk_ipl.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ vnet_ipf_uninit(void)
V_ipfmain.ipf_running = -2;

ipf_destroy_all(&V_ipfmain);
if (!IS_DEFAULT_VNET(curvnet)) {
ipf_event_dereg();
(void)ipf_pfil_unhook();
}
}
}
VNET_SYSUNINIT(vnet_ipf_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_THIRD,
Expand Down Expand Up @@ -310,7 +314,7 @@ ipf_modunload()

printf("%s unloaded\n", ipfilter_version);

return error;
return (0);
}


Expand Down

0 comments on commit 94662bd

Please sign in to comment.