]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iptunnel: simplify parsing TTL, allow 'hlim' as identifier
authorPhil Sutter <phil@nwl.cc>
Fri, 13 Nov 2015 17:09:02 +0000 (18:09 +0100)
committerStephen Hemminger <shemming@brocade.com>
Mon, 23 Nov 2015 23:26:37 +0000 (15:26 -0800)
Instead of parsing an unsigned integer and checking boundaries, simply
parse u8. This and the added ttl alias 'hlim' provide consistency with
ip6tunnel.

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

index 92edb34b11cbbbb0f46aa8d2157569e0058fda6a..8c05f6fea69bd430c5d8938ed52baab26fddba13 100644 (file)
@@ -141,14 +141,13 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
                        NEXT_ARG();
                        strncpy(medium, *argv, IFNAMSIZ-1);
                } else if (strcmp(*argv, "ttl") == 0 ||
-                          strcmp(*argv, "hoplimit") == 0) {
-                       unsigned uval;
+                          strcmp(*argv, "hoplimit") == 0 ||
+                          strcmp(*argv, "hlim") == 0) {
+                       __u8 uval;
                        NEXT_ARG();
                        if (strcmp(*argv, "inherit") != 0) {
-                               if (get_unsigned(&uval, *argv, 0))
+                               if (get_u8(&uval, *argv, 0))
                                        invarg("invalid TTL\n", *argv);
-                               if (uval > 255)
-                                       invarg("TTL must be <=255\n", *argv);
                                p->iph.ttl = uval;
                        }
                } else if (strcmp(*argv, "tos") == 0 ||