From: Vladis Dronov <vdronov@redhat.com>
To: netdev@vger.kernel.org
Cc: vdronov@redhat.com, David Ahern <dsahern@gmail.com>,
Stephen Hemminger <stephen@networkplumber.org>,
George Shuklin <george.shuklin@gmail.com>
Subject: [PATCH iproute2] ip: fix link type and vlan oneline output
Date: Sun, 19 Jan 2020 02:12:51 +0100 [thread overview]
Message-ID: <20200119011251.7153-1-vdronov@redhat.com> (raw)
Move link type printing in print_linkinfo() so multiline output does not
break link options line. Add oneline support for vlan's ingress and egress
qos maps.
Before the fix:
# ip -details link show veth90.4000
5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535
vlan protocol 802.1Q id 4000 <REORDER_HDR> the option line is broken ^^^
ingress-qos-map { 1:2 }
egress-qos-map { 2:1 } addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
# ip -oneline -details link show veth90.4000
5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\ link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 \ vlan protocol 802.1Q id 4000 <REORDER_HDR>
ingress-qos-map { 1:2 } <<< a multiline output despite -oneline
egress-qos-map { 2:1 } addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
After the fix:
# ip -details link show veth90.4000
5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
vlan protocol 802.1Q id 4000 <REORDER_HDR>
ingress-qos-map { 1:2 }
egress-qos-map { 2:1 }
# ip -oneline -details link show veth90.4000
5: veth90.4000@veth90: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\ link/ether 26:9a:05:af:db:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 \ vlan protocol 802.1Q id 4000 <REORDER_HDR> \ ingress-qos-map { 1:2 } \ egress-qos-map { 2:1 }
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206241
Reported-by: George Shuklin <george.shuklin@gmail.com>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
---
ip/ipaddress.c | 6 +++---
ip/iplink_vlan.c | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 964f14df..8814c298 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1072,9 +1072,6 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
"max_mtu", "maxmtu %u ",
rta_getattr_u32(tb[IFLA_MAX_MTU]));
- if (tb[IFLA_LINKINFO])
- print_linktype(fp, tb[IFLA_LINKINFO]);
-
if (do_link && tb[IFLA_AF_SPEC])
print_af_spec(fp, tb[IFLA_AF_SPEC]);
@@ -1126,6 +1123,9 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
RTA_PAYLOAD(tb[IFLA_PHYS_SWITCH_ID]),
b1, sizeof(b1)));
}
+
+ if (tb[IFLA_LINKINFO])
+ print_linktype(fp, tb[IFLA_LINKINFO]);
}
if ((do_link || show_details) && tb[IFLA_IFALIAS]) {
diff --git a/ip/iplink_vlan.c b/ip/iplink_vlan.c
index 0dfb4a8d..1e6817f5 100644
--- a/ip/iplink_vlan.c
+++ b/ip/iplink_vlan.c
@@ -183,7 +183,8 @@ static void vlan_print_map(FILE *f,
int rem;
open_json_array(PRINT_JSON, name_json);
- print_string(PRINT_FP, NULL, "\n %s { ", name_fp);
+ print_nl();
+ print_string(PRINT_FP, NULL, " %s { ", name_fp);
rem = RTA_PAYLOAD(attr);
for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {
--
2.20.1
next reply other threads:[~2020-01-19 1:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-19 1:12 Vladis Dronov [this message]
2020-01-19 1:28 ` [PATCH iproute2] ip: fix link type and vlan oneline output Vladis Dronov
2020-01-20 17:34 ` Stephen Hemminger
2020-01-21 16:59 ` Vladis Dronov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200119011251.7153-1-vdronov@redhat.com \
--to=vdronov@redhat.com \
--cc=dsahern@gmail.com \
--cc=george.shuklin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).