]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: string: Do not print default --to value
authorPhil Sutter <phil@nwl.cc>
Wed, 8 Jun 2022 11:28:10 +0000 (13:28 +0200)
committerPhil Sutter <phil@nwl.cc>
Sat, 11 Jun 2022 09:47:03 +0000 (11:47 +0200)
Default value is UINT16_MAX, not 0. Fix the conditional printing.

Fixes: c6fbf41cdd157 ("update string match to reflect new kernel implementation (Pablo Neira)")
Signed-off-by: Phil Sutter <phil@nwl.cc>
extensions/libxt_string.c

index 739a8e7fd66b6846ddf5bad06eebd2b821a54f96..da05fad0f59c8c55282fd46b59df53b5cf7f6fe2 100644 (file)
@@ -269,7 +269,7 @@ string_print(const void *ip, const struct xt_entry_match *match, int numeric)
        printf(" ALGO name %s", info->algo);
        if (info->from_offset != 0)
                printf(" FROM %u", info->from_offset);
-       if (info->to_offset != 0)
+       if (info->to_offset != UINT16_MAX)
                printf(" TO %u", info->to_offset);
        if (revision > 0 && info->u.v1.flags & XT_STRING_FLAG_IGNORECASE)
                printf(" ICASE");
@@ -293,7 +293,7 @@ static void string_save(const void *ip, const struct xt_entry_match *match)
        printf(" --algo %s", info->algo);
        if (info->from_offset != 0)
                printf(" --from %u", info->from_offset);
-       if (info->to_offset != 0)
+       if (info->to_offset != UINT16_MAX)
                printf(" --to %u", info->to_offset);
        if (revision > 0 && info->u.v1.flags & XT_STRING_FLAG_IGNORECASE)
                printf(" --icase");