]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
iplink: bridge: support bridge port vlan_tunnel attribute
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Sat, 28 Oct 2017 05:13:49 +0000 (22:13 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 31 Oct 2017 17:04:30 +0000 (18:04 +0100)
This config maps to IFLA_BRPORT_VLAN_TUNNEL bridge port netlink
flag attribute. This flag enables vlan to tunnel mapping on a bridge
port. It is off by default.

set vlan_tunnel attribute on bridge port vxlan0:

$ip link set dev vxlan0 type bridge_slave vlan_tunnel on
$ip link set dev vxlan0 type bridge_slave vlan_tunnel off

or via bridge command

$bridge link set dev vxlan0 vlan_tunnel on
$bridge link set dev vxlan0 vlan_tunnel off

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
bridge/link.c
ip/iplink_bridge_slave.c
man/man8/bridge.8
man/man8/ip-link.8.in

index ae4bb884f52375a7450c3f00433603e358e948c5..65ca47e14922f967ba8d43bb580b02f7c30c3ea6 100644 (file)
@@ -201,6 +201,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
                                if (prtb[IFLA_BRPORT_NEIGH_SUPPRESS])
                                        print_onoff(fp, "neigh_suppress",
                                                    rta_getattr_u8(prtb[IFLA_BRPORT_NEIGH_SUPPRESS]));
+                               if (prtb[IFLA_BRPORT_VLAN_TUNNEL])
+                                       print_onoff(fp, "vlan_tunnel",
+                                                   rta_getattr_u8(prtb[IFLA_BRPORT_VLAN_TUNNEL]));
                        }
                } else
                        print_portstate(fp, rta_getattr_u8(tb[IFLA_PROTINFO]));
@@ -241,6 +244,8 @@ 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, "                               [ neigh_suppress {on | off} ]\n");
+       fprintf(stderr, "                               [ vlan_tunnel {on | off} ]\n");
        fprintf(stderr, "                               [ hwmode {vepa | veb} ]\n");
        fprintf(stderr, "                               [ self ] [ master ]\n");
        fprintf(stderr, "       bridge link show [dev DEV]\n");
@@ -280,6 +285,7 @@ static int brlink_modify(int argc, char **argv)
        __s8 learning = -1;
        __s8 learning_sync = -1;
        __s8 flood = -1;
+       __s8 vlan_tunnel = -1;
        __s8 mcast_flood = -1;
        __s8 hairpin = -1;
        __s8 bpdu_guard = -1;
@@ -371,6 +377,11 @@ static int brlink_modify(int argc, char **argv)
                        if (!on_off("neigh_suppress", &neigh_suppress,
                                    *argv))
                                return -1;
+               } else if (strcmp(*argv, "vlan_tunnel") == 0) {
+                       NEXT_ARG();
+                       if (!on_off("vlan_tunnel", &vlan_tunnel,
+                                   *argv))
+                               return -1;
                } else {
                        usage();
                }
@@ -426,6 +437,9 @@ static int brlink_modify(int argc, char **argv)
        if (neigh_suppress != -1)
                addattr8(&req.n, sizeof(req), IFLA_BRPORT_NEIGH_SUPPRESS,
                         neigh_suppress);
+       if (vlan_tunnel != -1)
+               addattr8(&req.n, sizeof(req), IFLA_BRPORT_VLAN_TUNNEL,
+                        vlan_tunnel);
 
        addattr_nest_end(&req.n, nest);
 
index 0d5a01145d9ee71c80e445917109d0f87e68882c..be0fb4fa34b701f255a307ea88e0aa4bbd5f338d 100644 (file)
@@ -39,6 +39,7 @@ static void print_explain(FILE *f)
                "                        [ mcast_flood {on | off} ]\n"
                "                        [ group_fwd_mask MASK ]\n"
                "                        [ neigh_suppress {on | off} ]\n"
+               "                        [ vlan_tunnel {on | off} ]\n"
        );
 }
 
@@ -283,6 +284,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
                print_string(PRINT_ANY, "group_fwd_mask_str",
                             "group_fwd_mask_str %s ", convbuf);
        }
+
+       if (tb[IFLA_BRPORT_VLAN_TUNNEL])
+               _print_onoff(f, "vlan_tunnel", "vlan_tunnel",
+                            rta_getattr_u8(tb[IFLA_BRPORT_VLAN_TUNNEL]));
 }
 
 static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
@@ -384,6 +389,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
                        if (get_u16(&mask, *argv, 0))
                                invarg("invalid group_fwd_mask", *argv);
                        addattr16(n, 1024, IFLA_BRPORT_GROUP_FWD_MASK, mask);
+               } else if (matches(*argv, "vlan_tunnel") == 0) {
+                       NEXT_ARG();
+                       bridge_slave_parse_on_off("vlan_tunnel", *argv, n,
+                                                 IFLA_BRPORT_VLAN_TUNNEL);
                } else if (matches(*argv, "help") == 0) {
                        explain();
                        return -1;
index fdba0fea239742c65bb998bbd23516dfcf6d78ce..d3c5b1e434b9f8cf8784bef5162d549b25d68e4c 100644 (file)
@@ -44,6 +44,8 @@ bridge \- show / manipulate bridge addresses and devices
 .BR flood " { " on " | " off " } ] [ "
 .BR hwmode " { " vepa " | " veb " } ] [ "
 .BR mcast_flood " { " on " | " off " } ] [ "
+.BR neigh_suppress " { " on " | " off " } ] [ "
+.BR vlan_tunnel " { " on " | " off " } ] [ "
 .BR self " ] [ " master " ]"
 
 .ti -8
@@ -326,6 +328,10 @@ Controls whether a given port will be flooded with multicast traffic for which t
 .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.
 
+.TP
+.BR "vlan_tunnel on " or " vlan_tunnel off "
+Controls whether vlan to tunnel mapping is enabled on the port. By default this flag is off.
+
 .TP
 .BI self
 link setting is configured on specified physical device
index a2b006a8ffb85ae601473772034bc53e151f8a64..0cd1cbd30e09aa8ef1c1469fae9e3cd01aa91266 100644 (file)
@@ -1751,6 +1751,8 @@ the following additional arguments are supported:
 .BR group_fwd_mask " MASK"
 ] [
 .BR neigh_suppress " { " on " | " off " } ]"
+] [
+.BR vlan_tunnel " { " on " | " off " } ]"
 
 .in +8
 .sp
@@ -1831,6 +1833,9 @@ option above.
 .BR neigh_suppress " { " on " | " off " }"
 - controls whether neigh discovery (arp and nd) proxy and suppression is enabled on the port. By default this flag is off.
 
+.BR vlan_tunnel " { " on " | " off " }"
+- Controls whether vlan to tunnel mapping is enabled on the port. By default this flag is off.
+
 .in -8
 
 .TP