* [PATCH iproute2-next] bridge: vlan: dump port only if there are any vlans
@ 2021-04-23 11:52 Nikolay Aleksandrov
2021-04-23 11:54 ` Nikolay Aleksandrov
2021-04-23 12:10 ` [PATCH iproute2-next v2] " Nikolay Aleksandrov
0 siblings, 2 replies; 4+ messages in thread
From: Nikolay Aleksandrov @ 2021-04-23 11:52 UTC (permalink / raw)
To: netdev; +Cc: dsahern, roopa, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@nvidia.com>
When I added support for new vlan rtm dumping, I made a mistake in the
output format when there are no vlans on the port. This patch fixes it by
not printing ports without vlan entries (similar to current situation).
Fixes: e5f87c834193 ("bridge: vlan: add support for the new rtm dump call")
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
---
Targeted at next since the patches were applied there recently.
bridge/vlan.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 9bb9e28d11bb..c6f68e5673a7 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -626,7 +626,6 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor)
struct rtattr *vtb[BRIDGE_VLANDB_ENTRY_MAX + 1], *a;
struct br_vlan_msg *bvm = NLMSG_DATA(n);
int len = n->nlmsg_len;
- bool newport = false;
int rem;
if (n->nlmsg_type != RTM_NEWVLAN && n->nlmsg_type != RTM_DELVLAN &&
@@ -654,12 +653,9 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor)
if (monitor)
vlan_rtm_cur_ifidx = -1;
- if (vlan_rtm_cur_ifidx == -1 || vlan_rtm_cur_ifidx != bvm->ifindex) {
- if (vlan_rtm_cur_ifidx != -1)
- close_vlan_port();
- open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN);
- vlan_rtm_cur_ifidx = bvm->ifindex;
- newport = true;
+ if (vlan_rtm_cur_ifidx != -1) {
+ close_vlan_port();
+ vlan_rtm_cur_ifidx = -1;
}
rem = len;
@@ -708,10 +704,12 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor)
}
}
open_json_object(NULL);
- if (!newport)
+ if (vlan_rtm_cur_ifidx != bvm->ifindex) {
+ open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN);
+ vlan_rtm_cur_ifidx = bvm->ifindex;
+ } else {
print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", "");
- else
- newport = false;
+ }
print_range("vlan", vinfo->vid, vrange);
print_vlan_flags(vinfo->flags);
print_nl();
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next] bridge: vlan: dump port only if there are any vlans
2021-04-23 11:52 [PATCH iproute2-next] bridge: vlan: dump port only if there are any vlans Nikolay Aleksandrov
@ 2021-04-23 11:54 ` Nikolay Aleksandrov
2021-04-23 12:10 ` [PATCH iproute2-next v2] " Nikolay Aleksandrov
1 sibling, 0 replies; 4+ messages in thread
From: Nikolay Aleksandrov @ 2021-04-23 11:54 UTC (permalink / raw)
To: Nikolay Aleksandrov, netdev; +Cc: dsahern, roopa
On 23/04/2021 14:52, Nikolay Aleksandrov wrote:
> From: Nikolay Aleksandrov <nikolay@nvidia.com>
>
> When I added support for new vlan rtm dumping, I made a mistake in the
> output format when there are no vlans on the port. This patch fixes it by
> not printing ports without vlan entries (similar to current situation).
>
> Fixes: e5f87c834193 ("bridge: vlan: add support for the new rtm dump call")
> Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
> ---
> Targeted at next since the patches were applied there recently.
>
> bridge/vlan.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
Aaargh.. sent the wrong (broken) version of the patch, sorry for the noise.
Self-NAK
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH iproute2-next v2] bridge: vlan: dump port only if there are any vlans
2021-04-23 11:52 [PATCH iproute2-next] bridge: vlan: dump port only if there are any vlans Nikolay Aleksandrov
2021-04-23 11:54 ` Nikolay Aleksandrov
@ 2021-04-23 12:10 ` Nikolay Aleksandrov
2021-04-26 2:33 ` David Ahern
1 sibling, 1 reply; 4+ messages in thread
From: Nikolay Aleksandrov @ 2021-04-23 12:10 UTC (permalink / raw)
To: netdev; +Cc: dsahern, roopa, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@nvidia.com>
When I added support for new vlan rtm dumping, I made a mistake in the
output format when there are no vlans on the port. This patch fixes it by
not printing ports without vlan entries (similar to current situation).
Example (no vlans):
$ bridge -d vlan show
port vlan-id
Fixes: e5f87c834193 ("bridge: vlan: add support for the new rtm dump call")
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
---
v2: sent proper patch version, fixed the vlan port closing only when opened
added an example
Targeted at next since the patches were applied there recently.
bridge/vlan.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 9bb9e28d11bb..9b6511f189ff 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -626,7 +626,6 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor)
struct rtattr *vtb[BRIDGE_VLANDB_ENTRY_MAX + 1], *a;
struct br_vlan_msg *bvm = NLMSG_DATA(n);
int len = n->nlmsg_len;
- bool newport = false;
int rem;
if (n->nlmsg_type != RTM_NEWVLAN && n->nlmsg_type != RTM_DELVLAN &&
@@ -654,12 +653,9 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor)
if (monitor)
vlan_rtm_cur_ifidx = -1;
- if (vlan_rtm_cur_ifidx == -1 || vlan_rtm_cur_ifidx != bvm->ifindex) {
- if (vlan_rtm_cur_ifidx != -1)
- close_vlan_port();
- open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN);
- vlan_rtm_cur_ifidx = bvm->ifindex;
- newport = true;
+ if (vlan_rtm_cur_ifidx != -1 && vlan_rtm_cur_ifidx != bvm->ifindex) {
+ close_vlan_port();
+ vlan_rtm_cur_ifidx = -1;
}
rem = len;
@@ -707,11 +703,14 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor)
vstats.tx_bytes = rta_getattr_u64(attr);
}
}
- open_json_object(NULL);
- if (!newport)
+ if (vlan_rtm_cur_ifidx != bvm->ifindex) {
+ open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN);
+ open_json_object(NULL);
+ vlan_rtm_cur_ifidx = bvm->ifindex;
+ } else {
+ open_json_object(NULL);
print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", "");
- else
- newport = false;
+ }
print_range("vlan", vinfo->vid, vrange);
print_vlan_flags(vinfo->flags);
print_nl();
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next v2] bridge: vlan: dump port only if there are any vlans
2021-04-23 12:10 ` [PATCH iproute2-next v2] " Nikolay Aleksandrov
@ 2021-04-26 2:33 ` David Ahern
0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2021-04-26 2:33 UTC (permalink / raw)
To: Nikolay Aleksandrov, netdev; +Cc: roopa, Nikolay Aleksandrov
On 4/23/21 5:10 AM, Nikolay Aleksandrov wrote:
> From: Nikolay Aleksandrov <nikolay@nvidia.com>
>
> When I added support for new vlan rtm dumping, I made a mistake in the
> output format when there are no vlans on the port. This patch fixes it by
> not printing ports without vlan entries (similar to current situation).
>
> Example (no vlans):
> $ bridge -d vlan show
> port vlan-id
>
> Fixes: e5f87c834193 ("bridge: vlan: add support for the new rtm dump call")
> Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
> ---
> v2: sent proper patch version, fixed the vlan port closing only when opened
> added an example
>
> Targeted at next since the patches were applied there recently.
>
> bridge/vlan.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
>
applied to iproute2-next
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-26 2:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 11:52 [PATCH iproute2-next] bridge: vlan: dump port only if there are any vlans Nikolay Aleksandrov
2021-04-23 11:54 ` Nikolay Aleksandrov
2021-04-23 12:10 ` [PATCH iproute2-next v2] " Nikolay Aleksandrov
2021-04-26 2:33 ` David Ahern
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.