iprule: Fix destination prefix output

This commit is contained in:
Phil Sutter 2018-08-31 11:52:03 +02:00
parent 941d2e148b
commit 3ce5d0a3bf
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From b068329d161b5841e9e451fcf542987c3e487e70 Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader@canonical.com>
Date: Tue, 28 Aug 2018 16:27:29 +0200
Subject: [PATCH] iprule: Fix destination prefix output
When adding support for JSON output the new code for printing
the destination prefix adds a stray blank character before
the bitmask. This causes some user-space parsing to fail.
Current output:
...: from x.x.x.x/l to y.y.y.y /l
Previous output:
...: from x.x.x.x/l to y.y.y.y/l
Fixes: 0dd4ccc5 "iprule: add json support"
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
(cherry picked from commit 1a75322c5a8dee6e1ed0017d76c87ef85c505b98)
Signed-off-by: Phil Sutter <psutter@redhat.com>
---
ip/iprule.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iprule.c b/ip/iprule.c
index 8b9421431c26a..744d6d88e3433 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -239,7 +239,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
print_string(PRINT_FP, NULL, "to ", NULL);
print_color_string(PRINT_ANY, ifa_family_color(frh->family),
- "dst", "%s ", dst);
+ "dst", "%s", dst);
if (frh->dst_len != host_len)
print_uint(PRINT_ANY, "dstlen", "/%u ", frh->dst_len);
else
--
2.18.0

View File

@ -2,7 +2,7 @@
Summary: Advanced IP routing and network device configuration tools
Name: iproute
Version: 4.18.0
Release: 3%{?dist}
Release: 4%{?dist}
Group: Applications/System
URL: http://kernel.org/pub/linux/utils/net/%{name}2/
Source0: http://kernel.org/pub/linux/utils/net/%{name}2/%{name}2-%{version}.tar.xz
@ -21,6 +21,8 @@ Patch4: 0004-bridge-Fix-check-for-colored-output.patch
Patch5: 0005-Merge-common-code-for-conditionally-colored-output.patch
Patch6: 0006-Make-colored-output-configurable.patch
Patch7: 0007-lib-Make-check_enable_color-return-boolean.patch
# Fix for bz#1623488
Patch8: 0008-iprule-Fix-destination-prefix-output.patch
License: GPLv2+ and Public Domain
BuildRequires: gcc
@ -167,6 +169,9 @@ rm -rf '%{buildroot}%{_docdir}'
%{_includedir}/iproute2/bpf_elf.h
%changelog
* Fri Aug 31 2018 Phil Sutter <psutter@redhat.com> - 4.18.0-4
- iprule: Fix destination prefix output
* Thu Aug 23 2018 Phil Sutter <psutter@redhat.com> - 4.18.0-3
- Make colored output configurable