naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/0086-iproute-Fix-for-missing-Oifs-display.patch

99be8f
From 2cb971cefe001a66677c2d1d23b1596cbffb3989 Mon Sep 17 00:00:00 2001
99be8f
From: Andrea Claudi <aclaudi@redhat.com>
99be8f
Date: Mon, 29 Apr 2019 20:07:22 +0200
99be8f
Subject: [PATCH] iproute: Fix for missing 'Oifs:' display
99be8f
99be8f
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
99be8f
Upstream Status: iproute2.git commit 2a866256197f8
99be8f
99be8f
commit 2a866256197f8b86e61fa1afc99b11d7056d5686
99be8f
Author: Phil Sutter <phil@nwl.cc>
99be8f
Date:   Thu Aug 17 19:09:27 2017 +0200
99be8f
99be8f
    iproute: Fix for missing 'Oifs:' display
99be8f
99be8f
    Covscan complained about dead code but after reading it, I assume the
99be8f
    author's intention was to prefix the interface list with 'Oifs: '.
99be8f
    Initializing first to 1 and setting it to 0 after above prefix was
99be8f
    printed should fix it.
99be8f
99be8f
    Signed-off-by: Phil Sutter <phil@nwl.cc>
99be8f
---
99be8f
 ip/iproute.c | 8 +++++---
99be8f
 1 file changed, 5 insertions(+), 3 deletions(-)
99be8f
99be8f
diff --git a/ip/iproute.c b/ip/iproute.c
99be8f
index d4db035fc7b24..6ebc6214c45ee 100644
99be8f
--- a/ip/iproute.c
99be8f
+++ b/ip/iproute.c
99be8f
@@ -618,7 +618,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
99be8f
 	}
99be8f
 	if (tb[RTA_MULTIPATH]) {
99be8f
 		struct rtnexthop *nh = RTA_DATA(tb[RTA_MULTIPATH]);
99be8f
-		int first = 0;
99be8f
+		int first = 1;
99be8f
 
99be8f
 		len = RTA_PAYLOAD(tb[RTA_MULTIPATH]);
99be8f
 
99be8f
@@ -628,10 +628,12 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
99be8f
 			if (nh->rtnh_len > len)
99be8f
 				break;
99be8f
 			if (r->rtm_flags&RTM_F_CLONED && r->rtm_type == RTN_MULTICAST) {
99be8f
-				if (first)
99be8f
+				if (first) {
99be8f
 					fprintf(fp, "Oifs: ");
99be8f
-				else
99be8f
+					first = 0;
99be8f
+				} else {
99be8f
 					fprintf(fp, " ");
99be8f
+				}
99be8f
 			} else
99be8f
 				fprintf(fp, "%s\tnexthop ", _SL_);
99be8f
 			if (nh->rtnh_len > sizeof(*nh)) {
99be8f
-- 
99be8f
2.20.1
99be8f