]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: iplink_bridge_slave: add locked port flag support
authorHans Schultz <schultz.hans@gmail.com>
Mon, 28 Feb 2022 13:36:48 +0000 (14:36 +0100)
committerDavid Ahern <dsahern@kernel.org>
Fri, 4 Mar 2022 16:15:50 +0000 (09:15 -0700)
Syntax: ip link set dev DEV type bridge_slave locked {on | off}

Signed-off-by: Hans Schultz <schultz.hans+netdev@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/iplink_bridge_slave.c

index 717875864b18ba73320bce3fc66e1849f9bc3940..da14a95eb4ed0c968eeacf6963ce4e87ca468bcb 100644 (file)
@@ -42,6 +42,7 @@ static void print_explain(FILE *f)
                "                       [ neigh_suppress {on | off} ]\n"
                "                       [ vlan_tunnel {on | off} ]\n"
                "                       [ isolated {on | off} ]\n"
+               "                       [ locked {on | off} ]\n"
                "                       [ backup_port DEVICE ] [ nobackup_port ]\n"
        );
 }
@@ -278,6 +279,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
                print_on_off(PRINT_ANY, "isolated", "isolated %s ",
                             rta_getattr_u8(tb[IFLA_BRPORT_ISOLATED]));
 
+       if (tb[IFLA_BRPORT_LOCKED])
+               print_on_off(PRINT_ANY, "locked", "locked %s ",
+                            rta_getattr_u8(tb[IFLA_BRPORT_LOCKED]));
+
        if (tb[IFLA_BRPORT_BACKUP_PORT]) {
                int backup_p = rta_getattr_u32(tb[IFLA_BRPORT_BACKUP_PORT]);
 
@@ -393,6 +398,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
                        NEXT_ARG();
                        bridge_slave_parse_on_off("isolated", *argv, n,
                                                  IFLA_BRPORT_ISOLATED);
+               } else if (matches(*argv, "locked") == 0) {
+                       NEXT_ARG();
+                       bridge_slave_parse_on_off("locked", *argv, n,
+                                                 IFLA_BRPORT_LOCKED);
                } else if (matches(*argv, "backup_port") == 0) {
                        int ifindex;