naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0031-iproute-restrict-hoplimit-values-to-be-in-range-0-25.patch

049c96
From 5498e4f0b6d4fe1955c1719c54932fb9812f1dab 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] iproute: restrict hoplimit values to be in range [0; 255]
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1291832
049c96
Upstream Status: iproute2.git commit ea6cbab792f7b
049c96
049c96
commit ea6cbab792f7bb8813f1b24cc1f4bd4caad8ccbe
049c96
Author: Phil Sutter <phil@nwl.cc>
049c96
Date:   Tue Nov 24 15:45:31 2015 +0100
049c96
049c96
    iproute: restrict hoplimit values to be in range [0; 255]
049c96
049c96
    Technically, the range of possible hoplimit values are defined by IPv4
049c96
    and IPv6 header formats. Both define the field to be eight bits in size,
049c96
    which leads to a value range of [0;255]. Setting a packet's hoplimit
049c96
    field to 0 though makes not much sense, as the next hop would
049c96
    immediately drop the packet. Therefore Linux uses 0 as a special value
049c96
    indicating to use the system's default hoplimit (configurable via
049c96
    sysctl). In iproute, setting the hoplimit of a route to 0 is equivalent
049c96
    to omitting the hoplimit parameter alltogether, so it is actually not
049c96
    necessary to allow that value to be specified, but keep it anyway for
049c96
    backwards compatibility.
049c96
049c96
    Signed-off-by: Phil Sutter <phil@nwl.cc>
049c96
---
049c96
 ip/iproute.c | 2 +-
049c96
 1 file changed, 1 insertion(+), 1 deletion(-)
049c96
049c96
diff --git a/ip/iproute.c b/ip/iproute.c
049c96
index 367b922..78b288a 100644
049c96
--- a/ip/iproute.c
049c96
+++ b/ip/iproute.c
049c96
@@ -805,7 +805,7 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
049c96
 				mxlock |= (1<
049c96
 				NEXT_ARG();
049c96
 			}
049c96
-			if (get_unsigned(&hoplimit, *argv, 0))
049c96
+			if (get_unsigned(&hoplimit, *argv, 0) || hoplimit > 255)
049c96
 				invarg("\"hoplimit\" value is invalid\n", *argv);
049c96
 			rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplimit);
049c96
 		} else if (strcmp(*argv, "advmss") == 0) {
049c96
-- 
049c96
1.8.3.1
049c96