Skip to contentSkip to conversation

ip route: should show the hoplimit value what kernel returns

PATCH In review Hangbin Liu 2 participants 2 messages May 13, 2015 – May 14, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip route: should show the hoplimit value what kernel returns

1. Kernel commit a02e4b7 set the default hoplimit as zero.
2. Kernel should return the correct values and iproute should show what kernel returns, not invent magic transformations.

---
 ip/iproute.c | 3 ---
 1 file changed, 3 deletions(-)
ip/iproute.c +0 -3
index 670a4c6..569bff9 100644
@@ -579,9 +579,6 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 				print_rtax_features(fp, val);
 				break;
 			case RTAX_HOPLIMIT:
-				if ((int)val == -1)
-					val = 0;
-				/* fall through */
 			default:
 				fprintf(fp, " %u", val);
 				break;
Signature · 1 line
1.9.3
#1 lore raw
Quoted 14 lines · On Wed, 13 May 2015 09:34:59 +0800 Hangbin Liu <[email protected]> wrote:

1. Kernel commit a02e4b7 set the default hoplimit as zero.
2. Kernel should return the correct values and iproute should show what kernel returns, not invent magic transformations.

---
 ip/iproute.c | 3 ---
 1 file changed, 3 deletions(-)
ip/iproute.c +0 -0
index 670a4c6..569bff9 100644

ip/iproute.c int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) · line 584

Quoted 9 lines
ip/iproute.c +0 -3
@@ -579,9 +579,6 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 				print_rtax_features(fp, val);
 				break;
 			case RTAX_HOPLIMIT:
-				if ((int)val == -1)
-					val = 0;
-				/* fall through */
 			default:
 				fprintf(fp, " %u", val);
 				break;

This is going to cause a mess with older kernels. Since val will be -1 people will see that printed as unsigned and freak.