Module Name: src Committed By: martin Date: Sat Apr 14 10:38:59 UTC 2018
Modified Files: src/sys/net [netbsd-8]: if_vlan.c Log Message: Pull up following revision(s) (requested by ryo in ticket #752): sys/net/if_vlan.c: revision 1.125 Fix the handling of the state returned from pfil_run_hooks(). pfil_run_hooks() invokes any registered packet filters on the packet being handled. It may return a (non-zero) errno, indicating that a filter has decided that the packet should be discarded, and has freed the mbuf. While a non-error (0) return usually means that the packet should be processed normally, a filter may still free the mbuf if the packet is a fragment, and the filter is holding it for reassembly and future evaluation. Therefore, there must be separate tests for the return value and for a possible discarded packet. (See pfil(9).) OK: christos, martin To generate a diff of this commit: cvs rdiff -u -r1.97.2.11 -r1.97.2.12 src/sys/net/if_vlan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_vlan.c diff -u src/sys/net/if_vlan.c:1.97.2.11 src/sys/net/if_vlan.c:1.97.2.12 --- src/sys/net/if_vlan.c:1.97.2.11 Tue Jan 2 10:20:33 2018 +++ src/sys/net/if_vlan.c Sat Apr 14 10:38:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vlan.c,v 1.97.2.11 2018/01/02 10:20:33 snj Exp $ */ +/* $NetBSD: if_vlan.c,v 1.97.2.12 2018/04/14 10:38:59 martin Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.11 2018/01/02 10:20:33 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.12 2018/04/14 10:38:59 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1419,12 +1419,10 @@ vlan_transmit(struct ifnet *ifp, struct bpf_mtap(ifp, m); - if (pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_OUT) != 0) { - if (m != NULL) - m_freem(m); - error = 0; + if ((error = pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_OUT)) != 0) + goto out; + if (m == NULL) goto out; - } /* * If the parent can insert the tag itself, just mark @@ -1610,11 +1608,10 @@ vlan_input(struct ifnet *ifp, struct mbu m_set_rcvif(m, &ifv->ifv_if); ifv->ifv_if.if_ipackets++; - if (pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_IN) != 0) { - if (m != NULL) - m_freem(m); + if (pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_IN) != 0) + goto out; + if (m == NULL) goto out; - } m->m_flags &= ~M_PROMISC; if_input(&ifv->ifv_if, m);