]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
bridge: support for controlling mcast_router per port
authorJoachim Wiberg <troglobit@gmail.com>
Wed, 16 Mar 2022 09:02:56 +0000 (10:02 +0100)
committerDavid Ahern <dsahern@kernel.org>
Sun, 20 Mar 2022 23:36:05 +0000 (17:36 -0600)
The bridge vlan command supports setting mcast_router per-port and
per-vlan, what's however missing is the ability to set the per-port
mcast_router options, e.g. when VLAN filtering is disabled.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
bridge/link.c

index 80b01f5636fe6d48ccc730d465376929509173f1..3810fa045d12698491aa8ba902aa628049811fde 100644 (file)
@@ -156,6 +156,9 @@ static void print_protinfo(FILE *fp, struct rtattr *attr)
                if (prtb[IFLA_BRPORT_BCAST_FLOOD])
                        print_on_off(PRINT_ANY, "bcast_flood", "bcast_flood %s ",
                                     rta_getattr_u8(prtb[IFLA_BRPORT_BCAST_FLOOD]));
+               if (prtb[IFLA_BRPORT_MULTICAST_ROUTER])
+                       print_uint(PRINT_ANY, "mcast_router", "mcast_router %u ",
+                                  rta_getattr_u8(prtb[IFLA_BRPORT_MULTICAST_ROUTER]));
                if (prtb[IFLA_BRPORT_MCAST_TO_UCAST])
                        print_on_off(PRINT_ANY, "mcast_to_unicast", "mcast_to_unicast %s ",
                                     rta_getattr_u8(prtb[IFLA_BRPORT_MCAST_TO_UCAST]));
@@ -270,6 +273,7 @@ static void usage(void)
                "                               [ learning {on | off} ]\n"
                "                               [ learning_sync {on | off} ]\n"
                "                               [ flood {on | off} ]\n"
+               "                               [ mcast_router MULTICAST_ROUTER ]\n"
                "                               [ mcast_flood {on | off} ]\n"
                "                               [ bcast_flood {on | off} ]\n"
                "                               [ mcast_to_unicast {on | off} ]\n"
@@ -303,6 +307,7 @@ static int brlink_modify(int argc, char **argv)
        __s8 learning_sync = -1;
        __s8 flood = -1;
        __s8 vlan_tunnel = -1;
+       __s8 mcast_router = -1;
        __s8 mcast_flood = -1;
        __s8 bcast_flood = -1;
        __s8 mcast_to_unicast = -1;
@@ -359,6 +364,9 @@ static int brlink_modify(int argc, char **argv)
                        flood = parse_on_off("flood", *argv, &ret);
                        if (ret)
                                return ret;
+               } else if (strcmp(*argv, "mcast_router") == 0) {
+                       NEXT_ARG();
+                       mcast_router = atoi(*argv);
                } else if (strcmp(*argv, "mcast_flood") == 0) {
                        NEXT_ARG();
                        mcast_flood = parse_on_off("mcast_flood", *argv, &ret);
@@ -473,6 +481,9 @@ static int brlink_modify(int argc, char **argv)
                addattr8(&req.n, sizeof(req), IFLA_BRPORT_PROTECT, root_block);
        if (flood >= 0)
                addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood);
+       if (mcast_router >= 0)
+               addattr8(&req.n, sizeof(req), IFLA_BRPORT_MULTICAST_ROUTER,
+                        mcast_router);
        if (mcast_flood >= 0)
                addattr8(&req.n, sizeof(req), IFLA_BRPORT_MCAST_FLOOD,
                         mcast_flood);