]> git.ipfire.org Git - thirdparty/iproute2.git/commit
iproute: restrict hoplimit values to be in range [0; 255]
authorPhil Sutter <phil@nwl.cc>
Tue, 24 Nov 2015 14:45:31 +0000 (15:45 +0100)
committerStephen Hemminger <shemming@brocade.com>
Sun, 29 Nov 2015 19:47:29 +0000 (11:47 -0800)
commitea6cbab792f7bb8813f1b24cc1f4bd4caad8ccbe
treef3a96af3d34c300184399805a530c099db103385
parentd81f54d5999cb78f4d062a21693ddd50165df0ec
iproute: restrict hoplimit values to be in range [0; 255]

Technically, the range of possible hoplimit values are defined by IPv4
and IPv6 header formats. Both define the field to be eight bits in size,
which leads to a value range of [0;255]. Setting a packet's hoplimit
field to 0 though makes not much sense, as the next hop would
immediately drop the packet. Therefore Linux uses 0 as a special value
indicating to use the system's default hoplimit (configurable via
sysctl). In iproute, setting the hoplimit of a route to 0 is equivalent
to omitting the hoplimit parameter alltogether, so it is actually not
necessary to allow that value to be specified, but keep it anyway for
backwards compatibility.

Signed-off-by: Phil Sutter <phil@nwl.cc>
ip/iproute.c