summaryrefslogtreecommitdiff
path: root/extensions/libxt_length.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2008-12-09 15:06:20 +0100
committerPatrick McHardy <kaber@trash.net>2008-12-09 15:06:20 +0100
commitcea9f71f5618250a38acb21c31fbbf93a752f7d4 (patch)
tree1f77c925110063cbc34172bd997efc2ac6cedff3 /extensions/libxt_length.c
parentb8e74adfa512c220839dea399fc11197dd9b43ff (diff)
downloadiptables-cea9f71f5618250a38acb21c31fbbf93a752f7d4.tar.gz
iptables-save: output ! in position according to manpage
Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'extensions/libxt_length.c')
-rw-r--r--extensions/libxt_length.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/extensions/libxt_length.c b/extensions/libxt_length.c
index c5c411e1..98e81673 100644
--- a/extensions/libxt_length.c
+++ b/extensions/libxt_length.c
@@ -91,28 +91,26 @@ static void length_check(unsigned int flags)
}
static void
-print_length(struct xt_length_info *info)
+length_print(const void *ip, const struct xt_entry_match *match, int numeric)
{
- if (info->invert)
- printf("! ");
-
- if (info->max == info->min)
+ const struct xt_length_info *info = (void *)match->data;
+
+ printf("length %s", info->invert ? "!" : "");
+ if (info->min == info->max)
printf("%u ", info->min);
else
printf("%u:%u ", info->min, info->max);
}
-static void
-length_print(const void *ip, const struct xt_entry_match *match, int numeric)
-{
- printf("length ");
- print_length((struct xt_length_info *)match->data);
-}
-
static void length_save(const void *ip, const struct xt_entry_match *match)
{
- printf("--length ");
- print_length((struct xt_length_info *)match->data);
+ const struct xt_length_info *info = (void *)match->data;
+
+ printf("%s--length ", info->invert ? "! " : "");
+ if (info->min == info->max)
+ printf("%u ", info->min);
+ else
+ printf("%u:%u ", info->min, info->max);
}
static struct xtables_match length_match = {