The branch main has been updated by ivy:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4d281507f5f159e0717ae9f4a46cf6fbca67e23d

commit 4d281507f5f159e0717ae9f4a46cf6fbca67e23d
Author:     Lexi Winter <i...@freebsd.org>
AuthorDate: 2025-07-28 17:26:22 +0000
Commit:     Lexi Winter <i...@freebsd.org>
CommitDate: 2025-07-28 17:26:22 +0000

    bridge: be consistent about PVID terminology
    
    The PVID option is exposed to the user as 'untagged', but the API was
    inconsistent on whether it's called 'untagged' or 'PVID'.  Standardise
    on calling it PVID everywhere in the code, since this is the 802.1Q
    terminology.
    
    Keep 'untagged' as the user-facing term since sysadmins are not network
    admins and are often not familiar with the term PVID.
    
    Approved by:    des
    Differential Revision:  https://reviews.freebsd.org/D51182
---
 sbin/ifconfig/ifbridge.c | 16 ++++++++--------
 sys/net/if_bridge.c      | 28 ++++++++++++++--------------
 sys/net/if_bridgevar.h   |  4 ++--
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
index 9b46cc70c409..a75c37e640a2 100644
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -256,8 +256,8 @@ bridge_status(if_ctx *ctx)
                        else
                                printf(" <unknown state %d>", state);
                }
-               if (member->ifbr_untagged != 0)
-                       printf(" untagged %u", (unsigned)member->ifbr_untagged);
+               if (member->ifbr_pvid != 0)
+                       printf(" untagged %u", (unsigned)member->ifbr_pvid);
                print_vlans(&bridge->member_vlans[i]);
                printf("\n");
        }
@@ -632,11 +632,11 @@ setbridge_untagged(if_ctx *ctx, const char *ifn, const 
char *vlanid)
        memset(&req, 0, sizeof(req));
        strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
 
-       if (get_vlan_id(vlanid, &req.ifbr_untagged) < 0)
+       if (get_vlan_id(vlanid, &req.ifbr_pvid) < 0)
                errx(1, "invalid VLAN identifier: %s", vlanid);
 
-       if (do_cmd(ctx, BRDGSIFUNTAGGED, &req, sizeof(req), 1) < 0)
-               err(1, "BRDGSIFUNTAGGED %s", vlanid);
+       if (do_cmd(ctx, BRDGSIFPVID, &req, sizeof(req), 1) < 0)
+               err(1, "BRDGSIFPVID %s", vlanid);
 }
 
 static void
@@ -647,10 +647,10 @@ unsetbridge_untagged(if_ctx *ctx, const char *ifn, int 
dummy __unused)
        memset(&req, 0, sizeof(req));
 
        strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
-       req.ifbr_untagged = 0;
+       req.ifbr_pvid = 0;
 
-       if (do_cmd(ctx, BRDGSIFUNTAGGED, &req, sizeof(req), 1) < 0)
-               err(1, "BRDGSIFUNTAGGED");
+       if (do_cmd(ctx, BRDGSIFPVID, &req, sizeof(req), 1) < 0)
+               err(1, "BRDGSIFPVID");
 }
 
 static void
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 3327c863468f..64aaecf6f029 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -257,8 +257,8 @@ struct bridge_iflist {
        uint32_t                bif_addrcnt;    /* cur. # of addresses */
        uint32_t                bif_addrexceeded;/* # of address violations */
        struct epoch_context    bif_epoch_ctx;
-       ether_vlanid_t          bif_untagged;   /* untagged vlan id */
-       ifbvlan_set_t           bif_vlan_set;   /* allowed tagged vlans */
+       ether_vlanid_t          bif_pvid;       /* port vlan id */
+       ifbvlan_set_t           bif_vlan_set;   /* if allowed tagged vlans */
 };
 
 /*
@@ -407,7 +407,7 @@ static int  bridge_ioctl_sma(struct bridge_softc *, void *);
 static int     bridge_ioctl_sifprio(struct bridge_softc *, void *);
 static int     bridge_ioctl_sifcost(struct bridge_softc *, void *);
 static int     bridge_ioctl_sifmaxaddr(struct bridge_softc *, void *);
-static int     bridge_ioctl_sifuntagged(struct bridge_softc *, void *);
+static int     bridge_ioctl_sifpvid(struct bridge_softc *, void *);
 static int     bridge_ioctl_sifvlanset(struct bridge_softc *, void *);
 static int     bridge_ioctl_gifvlanset(struct bridge_softc *, void *);
 static int     bridge_ioctl_addspan(struct bridge_softc *, void *);
@@ -628,7 +628,7 @@ static const struct bridge_control bridge_control_table[] = 
{
        { bridge_ioctl_sifmaxaddr,      sizeof(struct ifbreq),
          BC_F_COPYIN|BC_F_SUSER },
 
-       { bridge_ioctl_sifuntagged,     sizeof(struct ifbreq),
+       { bridge_ioctl_sifpvid,         sizeof(struct ifbreq),
          BC_F_COPYIN|BC_F_SUSER },
 
        { bridge_ioctl_sifvlanset,      sizeof(struct ifbif_vlan_req),
@@ -1533,7 +1533,7 @@ bridge_ioctl_gifflags(struct bridge_softc *sc, void *arg)
        req->ifbr_addrcnt = bif->bif_addrcnt;
        req->ifbr_addrmax = bif->bif_addrmax;
        req->ifbr_addrexceeded = bif->bif_addrexceeded;
-       req->ifbr_untagged = bif->bif_untagged;
+       req->ifbr_pvid = bif->bif_pvid;
 
        /* Copy STP state options as flags */
        if (bp->bp_operedge)
@@ -1913,7 +1913,7 @@ bridge_ioctl_sifmaxaddr(struct bridge_softc *sc, void 
*arg)
 }
 
 static int
-bridge_ioctl_sifuntagged(struct bridge_softc *sc, void *arg)
+bridge_ioctl_sifpvid(struct bridge_softc *sc, void *arg)
 {
        struct ifbreq *req = arg;
        struct bridge_iflist *bif;
@@ -1922,12 +1922,12 @@ bridge_ioctl_sifuntagged(struct bridge_softc *sc, void 
*arg)
        if (bif == NULL)
                return (EXTERROR(ENOENT, "Interface is not a bridge member"));
 
-       if (req->ifbr_untagged > DOT1Q_VID_MAX)
+       if (req->ifbr_pvid > DOT1Q_VID_MAX)
                return (EXTERROR(EINVAL, "Invalid VLAN ID"));
 
-       if (req->ifbr_untagged != DOT1Q_VID_NULL)
+       if (req->ifbr_pvid != DOT1Q_VID_NULL)
                bif->bif_flags |= IFBIF_VLANFILTER;
-       bif->bif_untagged = req->ifbr_untagged;
+       bif->bif_pvid = req->ifbr_pvid;
        return (0);
 }
 
@@ -2303,8 +2303,8 @@ bridge_enqueue(struct bridge_softc *sc, struct ifnet 
*dst_ifp, struct mbuf *m,
                 * the VLAN header.
                 */
                if ((bif->bif_flags & IFBIF_VLANFILTER) &&
-                   bif->bif_untagged != DOT1Q_VID_NULL &&
-                   VLANTAGOF(m) == bif->bif_untagged) {
+                   bif->bif_pvid != DOT1Q_VID_NULL &&
+                   VLANTAGOF(m) == bif->bif_pvid) {
                        m->m_flags &= ~M_VLANTAG;
                        m->m_pkthdr.ether_vtag = 0;
                }
@@ -3170,14 +3170,14 @@ bridge_vfilter_in(const struct bridge_iflist *sbif, 
struct mbuf *m)
                 * The frame doesn't have a tag.  If the interface does not
                 * have an untagged vlan configured, drop the frame.
                 */
-               if (sbif->bif_untagged == DOT1Q_VID_NULL)
+               if (sbif->bif_pvid == DOT1Q_VID_NULL)
                        return (false);
 
                /*
                 * Otherwise, insert a new tag based on the interface's
                 * untagged vlan id.
                 */
-               m->m_pkthdr.ether_vtag = sbif->bif_untagged;
+               m->m_pkthdr.ether_vtag = sbif->bif_pvid;
                m->m_flags |= M_VLANTAG;
        } else {
                /*
@@ -3238,7 +3238,7 @@ bridge_vfilter_out(const struct bridge_iflist *dbif, 
const struct mbuf *m)
         * If the frame's vlan matches the interfaces's untagged vlan,
         * allow it.
         */
-       if (vlan == dbif->bif_untagged)
+       if (vlan == dbif->bif_pvid)
                return (true);
 
        /*
diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h
index 97b63e3d4416..c458dcc152a0 100644
--- a/sys/net/if_bridgevar.h
+++ b/sys/net/if_bridgevar.h
@@ -124,7 +124,7 @@
 #define        BRDGSPROTO              28      /* set protocol (ifbrparam) */
 #define        BRDGSTXHC               29      /* set tx hold count 
(ifbrparam) */
 #define        BRDGSIFAMAX             30      /* set max interface addrs 
(ifbreq) */
-#define        BRDGSIFUNTAGGED         31      /* set if untagged vlan */
+#define        BRDGSIFPVID             31      /* set if PVID */
 #define        BRDGSIFVLANSET          32      /* set if vlan set */
 #define        BRDGGIFVLANSET          33      /* get if vlan set */
 
@@ -144,7 +144,7 @@ struct ifbreq {
        uint32_t        ifbr_addrcnt;           /* member if addr number */
        uint32_t        ifbr_addrmax;           /* member if addr max */
        uint32_t        ifbr_addrexceeded;      /* member if addr violations */
-       ether_vlanid_t  ifbr_untagged;          /* member if untagged vlan */
+       ether_vlanid_t  ifbr_pvid;              /* member if PVID */
        uint8_t         pad[32];
 };
 

Reply via email to