]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipv6: restrict hop_limit sysctl setting to range [1; 255]
authorPhil Sutter <phil@nwl.cc>
Tue, 1 Dec 2015 21:45:15 +0000 (22:45 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Dec 2015 19:42:10 +0000 (14:42 -0500)
commit68a26608d1de77cc98b2fdaeef266f3c0871d7b0
tree973b80b5a1af04ef1c4dd5e5e61cacaec820541b
parentbfebf9bf548cbea8d3e4bbb51e7fe181177f0b08
net: ipv6: restrict hop_limit sysctl setting to range [1; 255]

Setting a value bigger than 255 resulted in using only the lower eight
bits of that value as it is assigned to the u8 header field. To avoid
this unexpected result, reject such values.

Setting a value of zero is technically possible, but hosts receiving
such a packet have to treat it like hop_limit was set to one, according
to RFC2460. Therefore I don't see a use-case for that.

Setting a route's hop_limit to zero in iproute2 means to use the sysctl
default, which is not the case here: Setting e.g.
net.conf.eth0.hop_limit=0 will not make the kernel use
net.conf.all.hop_limit for outgoing packets on eth0. To avoid these
kinds of confusion, reject zero.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrconf.c