From owner-svn-src-head@freebsd.org Tue Apr 25 08:30:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29FFED4EC5B; Tue, 25 Apr 2017 08:30:30 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0CE11CB3; Tue, 25 Apr 2017 08:30:29 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P8USId068892; Tue, 25 Apr 2017 08:30:28 GMT (envelope-from zec@FreeBSD.org) Received: (from zec@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P8USKR068891; Tue, 25 Apr 2017 08:30:28 GMT (envelope-from zec@FreeBSD.org) Message-Id: <201704250830.v3P8USKR068891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zec set sender to zec@FreeBSD.org using -f From: Marko Zec Date: Tue, 25 Apr 2017 08:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317399 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 08:30:30 -0000 Author: zec Date: Tue Apr 25 08:30:28 2017 New Revision: 317399 URL: https://svnweb.freebsd.org/changeset/base/317399 Log: Since curvnet is already properly set on entry to event handlers, there's no need to override it, particularly not unconditionally with vnet0. Submitted by: Peter Blok Reviewed by: kp Modified: head/sys/netpfil/pf/pf_if.c Modified: head/sys/netpfil/pf/pf_if.c ============================================================================== --- head/sys/netpfil/pf/pf_if.c Tue Apr 25 03:43:06 2017 (r317398) +++ head/sys/netpfil/pf/pf_if.c Tue Apr 25 08:30:28 2017 (r317399) @@ -89,9 +89,9 @@ static int pfi_skip_if(const char *, st static int pfi_unmask(void *); static void pfi_attach_ifnet_event(void * __unused, struct ifnet *); static void pfi_detach_ifnet_event(void * __unused, struct ifnet *); -static void pfi_attach_group_event(void *, struct ifg_group *); -static void pfi_change_group_event(void *, char *); -static void pfi_detach_group_event(void *, struct ifg_group *); +static void pfi_attach_group_event(void * __unused, struct ifg_group *); +static void pfi_change_group_event(void * __unused, char *); +static void pfi_detach_group_event(void * __unused, struct ifg_group *); static void pfi_ifaddr_event(void * __unused, struct ifnet *); RB_HEAD(pfi_ifhead, pfi_kif); @@ -143,11 +143,11 @@ pfi_initialize(void) pfi_detach_cookie = EVENTHANDLER_REGISTER(ifnet_departure_event, pfi_detach_ifnet_event, NULL, EVENTHANDLER_PRI_ANY); pfi_attach_group_cookie = EVENTHANDLER_REGISTER(group_attach_event, - pfi_attach_group_event, curvnet, EVENTHANDLER_PRI_ANY); + pfi_attach_group_event, NULL, EVENTHANDLER_PRI_ANY); pfi_change_group_cookie = EVENTHANDLER_REGISTER(group_change_event, - pfi_change_group_event, curvnet, EVENTHANDLER_PRI_ANY); + pfi_change_group_event, NULL, EVENTHANDLER_PRI_ANY); pfi_detach_group_cookie = EVENTHANDLER_REGISTER(group_detach_event, - pfi_detach_group_event, curvnet, EVENTHANDLER_PRI_ANY); + pfi_detach_group_event, NULL, EVENTHANDLER_PRI_ANY); pfi_ifaddr_event_cookie = EVENTHANDLER_REGISTER(ifaddr_event, pfi_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY); } @@ -800,10 +800,8 @@ static void pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp) { - CURVNET_SET(ifp->if_vnet); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } pfi_attach_ifnet(ifp); @@ -812,7 +810,6 @@ pfi_attach_ifnet_event(void *arg __unuse pf_altq_ifnet_event(ifp, 0); PF_RULES_WUNLOCK(); #endif - CURVNET_RESTORE(); } static void @@ -823,10 +820,8 @@ pfi_detach_ifnet_event(void *arg __unuse if (kif == NULL) return; - CURVNET_SET(ifp->if_vnet); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } PF_RULES_WLOCK(); @@ -839,32 +834,26 @@ pfi_detach_ifnet_event(void *arg __unuse pf_altq_ifnet_event(ifp, 1); #endif PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); } static void -pfi_attach_group_event(void *arg , struct ifg_group *ifg) +pfi_attach_group_event(void *arg __unused, struct ifg_group *ifg) { - CURVNET_SET((struct vnet *)arg); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } pfi_attach_ifgroup(ifg); - CURVNET_RESTORE(); } static void -pfi_change_group_event(void *arg, char *gname) +pfi_change_group_event(void *arg __unused, char *gname) { struct pfi_kif *kif; - CURVNET_SET((struct vnet *)arg); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } @@ -874,21 +863,18 @@ pfi_change_group_event(void *arg, char * kif = pfi_kif_attach(kif, gname); pfi_kif_update(kif); PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); } static void -pfi_detach_group_event(void *arg, struct ifg_group *ifg) +pfi_detach_group_event(void *arg __unused, struct ifg_group *ifg) { struct pfi_kif *kif = (struct pfi_kif *)ifg->ifg_pf_kif; if (kif == NULL) return; - CURVNET_SET((struct vnet *)arg); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } PF_RULES_WLOCK(); @@ -897,7 +883,6 @@ pfi_detach_group_event(void *arg, struct kif->pfik_group = NULL; ifg->ifg_pf_kif = NULL; PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); } static void @@ -906,10 +891,8 @@ pfi_ifaddr_event(void *arg __unused, str if (ifp->if_pf_kif == NULL) return; - CURVNET_SET(ifp->if_vnet); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } PF_RULES_WLOCK(); @@ -918,5 +901,4 @@ pfi_ifaddr_event(void *arg __unused, str pfi_kif_update(ifp->if_pf_kif); } PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); }