]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ip: bridge: add mcast to unicast config flag
authorTobias Jungel <tobias.jungel@bisdn.de>
Thu, 21 Mar 2019 08:32:39 +0000 (09:32 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 22 Mar 2019 16:44:49 +0000 (09:44 -0700)
This adds configuration for the IFLA_BRPORT_MCAST_TO_UCAST flag that
allows multicast packets to be replicated as unicast packets.

Signed-off-by: Tobias Jungel <tobias.jungel@bisdn.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
bridge/link.c
ip/iplink_bridge_slave.c
man/man8/bridge.8
man/man8/ip-link.8.in

index 32317e53b0361a96c8d817b74d0fe45ed6cb150f..04cfc1445833ee882c4338b2755465d34321af15 100644 (file)
@@ -146,6 +146,9 @@ static void print_protinfo(FILE *fp, struct rtattr *attr)
                if (prtb[IFLA_BRPORT_MCAST_FLOOD])
                        print_onoff(fp, "mcast_flood",
                                    rta_getattr_u8(prtb[IFLA_BRPORT_MCAST_FLOOD]));
+               if (prtb[IFLA_BRPORT_MCAST_TO_UCAST])
+                       print_onoff(fp, "mcast_to_unicast",
+                                   rta_getattr_u8(prtb[IFLA_BRPORT_MCAST_TO_UCAST]));
                if (prtb[IFLA_BRPORT_NEIGH_SUPPRESS])
                        print_onoff(fp, "neigh_suppress",
                                    rta_getattr_u8(prtb[IFLA_BRPORT_NEIGH_SUPPRESS]));
@@ -260,6 +263,7 @@ static void usage(void)
        fprintf(stderr, "                               [ learning_sync {on | off} ]\n");
        fprintf(stderr, "                               [ flood {on | off} ]\n");
        fprintf(stderr, "                               [ mcast_flood {on | off} ]\n");
+       fprintf(stderr, "                               [ mcast_to_unicast {on | off} ]\n");
        fprintf(stderr, "                               [ neigh_suppress {on | off} ]\n");
        fprintf(stderr, "                               [ vlan_tunnel {on | off} ]\n");
        fprintf(stderr, "                               [ isolated {on | off} ]\n");
@@ -306,6 +310,7 @@ static int brlink_modify(int argc, char **argv)
        __s8 flood = -1;
        __s8 vlan_tunnel = -1;
        __s8 mcast_flood = -1;
+       __s8 mcast_to_unicast = -1;
        __s8 isolated = -1;
        __s8 hairpin = -1;
        __s8 bpdu_guard = -1;
@@ -354,6 +359,10 @@ static int brlink_modify(int argc, char **argv)
                        NEXT_ARG();
                        if (!on_off("mcast_flood", &mcast_flood, *argv))
                                return -1;
+               } else if (strcmp(*argv, "mcast_to_unicast") == 0) {
+                       NEXT_ARG();
+                       if (!on_off("mcast_to_unicast", &mcast_to_unicast, *argv))
+                               return -1;
                } else if (strcmp(*argv, "cost") == 0) {
                        NEXT_ARG();
                        cost = atoi(*argv);
@@ -453,6 +462,9 @@ static int brlink_modify(int argc, char **argv)
        if (mcast_flood >= 0)
                addattr8(&req.n, sizeof(req), IFLA_BRPORT_MCAST_FLOOD,
                         mcast_flood);
+       if (mcast_to_unicast >= 0)
+               addattr8(&req.n, sizeof(req), IFLA_BRPORT_MCAST_TO_UCAST,
+                        mcast_to_unicast);
        if (learning >= 0)
                addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning);
        if (learning_sync >= 0)
index 85e6b424315fd3fc7dbc6e568335c27a93c3ee7b..ae9d15fcf5065ddb97e15bd7f516081ff1f2c37a 100644 (file)
@@ -37,6 +37,7 @@ static void print_explain(FILE *f)
                "                        [ mcast_router MULTICAST_ROUTER ]\n"
                "                        [ mcast_fast_leave {on | off} ]\n"
                "                        [ mcast_flood {on | off} ]\n"
+               "                        [ mcast_to_unicast {on | off} ]\n"
                "                        [ group_fwd_mask MASK ]\n"
                "                        [ neigh_suppress {on | off} ]\n"
                "                        [ vlan_tunnel {on | off} ]\n"
@@ -257,6 +258,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
                _print_onoff(f, "mcast_flood", "mcast_flood",
                             rta_getattr_u8(tb[IFLA_BRPORT_MCAST_FLOOD]));
 
+       if (tb[IFLA_BRPORT_MCAST_TO_UCAST])
+               _print_onoff(f, "mcast_to_unicast", "mcast_to_unicast",
+                            rta_getattr_u8(tb[IFLA_BRPORT_MCAST_TO_UCAST]));
+
        if (tb[IFLA_BRPORT_NEIGH_SUPPRESS])
                _print_onoff(f, "neigh_suppress", "neigh_suppress",
                             rta_getattr_u8(tb[IFLA_BRPORT_NEIGH_SUPPRESS]));
@@ -357,6 +362,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
                        NEXT_ARG();
                        bridge_slave_parse_on_off("mcast_flood", *argv, n,
                                                  IFLA_BRPORT_MCAST_FLOOD);
+               } else if (matches(*argv, "mcast_to_unicast") == 0) {
+                       NEXT_ARG();
+                       bridge_slave_parse_on_off("mcast_to_unicast", *argv, n,
+                                                 IFLA_BRPORT_MCAST_TO_UCAST);
                } else if (matches(*argv, "proxy_arp") == 0) {
                        NEXT_ARG();
                        bridge_slave_parse_on_off("proxy_arp", *argv, n,
index c9af20e8cdbc53901ee176e27bc8abddd43a10ab..06e3fdb3f9b1706d89e874bd3d2a2be57374445f 100644 (file)
@@ -47,6 +47,7 @@ bridge \- show / manipulate bridge addresses and devices
 .BR flood " { " on " | " off " } ] [ "
 .BR hwmode " { " vepa " | " veb " } ] [ "
 .BR mcast_flood " { " on " | " off " } ] [ "
+.BR mcast_to_unicast " { " on " | " off " } ] [ "
 .BR neigh_suppress " { " on " | " off " } ] [ "
 .BR vlan_tunnel " { " on " | " off " } ] [ "
 .BR isolated " { " on " | " off " } ] [ "
@@ -365,6 +366,10 @@ switch.
 .BR "mcast_flood on " or " mcast_flood off "
 Controls whether a given port will flood multicast traffic for which there is no MDB entry. By default this flag is on.
 
+.TP
+.BR "mcast_to_unicast on " or " mcast_to_unicast off "
+Controls whether a given port will replicate packets using unicast instead of multicast. By default this flag is off.
+
 .TP
 .BR "neigh_suppress on " or " neigh_suppress off "
 Controls whether neigh discovery (arp and nd) proxy and suppression is enabled on the port. By default this flag is off.
index 6f31453cbd0ecdd75801a407569782335fff6431..716421f4c594e63a7d8a197612de53880380b785 100644 (file)
@@ -2100,6 +2100,8 @@ the following additional arguments are supported:
 ] [
 .BR mcast_flood " { " on " | " off " }"
 ] [
+.BR mcast_to_unicast " { " on " | " off " }"
+] [
 .BR group_fwd_mask " MASK"
 ] [
 .BR neigh_suppress " { " on " | " off " }"
@@ -2185,6 +2187,9 @@ option above.
 .BR mcast_flood " { " on " | " off " }"
 - controls whether a given port will flood multicast traffic for which there is no MDB entry.
 
+.BR mcast_to_unicast " { " on " | " off " }"
+- controls whether a given port will replicate packets using unicast instead of multicast. By default this flag is off.
+
 .BI group_fwd_mask " MASK "
 - set the group forward mask. This is the bitmask that is applied to decide whether to forward incoming frames destined to link-local addresses, ie addresses of the form 01:80:C2:00:00:0X (defaults to 0, ie the bridge does not forward any link-local frames coming on this port).