naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0036-route-ignore-RTAX_HOPLIMIT-of-value-1.patch

049c96
From 49ec02d14079797fe7290190d13f89ce5c3b57f3 Mon Sep 17 00:00:00 2001
049c96
From: Phil Sutter <psutter@redhat.com>
049c96
Date: Thu, 18 Feb 2016 14:19:36 +0100
049c96
Subject: [PATCH] route: ignore RTAX_HOPLIMIT of value -1
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1291832
049c96
Upstream Status: iproute2.git commit 0f7543322c5fd
049c96
049c96
commit 0f7543322c5fd64d70672578979cf74226f54b64
049c96
Author: Phil Sutter <phil@nwl.cc>
049c96
Date:   Wed Dec 2 13:50:22 2015 +0100
049c96
049c96
    route: ignore RTAX_HOPLIMIT of value -1
049c96
049c96
    Older kernels use -1 internally as indicator to use the sysctl default,
049c96
    but they still export the setting. Newer kernels use 0 to indicate that
049c96
    (which is why the conversion from -1 to 0 was done here), but they also
049c96
    stopped exporting the value. Since the meaning of -1 is clear, treat it
049c96
    equally like default on newer kernels (which is to not print anything).
049c96
049c96
    Signed-off-by: Phil Sutter <phil@nwl.cc>
049c96
---
049c96
 ip/iproute.c | 17 ++++++++---------
049c96
 1 file changed, 8 insertions(+), 9 deletions(-)
049c96
049c96
diff --git a/ip/iproute.c b/ip/iproute.c
049c96
index 99d93c8..d87a099 100644
049c96
--- a/ip/iproute.c
049c96
+++ b/ip/iproute.c
049c96
@@ -544,24 +544,23 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
049c96
 			if (mxrta[i] == NULL)
049c96
 				continue;
049c96
 
049c96
-			if (i < sizeof(mx_names)/sizeof(char*) && mx_names[i])
049c96
-				fprintf(fp, " %s", mx_names[i]);
049c96
-			else
049c96
-				fprintf(fp, " metric %d", i);
049c96
-
049c96
 			if (mxlock & (1<
049c96
 				fprintf(fp, " lock");
049c96
 			if (i != RTAX_CC_ALGO)
049c96
 				val = rta_getattr_u32(mxrta[i]);
049c96
 
049c96
+			if (i == RTAX_HOPLIMIT && (int)val == -1)
049c96
+				continue;
049c96
+
049c96
+			if (i < sizeof(mx_names)/sizeof(char*) && mx_names[i])
049c96
+				fprintf(fp, " %s", mx_names[i]);
049c96
+			else
049c96
+				fprintf(fp, " metric %d", i);
049c96
+
049c96
 			switch (i) {
049c96
 			case RTAX_FEATURES:
049c96
 				print_rtax_features(fp, val);
049c96
 				break;
049c96
-			case RTAX_HOPLIMIT:
049c96
-				if ((int)val == -1)
049c96
-					val = 0;
049c96
-				/* fall through */
049c96
 			default:
049c96
 				fprintf(fp, " %u", val);
049c96
 				break;
049c96
-- 
049c96
1.8.3.1
049c96