diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 3209e8a82978..0427e1352ab1 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1357,9 +1357,10 @@ SYSCTL_INT(_net_link_vlan, OID_AUTO, soft_pad, CTLFLAG_RW | CTLFLAG_VNET, * per-packet memory allocations and frees. In the future, it would be * preferable to reuse ether_vtag for this, or similar. */ -int vlan_mtag_pcp = 0; -SYSCTL_INT(_net_link_vlan, OID_AUTO, mtag_pcp, CTLFLAG_RW, - &vlan_mtag_pcp, 0, +VNET_DEFINE(int, vlan_mtag_pcp) = 0; +#define V_vlan_mtag_pcp VNET(vlan_mtag_pcp) +SYSCTL_INT(_net_link_vlan, OID_AUTO, mtag_pcp, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(vlan_mtag_pcp), 0, "Retain VLAN PCP information as packets are passed up the stack"); bool @@ -1411,7 +1412,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, * knows how to find the VLAN tag to use, so we attach a * packet tag that holds it. */ - if (vlan_mtag_pcp && (mtag = m_tag_locate(*mp, MTAG_8021Q, + if (V_vlan_mtag_pcp && (mtag = m_tag_locate(*mp, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL)) != NULL) tag = EVL_MAKETAG(qtag->vid, *(uint8_t *)(mtag + 1), 0); else diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 07c325d0cb12..c8256dc087a5 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -213,7 +213,8 @@ static struct { {0, NULL} }; -extern int vlan_mtag_pcp; +VNET_DECLARE(int, vlan_mtag_pcp); +#define V_vlan_mtag_pcp VNET(vlan_mtag_pcp) static const char vlanname[] = "vlan"; static MALLOC_DEFINE(M_VLAN, vlanname, "802.1Q Virtual LAN Interface"); @@ -1430,7 +1431,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) return; } - if (vlan_mtag_pcp) { + if (V_vlan_mtag_pcp) { /* * While uncommon, it is possible that we will find a 802.1q * packet encapsulated inside another packet that also had an