Skip to content

Commit

Permalink
if_ethersubr.c: fix ether_8021q_frame to respect VHID from ether_vtag
Browse files Browse the repository at this point in the history
  • Loading branch information
rozhuk-im committed Jul 24, 2024
1 parent bb7f7d5 commit 28896b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sys/net/if_ethersubr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p,
{
struct m_tag *mtag;
int n;
uint16_t tag;
uint16_t tag, vid = qtag->vid;
uint8_t pcp = qtag->pcp;
static const char pad[8]; /* just zeros */

Expand Down Expand Up @@ -1439,6 +1439,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p,
* If PCP is set in mbuf, use it
*/
if ((*mp)->m_flags & M_VLANTAG) {
vid = EVL_VLANOFTAG((*mp)->m_pkthdr.ether_vtag);
pcp = EVL_PRIOFTAG((*mp)->m_pkthdr.ether_vtag);
}

Expand All @@ -1451,9 +1452,9 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p,
*/
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);
tag = EVL_MAKETAG(vid, *(uint8_t *)(mtag + 1), 0);
else
tag = EVL_MAKETAG(qtag->vid, pcp, 0);
tag = EVL_MAKETAG(vid, pcp, 0);
if ((p->if_capenable & IFCAP_VLAN_HWTAGGING) &&
(qtag->proto == ETHERTYPE_VLAN)) {
(*mp)->m_pkthdr.ether_vtag = tag;

Check warning on line 1460 in sys/net/if_ethersubr.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 1460 in sys/net/if_ethersubr.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
Expand Down

0 comments on commit 28896b2

Please sign in to comment.