* [PATCH iproute2 0/5] bridge: complete port netlink support
@ 2016-02-16 15:08 Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 1/5] iplink: bridge_slave: export read-only values Nikolay Aleksandrov
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2016-02-16 15:08 UTC (permalink / raw)
To: netdev; +Cc: roopa, stephen, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Hi,
This small set completes the port netlink support for iproute2 and allows
to view and set all the available netlink port attributes.
Cheers,
Nik
Nikolay Aleksandrov (5):
iplink: bridge_slave: export read-only values
iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP
iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI
iplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER
iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE
ip/ip_common.h | 2 +
ip/iplink_bridge.c | 3 +-
ip/iplink_bridge_slave.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 112 insertions(+), 2 deletions(-)
--
2.4.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH iproute2 1/5] iplink: bridge_slave: export read-only values
2016-02-16 15:08 [PATCH iproute2 0/5] bridge: complete port netlink support Nikolay Aleksandrov
@ 2016-02-16 15:08 ` Nikolay Aleksandrov
2016-02-18 1:52 ` Stephen Hemminger
2016-02-16 15:08 ` [PATCH iproute2 2/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP Nikolay Aleksandrov
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Nikolay Aleksandrov @ 2016-02-16 15:08 UTC (permalink / raw)
To: netdev; +Cc: roopa, stephen, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Export all the read-only values that get returned about a bridge port
such as the timers, the ids, designated_port and cost,
topology_change_ack and config_pending. For the bridge ids the
br_dump_bridge_id function is exported from iplink_bridge.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
ip/ip_common.h | 2 ++
ip/iplink_bridge.c | 3 +--
ip/iplink_bridge_slave.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/ip/ip_common.h b/ip/ip_common.h
index 9a846df348fe..815487a07b8a 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -87,6 +87,8 @@ struct link_util
struct link_util *get_link_kind(const char *kind);
struct link_util *get_link_slave_kind(const char *slave_kind);
+void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
+
#ifndef INFINITY_LIFE_TIME
#define INFINITY_LIFE_TIME 0xFFFFFFFFU
#endif
diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 1b666f0adef4..79f15eff7c39 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -60,8 +60,7 @@ static void explain(void)
print_explain(stderr);
}
-static void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf,
- size_t len)
+void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len)
{
char eaddr[32];
diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c
index 4593872ecd84..c58f55294261 100644
--- a/ip/iplink_bridge_slave.c
+++ b/ip/iplink_bridge_slave.c
@@ -98,6 +98,76 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
if (tb[IFLA_BRPORT_UNICAST_FLOOD])
print_onoff(f, "flood",
rta_getattr_u8(tb[IFLA_BRPORT_UNICAST_FLOOD]));
+
+ if (tb[IFLA_BRPORT_ID])
+ fprintf(f, "port_id 0x%x ",
+ rta_getattr_u16(tb[IFLA_BRPORT_ID]));
+
+ if (tb[IFLA_BRPORT_NO])
+ fprintf(f, "port_no 0x%x ",
+ rta_getattr_u16(tb[IFLA_BRPORT_NO]));
+
+ if (tb[IFLA_BRPORT_DESIGNATED_PORT])
+ fprintf(f, "designated_port %u ",
+ rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_PORT]));
+
+ if (tb[IFLA_BRPORT_DESIGNATED_COST])
+ fprintf(f, "designated_cost %u ",
+ rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_COST]));
+
+ if (tb[IFLA_BRPORT_BRIDGE_ID]) {
+ char bridge_id[32];
+
+ br_dump_bridge_id(RTA_DATA(tb[IFLA_BRPORT_BRIDGE_ID]),
+ bridge_id, sizeof(bridge_id));
+ fprintf(f, "designated_bridge %s ", bridge_id);
+ }
+
+ if (tb[IFLA_BRPORT_ROOT_ID]) {
+ char root_id[32];
+
+ br_dump_bridge_id(RTA_DATA(tb[IFLA_BRPORT_ROOT_ID]),
+ root_id, sizeof(root_id));
+ fprintf(f, "designated_root %s ", root_id);
+ }
+
+ if (tb[IFLA_BRPORT_HOLD_TIMER]) {
+ struct timeval tv;
+ __u64 htimer;
+
+ htimer = rta_getattr_u64(tb[IFLA_BRPORT_HOLD_TIMER]);
+ __jiffies_to_tv(&tv, htimer);
+ fprintf(f, "hold_timer %4i.%.2i ", (int)tv.tv_sec,
+ (int)tv.tv_usec/10000);
+ }
+
+ if (tb[IFLA_BRPORT_MESSAGE_AGE_TIMER]) {
+ struct timeval tv;
+ __u64 agetimer;
+
+ agetimer = rta_getattr_u64(tb[IFLA_BRPORT_MESSAGE_AGE_TIMER]);
+ __jiffies_to_tv(&tv, agetimer);
+ fprintf(f, "message_age_timer %4i.%.2i ", (int)tv.tv_sec,
+ (int)tv.tv_usec/10000);
+ }
+
+ if (tb[IFLA_BRPORT_FORWARD_DELAY_TIMER]) {
+ struct timeval tv;
+ __u64 fwdtimer;
+
+ fwdtimer = rta_getattr_u64(tb[IFLA_BRPORT_FORWARD_DELAY_TIMER]);
+ __jiffies_to_tv(&tv, fwdtimer);
+ fprintf(f, "forward_delay_timer %4i.%.2i ", (int)tv.tv_sec,
+ (int)tv.tv_usec/10000);
+ }
+
+ if (tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK])
+ fprintf(f, "topology_change_ack %u ",
+ rta_getattr_u8(tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK]));
+
+ if (tb[IFLA_BRPORT_CONFIG_PENDING])
+ fprintf(f, "config_pending %u ",
+ rta_getattr_u8(tb[IFLA_BRPORT_CONFIG_PENDING]));
}
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH iproute2 2/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP
2016-02-16 15:08 [PATCH iproute2 0/5] bridge: complete port netlink support Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 1/5] iplink: bridge_slave: export read-only values Nikolay Aleksandrov
@ 2016-02-16 15:08 ` Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 3/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI Nikolay Aleksandrov
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2016-02-16 15:08 UTC (permalink / raw)
To: netdev; +Cc: roopa, stephen, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Add support to be able to view and change IFLA_BRPORT_PROXYARP port
attribute.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
ip/iplink_bridge_slave.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c
index c58f55294261..c27d71837a2f 100644
--- a/ip/iplink_bridge_slave.c
+++ b/ip/iplink_bridge_slave.c
@@ -29,6 +29,7 @@ static void print_explain(FILE *f)
" [ root_block {on | off} ]\n"
" [ learning {on | off} ]\n"
" [ flood {on | off} ]\n"
+ " [ proxy_arp {on | off} ]\n"
);
}
@@ -168,6 +169,9 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
if (tb[IFLA_BRPORT_CONFIG_PENDING])
fprintf(f, "config_pending %u ",
rta_getattr_u8(tb[IFLA_BRPORT_CONFIG_PENDING]));
+ if (tb[IFLA_BRPORT_PROXYARP])
+ print_onoff(f, "proxy_arp",
+ rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP]));
}
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
@@ -232,6 +236,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
NEXT_ARG();
bridge_slave_parse_on_off("flood", *argv, n,
IFLA_BRPORT_UNICAST_FLOOD);
+ } else if (matches(*argv, "proxy_arp") == 0) {
+ NEXT_ARG();
+ bridge_slave_parse_on_off("proxy_arp", *argv, n,
+ IFLA_BRPORT_PROXYARP);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH iproute2 3/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI
2016-02-16 15:08 [PATCH iproute2 0/5] bridge: complete port netlink support Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 1/5] iplink: bridge_slave: export read-only values Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 2/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP Nikolay Aleksandrov
@ 2016-02-16 15:08 ` Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 4/5] iplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 5/5] iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE Nikolay Aleksandrov
4 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2016-02-16 15:08 UTC (permalink / raw)
To: netdev; +Cc: roopa, stephen, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Add support to be able to view and change IFLA_BRPORT_PROXYARP_WIFI port
attribute.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
ip/iplink_bridge_slave.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c
index c27d71837a2f..68d140894529 100644
--- a/ip/iplink_bridge_slave.c
+++ b/ip/iplink_bridge_slave.c
@@ -30,6 +30,7 @@ static void print_explain(FILE *f)
" [ learning {on | off} ]\n"
" [ flood {on | off} ]\n"
" [ proxy_arp {on | off} ]\n"
+ " [ proxy_arp_wifi {on | off} ]\n"
);
}
@@ -172,6 +173,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
if (tb[IFLA_BRPORT_PROXYARP])
print_onoff(f, "proxy_arp",
rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP]));
+
+ if (tb[IFLA_BRPORT_PROXYARP_WIFI])
+ print_onoff(f, "proxy_arp_wifi",
+ rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP_WIFI]));
}
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
@@ -240,6 +245,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
NEXT_ARG();
bridge_slave_parse_on_off("proxy_arp", *argv, n,
IFLA_BRPORT_PROXYARP);
+ } else if (matches(*argv, "proxy_arp_wifi") == 0) {
+ NEXT_ARG();
+ bridge_slave_parse_on_off("proxy_arp_wifi", *argv, n,
+ IFLA_BRPORT_PROXYARP_WIFI);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH iproute2 4/5] iplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER
2016-02-16 15:08 [PATCH iproute2 0/5] bridge: complete port netlink support Nikolay Aleksandrov
` (2 preceding siblings ...)
2016-02-16 15:08 ` [PATCH iproute2 3/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI Nikolay Aleksandrov
@ 2016-02-16 15:08 ` Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 5/5] iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE Nikolay Aleksandrov
4 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2016-02-16 15:08 UTC (permalink / raw)
To: netdev; +Cc: roopa, stephen, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Add support to be able to view and change IFLA_BRPORT_MULTICAST_ROUTER port
attribute.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
ip/iplink_bridge_slave.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c
index 68d140894529..16b364f6bdce 100644
--- a/ip/iplink_bridge_slave.c
+++ b/ip/iplink_bridge_slave.c
@@ -31,6 +31,7 @@ static void print_explain(FILE *f)
" [ flood {on | off} ]\n"
" [ proxy_arp {on | off} ]\n"
" [ proxy_arp_wifi {on | off} ]\n"
+ " [ mcast_router MULTICAST_ROUTER ]\n"
);
}
@@ -177,6 +178,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
if (tb[IFLA_BRPORT_PROXYARP_WIFI])
print_onoff(f, "proxy_arp_wifi",
rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP_WIFI]));
+
+ if (tb[IFLA_BRPORT_MULTICAST_ROUTER])
+ fprintf(f, "mcast_router %u ",
+ rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER]));
}
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
@@ -249,6 +254,14 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
NEXT_ARG();
bridge_slave_parse_on_off("proxy_arp_wifi", *argv, n,
IFLA_BRPORT_PROXYARP_WIFI);
+ } else if (matches(*argv, "mcast_router") == 0) {
+ __u8 mcast_router;
+
+ NEXT_ARG();
+ if (get_u8(&mcast_router, *argv, 0))
+ invarg("invalid mcast_router", *argv);
+ addattr8(n, 1024, IFLA_BRPORT_MULTICAST_ROUTER,
+ mcast_router);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH iproute2 5/5] iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE
2016-02-16 15:08 [PATCH iproute2 0/5] bridge: complete port netlink support Nikolay Aleksandrov
` (3 preceding siblings ...)
2016-02-16 15:08 ` [PATCH iproute2 4/5] iplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER Nikolay Aleksandrov
@ 2016-02-16 15:08 ` Nikolay Aleksandrov
4 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2016-02-16 15:08 UTC (permalink / raw)
To: netdev; +Cc: roopa, stephen, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Add support to be able to view and change IFLA_BRPORT_FAST_LEAVE
port attribute.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
ip/iplink_bridge_slave.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c
index 16b364f6bdce..3ec2bba72224 100644
--- a/ip/iplink_bridge_slave.c
+++ b/ip/iplink_bridge_slave.c
@@ -32,6 +32,7 @@ static void print_explain(FILE *f)
" [ proxy_arp {on | off} ]\n"
" [ proxy_arp_wifi {on | off} ]\n"
" [ mcast_router MULTICAST_ROUTER ]\n"
+ " [ mcast_fast_leave {on | off} ]\n"
);
}
@@ -182,6 +183,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
if (tb[IFLA_BRPORT_MULTICAST_ROUTER])
fprintf(f, "mcast_router %u ",
rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER]));
+
+ if (tb[IFLA_BRPORT_FAST_LEAVE])
+ print_onoff(f, "mcast_fast_leave",
+ rta_getattr_u8(tb[IFLA_BRPORT_FAST_LEAVE]));
}
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
@@ -262,6 +267,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
invarg("invalid mcast_router", *argv);
addattr8(n, 1024, IFLA_BRPORT_MULTICAST_ROUTER,
mcast_router);
+ } else if (matches(*argv, "mcast_fast_leave") == 0) {
+ NEXT_ARG();
+ bridge_slave_parse_on_off("mcast_fast_leave", *argv, n,
+ IFLA_BRPORT_FAST_LEAVE);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH iproute2 1/5] iplink: bridge_slave: export read-only values
2016-02-16 15:08 ` [PATCH iproute2 1/5] iplink: bridge_slave: export read-only values Nikolay Aleksandrov
@ 2016-02-18 1:52 ` Stephen Hemminger
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2016-02-18 1:52 UTC (permalink / raw)
To: Nikolay Aleksandrov; +Cc: netdev, roopa, Nikolay Aleksandrov
On Tue, 16 Feb 2016 16:08:51 +0100
Nikolay Aleksandrov <razor@blackwall.org> wrote:
> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>
> Export all the read-only values that get returned about a bridge port
> such as the timers, the ids, designated_port and cost,
> topology_change_ack and config_pending. For the bridge ids the
> br_dump_bridge_id function is exported from iplink_bridge.
>
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> ---
Applied the series.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-18 1:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16 15:08 [PATCH iproute2 0/5] bridge: complete port netlink support Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 1/5] iplink: bridge_slave: export read-only values Nikolay Aleksandrov
2016-02-18 1:52 ` Stephen Hemminger
2016-02-16 15:08 ` [PATCH iproute2 2/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 3/5] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 4/5] iplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER Nikolay Aleksandrov
2016-02-16 15:08 ` [PATCH iproute2 5/5] iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE Nikolay Aleksandrov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.