The branch stable/14 has been updated by ivy:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8b728c63f777f3b2e220fe28fbe24b74f5a7c388

commit 8b728c63f777f3b2e220fe28fbe24b74f5a7c388
Author:     Lexi Winter <i...@freebsd.org>
AuthorDate: 2025-07-28 14:09:29 +0000
Commit:     Lexi Winter <i...@freebsd.org>
CommitDate: 2025-08-23 00:10:15 +0000

    ifconfig/ifbridge.c: add get_vlan_id()
    
    This is like get_val() but takes an ether_vlanid_t* and ensures the
    value is a valid VLAN ID. This avoids redundant comparisons and
    casting when parsing VLAN IDs.
    
    Reviewed by:    des
    Differential Revision:  https://reviews.freebsd.org/D51548
    
    (cherry picked from commit 287a5fdcd3c941ce73705c664b5df4932ba3bad4)
---
 sbin/ifconfig/ifbridge.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
index 2d0af1255a73..973c4f9cfe6e 100644
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -79,6 +79,20 @@ get_val(const char *cp, u_long *valp)
        return (0);
 }
 
+static int
+get_vlan_id(const char *cp, ether_vlanid_t *valp)
+{
+       u_long val;
+
+       if (get_val(cp, &val) == -1)
+               return (-1);
+       if (val < 0x1 || val > 0xffe)
+               return (-1);
+
+       *valp = (ether_vlanid_t)val;
+       return (0);
+}
+
 static int
 do_cmd(if_ctx *ctx, u_long op, void *arg, size_t argsize, int set)
 {

Reply via email to