net/route: enforce hoplimit max value
authorPaolo Abeni <pabeni@redhat.com>
Fri, 13 May 2016 16:33:41 +0000 (18:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2016 00:06:43 +0000 (17:06 -0700)
commit1c76c5d5ffbbaed1cb1829c1eb9b97648b4979fd
tree0f1d0109f71bd115395f2b83f8c673fd6a74a1fc
parent2cddc95adf3b1be879e6540187bb5aae24dd2689
net/route: enforce hoplimit max value

[ Upstream commit 626abd59e51d4d8c6367e03aae252a8aa759ac78 ]

Currently, when creating or updating a route, no check is performed
in both ipv4 and ipv6 code to the hoplimit value.

The caller can i.e. set hoplimit to 256, and when such route will
 be used, packets will be sent with hoplimit/ttl equal to 0.

This commit adds checks for the RTAX_HOPLIMIT value, in both ipv4
ipv6 route code, substituting any value greater than 255 with 255.

This is consistent with what is currently done for ADVMSS and MTU
in the ipv4 code.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/fib_semantics.c
net/ipv6/route.c