Date: Sat, 11 Apr 2009 00:20:03 GMT From: Max Laier <max@love2party.net> To: freebsd-pf@FreeBSD.org Subject: Re: kern/130977: [netgraph][pf] kernel panic trap 12 on user connect to VPN server Message-ID: <200904110020.n3B0K301081510@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/130977; it has been noted by GNATS. From: Max Laier <max@love2party.net> To: bug-followup@freebsd.org, darkibot@gmail.com Cc: Subject: Re: kern/130977: [netgraph][pf] kernel panic trap 12 on user connect to VPN server Date: Sat, 11 Apr 2009 01:11:54 +0100 --Boundary-00=_LB+3JRWytgyQ4AY Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Here is the MFC patch - if possible, please try and report back. -- Max --Boundary-00=_LB+3JRWytgyQ4AY Content-Type: text/x-patch; charset="ISO-8859-1"; name="mfc.ifg.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mfc.ifg.patch" Index: sys/net/if.c =================================================================== --- sys/net/if.c (revision 190905) +++ sys/net/if.c (working copy) @@ -128,6 +128,7 @@ static void do_link_state_change(void *, int); static int if_getgroup(struct ifgroupreq *, struct ifnet *); static int if_getgroupmembers(struct ifgroupreq *); +static void if_delgroups(struct ifnet *); #ifdef INET6 /* * XXX: declare here to avoid to include many inet6 related files.. @@ -828,6 +829,7 @@ rt_ifannouncemsg(ifp, IFAN_DEPARTURE); EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL); + if_delgroups(ifp); IF_AFDATA_LOCK(ifp); for (dp = domains; dp; dp = dp->dom_next) { @@ -963,6 +965,53 @@ } /* + * Remove an interface from all groups + */ +static void +if_delgroups(struct ifnet *ifp) +{ + struct ifg_list *ifgl; + struct ifg_member *ifgm; + char groupname[IFNAMSIZ]; + + IFNET_WLOCK(); + while (!TAILQ_EMPTY(&ifp->if_groups)) { + ifgl = TAILQ_FIRST(&ifp->if_groups); + + strlcpy(groupname, ifgl->ifgl_group->ifg_group, IFNAMSIZ); + + IF_ADDR_LOCK(ifp); + TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); + IF_ADDR_UNLOCK(ifp); + + TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) + if (ifgm->ifgm_ifp == ifp) + break; + + if (ifgm != NULL) { + TAILQ_REMOVE(&ifgl->ifgl_group->ifg_members, ifgm, + ifgm_next); + free(ifgm, M_TEMP); + } + + if (--ifgl->ifgl_group->ifg_refcnt == 0) { + TAILQ_REMOVE(&ifg_head, ifgl->ifgl_group, ifg_next); + EVENTHANDLER_INVOKE(group_detach_event, + ifgl->ifgl_group); + free(ifgl->ifgl_group, M_TEMP); + } + IFNET_WUNLOCK(); + + free(ifgl, M_TEMP); + + EVENTHANDLER_INVOKE(group_change_event, groupname); + + IFNET_WLOCK(); + } + IFNET_WUNLOCK(); +} + +/* * Stores all groups from an interface in memory pointed * to by data */ --Boundary-00=_LB+3JRWytgyQ4AY--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904110020.n3B0K301081510>