Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net kern/52765: npf cannot do port forwarding on vlan in...



details:   https://anonhg.NetBSD.org/src/rev/84d67e13e3f1
branches:  trunk
changeset: 828078:84d67e13e3f1
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Nov 27 01:34:06 2017 +0000

description:
kern/52765: npf cannot do port forwarding on vlan interfaces

Add pfil hooks support to vlan(4), from christos@

diffstat:

 sys/net/if_vlan.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r f5cd89cf0e44 -r 84d67e13e3f1 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Mon Nov 27 00:25:46 2017 +0000
+++ b/sys/net/if_vlan.c Mon Nov 27 01:34:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.112 2017/11/22 05:17:32 msaitoh Exp $    */
+/*     $NetBSD: if_vlan.c,v 1.113 2017/11/27 01:34:06 jmcneill 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.112 2017/11/22 05:17:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.113 2017/11/27 01:34:06 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1384,6 +1384,14 @@
        ec = (void *)mib->ifvm_p;
 
        bpf_mtap(ifp, m);
+
+       if (pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_OUT) != 0) {
+               if (m != NULL)
+                       m_freem(m);
+               error = 0;
+               goto out;
+       }
+
        /*
         * If the parent can insert the tag itself, just mark
         * the tag in the mbuf header.
@@ -1568,6 +1576,12 @@
        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);
+               goto out;
+       }
+
        m->m_flags &= ~M_PROMISC;
        if_input(&ifv->ifv_if, m);
 out:



Home | Main Index | Thread Index | Old Index