[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1574611358-28795-1-git-send-email-moshe@mellanox.com>
Date: Sun, 24 Nov 2019 18:02:38 +0200
From: Moshe Shemesh <moshe@...lanox.com>
To: Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...il.com>
Cc: Jiri Pirko <jiri@...lanox.com>, netdev@...r.kernel.org,
Moshe Shemesh <moshe@...lanox.com>
Subject: [PATCH iproute2] ip: fix oneline output
Ip tool oneline option should output each record on a single line. While
oneline option is active the variable _SL_ replaces line feeds with the
'\' character. However, at the end of print_linkinfo() the variable _SL_
shouldn't be used, otherwise the whole output is on a single line.
Before this fix:
$ip -o link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode
DEFAULT group default qlen 1000\ link/loopback 00:00:00:00:00:00 brd
00:00:00:00:00:00\2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
qdisc fq_codel state UP mode DEFAULT group default qlen 1000\
link/ether 52:54:00:60:0a:db brd ff:ff:ff:ff:ff:ff\3: eth1:
<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode
DEFAULT group default qlen 1000\ link/ether 00:50:56:1b:05:cd brd
ff:ff:ff:ff:ff:ff\
After this fix:
$ip -o link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode
DEFAULT group default qlen 1000\ link/loopback 00:00:00:00:00:00 brd
00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state
UP mode DEFAULT group default qlen 1000\ link/ether 52:54:00:60:0a:db
brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state
UP mode DEFAULT group default qlen 1000\ link/ether 00:50:56:1b:05:cd
brd ff:ff:ff:ff:ff:ff
Fixes: 3aa0e51be64b ("ip: add support for alternative name addition/deletion/list")
Signed-off-by: Moshe Shemesh <moshe@...lanox.com>
Reviewed-by: Jiri Pirko <jiri@...lanox.com>
---
ip/ipaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index b72eb7a..da1bc44 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1155,7 +1155,7 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
close_json_array(PRINT_JSON, NULL);
}
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_string(PRINT_FP, NULL, "%s", "\n");
fflush(fp);
return 1;
}
--
1.8.2.3
Powered by blists - more mailing lists