|
|
4aca6e |
From 3072b81b5f71121d587679f5644ccab0ed71da09 Mon Sep 17 00:00:00 2001
|
|
|
4aca6e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
4aca6e |
Date: Tue, 28 Feb 2017 16:11:51 +0100
|
|
|
4aca6e |
Subject: [PATCH] iplink: Add support for IFLA_BR_VLAN_PROTOCOL attribute
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
|
|
|
4aca6e |
Upstream Status: iproute2.git commit 1eea5c46ec59d
|
|
|
4aca6e |
|
|
|
4aca6e |
commit 1eea5c46ec59d732d47df7f2be1e84fa534f9ce5
|
|
|
4aca6e |
Author: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
|
|
|
4aca6e |
Date: Mon Aug 31 18:48:46 2015 +0900
|
|
|
4aca6e |
|
|
|
4aca6e |
iplink: Add support for IFLA_BR_VLAN_PROTOCOL attribute
|
|
|
4aca6e |
|
|
|
4aca6e |
This patch adds support for bridge vlan_protocol.
|
|
|
4aca6e |
|
|
|
4aca6e |
Example:
|
|
|
4aca6e |
$ ip link set br0 type bridge vlan_protocol 802.1ad
|
|
|
4aca6e |
$ ip -d link show br0
|
|
|
4aca6e |
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
|
|
|
4aca6e |
UP mode DEFAULT group default qlen 1000
|
|
|
4aca6e |
link/ether 44:37:e6:ab:cd:ef brd ff:ff:ff:ff:ff:ff promiscuity 0
|
|
|
4aca6e |
bridge forward_delay 0 hello_time 200 max_age 2000 ageing_time 30000
|
|
|
4aca6e |
stp_state 0 priority 32768 vlan_filtering 0 vlan_protocol 802.1ad
|
|
|
4aca6e |
addrgenmode eui64
|
|
|
4aca6e |
|
|
|
4aca6e |
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
|
|
|
4aca6e |
---
|
|
|
4aca6e |
ip/iplink_bridge.c | 21 +++++++++++++++++++++
|
|
|
4aca6e |
1 file changed, 21 insertions(+)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
|
|
|
4aca6e |
index a8bc840..1c71f2e 100644
|
|
|
4aca6e |
--- a/ip/iplink_bridge.c
|
|
|
4aca6e |
+++ b/ip/iplink_bridge.c
|
|
|
4aca6e |
@@ -14,6 +14,7 @@
|
|
|
4aca6e |
#include <string.h>
|
|
|
4aca6e |
#include <linux/if_link.h>
|
|
|
4aca6e |
|
|
|
4aca6e |
+#include "rt_names.h"
|
|
|
4aca6e |
#include "utils.h"
|
|
|
4aca6e |
#include "ip_common.h"
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -27,6 +28,9 @@ static void print_explain(FILE *f)
|
|
|
4aca6e |
" [ stp_state STP_STATE ]\n"
|
|
|
4aca6e |
" [ priority PRIORITY ]\n"
|
|
|
4aca6e |
" [ vlan_filtering VLAN_FILTERING ]\n"
|
|
|
4aca6e |
+ " [ vlan_protocol VLAN_PROTOCOL ]\n"
|
|
|
4aca6e |
+ "\n"
|
|
|
4aca6e |
+ "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n"
|
|
|
4aca6e |
);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -94,6 +98,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
addattr8(n, 1024, IFLA_BR_VLAN_FILTERING, vlan_filter);
|
|
|
4aca6e |
+ } else if (matches(*argv, "vlan_protocol") == 0) {
|
|
|
4aca6e |
+ __u16 vlan_proto;
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ NEXT_ARG();
|
|
|
4aca6e |
+ if (ll_proto_a2n(&vlan_proto, *argv)) {
|
|
|
4aca6e |
+ invarg("invalid vlan_protocol", *argv);
|
|
|
4aca6e |
+ return -1;
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
+ addattr16(n, 1024, IFLA_BR_VLAN_PROTOCOL, vlan_proto);
|
|
|
4aca6e |
} else if (matches(*argv, "help") == 0) {
|
|
|
4aca6e |
explain();
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
@@ -140,6 +153,14 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|
|
4aca6e |
if (tb[IFLA_BR_VLAN_FILTERING])
|
|
|
4aca6e |
fprintf(f, "vlan_filtering %u ",
|
|
|
4aca6e |
rta_getattr_u8(tb[IFLA_BR_VLAN_FILTERING]));
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ if (tb[IFLA_BR_VLAN_PROTOCOL]) {
|
|
|
4aca6e |
+ SPRINT_BUF(b1);
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ fprintf(f, "vlan_protocol %s ",
|
|
|
4aca6e |
+ ll_proto_n2a(rta_getattr_u16(tb[IFLA_BR_VLAN_PROTOCOL]),
|
|
|
4aca6e |
+ b1, sizeof(b1)));
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
static void bridge_print_help(struct link_util *lu, int argc, char **argv,
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|