Blob Blame History Raw
From 070419b6c1eec0a88a464bcfcd8a3a3755f19ffc Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Tue, 28 Feb 2017 16:12:00 +0100
Subject: [PATCH] iplink: bridge: add support for IFLA_BR_GROUP_ADDR

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
Upstream Status: iproute2.git commit 0a61aa3963e25

commit 0a61aa3963e25a32e82cad8cdd04f31532ec5b3f
Author: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date:   Tue Feb 9 00:14:23 2016 +0100

    iplink: bridge: add support for IFLA_BR_GROUP_ADDR

    This patch implements support for the IFLA_BR_GROUP_ADDR attribute
    in iproute2 so it can change the group address.

    Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
 ip/iplink_bridge.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 77d4ee1..6ef6c4b 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -29,6 +29,7 @@ static void print_explain(FILE *f)
 		"                  [ stp_state STP_STATE ]\n"
 		"                  [ priority PRIORITY ]\n"
 		"                  [ group_fwd_mask MASK ]\n"
+		"                  [ group_address ADDRESS ]\n"
 		"                  [ vlan_filtering VLAN_FILTERING ]\n"
 		"                  [ vlan_protocol VLAN_PROTOCOL ]\n"
 		"\n"
@@ -126,6 +127,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 				invarg("invalid group_fwd_mask", *argv);
 
 			addattr16(n, 1024, IFLA_BR_GROUP_FWD_MASK, fwd_mask);
+		} else if (matches(*argv, "group_address") == 0) {
+			char llabuf[32];
+			int len;
+
+			NEXT_ARG();
+			len = ll_addr_a2n(llabuf, sizeof(llabuf), *argv);
+			if (len < 0)
+				return -1;
+			addattr_l(n, 1024, IFLA_BR_GROUP_ADDR, llabuf, len);
 		} else if (matches(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -250,6 +260,15 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 	if (tb[IFLA_BR_GROUP_FWD_MASK])
 		fprintf(f, "group_fwd_mask %#x ",
 			rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK]));
+
+	if (tb[IFLA_BR_GROUP_ADDR]) {
+		SPRINT_BUF(mac);
+
+		fprintf(f, "group_address %s ",
+			ll_addr_n2a(RTA_DATA(tb[IFLA_BR_GROUP_ADDR]),
+				    RTA_PAYLOAD(tb[IFLA_BR_GROUP_ADDR]),
+				    1 /*ARPHDR_ETHER*/, mac, sizeof(mac)));
+	}
 }
 
 static void bridge_print_help(struct link_util *lu, int argc, char **argv,
-- 
1.8.3.1