summaryrefslogtreecommitdiffstats
path: root/extensions/libxt_mark.c
diff options
context:
space:
mode:
authorSerhey Popovych <serhe.popovych@gmail.com>2018-03-01 13:03:12 +0200
committerFlorian Westphal <fw@strlen.de>2018-04-27 18:56:22 +0200
commitd3f143727c308ff303ea9404945e71138a7792a1 (patch)
treed454846d68234640b3fdec17414ad6a69bd943cf /extensions/libxt_mark.c
parent29b1d97764d1849651388d870565b3fa815a0bd8 (diff)
xtables: Introduce and use common function to print val[/mask] arguments
There are number of places where argument is in val[/mask] format printed in extensions and some of them may print corresponding symbolic name. By introducing common function for this task we eliminate custom code parts in extensions to perform printing of arguments in required formats. Use xtables_print_mark_mask() helper for extensions without symbolic name for val[/mask]. Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'extensions/libxt_mark.c')
-rw-r--r--extensions/libxt_mark.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/extensions/libxt_mark.c b/extensions/libxt_mark.c
index e1d00de9..134ad438 100644
--- a/extensions/libxt_mark.c
+++ b/extensions/libxt_mark.c
@@ -47,14 +47,6 @@ static void mark_parse(struct xt_option_call *cb)
markinfo->mask = cb->val.mask;
}
-static void print_mark(unsigned int mark, unsigned int mask)
-{
- if (mask != 0xffffffffU)
- printf(" 0x%x/0x%x", mark, mask);
- else
- printf(" 0x%x", mark);
-}
-
static void
mark_mt_print(const void *ip, const struct xt_entry_match *match, int numeric)
{
@@ -63,7 +55,8 @@ mark_mt_print(const void *ip, const struct xt_entry_match *match, int numeric)
printf(" mark match");
if (info->invert)
printf(" !");
- print_mark(info->mark, info->mask);
+
+ xtables_print_mark_mask(info->mark, info->mask);
}
static void
@@ -76,7 +69,7 @@ mark_print(const void *ip, const struct xt_entry_match *match, int numeric)
if (info->invert)
printf(" !");
- print_mark(info->mark, info->mask);
+ xtables_print_mark_mask(info->mark, info->mask);
}
static void mark_mt_save(const void *ip, const struct xt_entry_match *match)
@@ -87,7 +80,7 @@ static void mark_mt_save(const void *ip, const struct xt_entry_match *match)
printf(" !");
printf(" --mark");
- print_mark(info->mark, info->mask);
+ xtables_print_mark_mask(info->mark, info->mask);
}
static void
@@ -99,7 +92,7 @@ mark_save(const void *ip, const struct xt_entry_match *match)
printf(" !");
printf(" --mark");
- print_mark(info->mark, info->mask);
+ xtables_print_mark_mask(info->mark, info->mask);
}
static void