]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
datatype: less strict time parsing
authorPatrick McHardy <kaber@trash.net>
Sat, 11 Apr 2015 13:56:16 +0000 (14:56 +0100)
committerPatrick McHardy <kaber@trash.net>
Sun, 12 Apr 2015 18:59:27 +0000 (19:59 +0100)
Don't require hours to be in range 0-23 and minutes/seconds in range 0-59.
The time_type is used for relative times where it is entirely reasonable
to specify 180s instead of 3m.

Signed-off-by: Patrick McHardy <kaber@trash.net>
src/datatype.c

index 0772b5074b2a84d84210d18b784b04e68bd739bc..1c837152b9bba05590e634e8290fdbfeaa4524cc 100644 (file)
@@ -831,10 +831,6 @@ static struct error_record *time_type_parse(const struct expr *sym,
                        }
                        h = str2int(tmp, c, k);
                        k = 0;
-                       if (h > 23) {
-                               return error(&sym->location,
-                                            "Hour needs to be 0-23");
-                       }
                        mask |= HOUR;
                        break;
                case 'm':
@@ -844,10 +840,6 @@ static struct error_record *time_type_parse(const struct expr *sym,
                        }
                        m = str2int(tmp, c, k);
                        k = 0;
-                       if (m > 59) {
-                               return error(&sym->location,
-                                            "Minute needs to be 0-59");
-                       }
                        mask |= MIN;
                        break;
                case 's':
@@ -857,10 +849,6 @@ static struct error_record *time_type_parse(const struct expr *sym,
                        }
                        s = str2int(tmp, c, k);
                        k = 0;
-                       if (s > 59) {
-                               return error(&sym->location,
-                                            "second needs to be 0-59");
-                       }
                        mask |= SECS;
                        break;
                default: