naccyde / rpms / iproute

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