summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2002-09-20 15:25:13 +0000
committerHarald Welte <laforge@gnumonks.org>2002-09-20 15:25:13 +0000
commit42479ccb51bc11c7097b6c0fdca63766fe298cd6 (patch)
treef566fdc9f69c4d6282b38a6902dd72032a59b58e /extensions
parentb05758a974c02c3c12449a102d82721da1073db5 (diff)
fix connmark and mark match save() functions
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libipt_connmark.c22
-rw-r--r--extensions/libipt_mark.c24
2 files changed, 26 insertions, 20 deletions
diff --git a/extensions/libipt_connmark.c b/extensions/libipt_connmark.c
index 14cbe331..8f81f02b 100644
--- a/extensions/libipt_connmark.c
+++ b/extensions/libipt_connmark.c
@@ -65,11 +65,8 @@ parse(int c, char **argv, int invert, unsigned int *flags,
}
static void
-print_mark(unsigned long mark, unsigned long mask, int invert, int numeric)
+print_mark(unsigned long mark, unsigned long mask, int numeric)
{
- if (invert)
- fputc('!', stdout);
-
if(mask != 0xffffffff)
printf("0x%lx/0x%lx ", mark, mask);
else
@@ -91,20 +88,25 @@ print(const struct ipt_ip *ip,
const struct ipt_entry_match *match,
int numeric)
{
+ struct ipt_connmark_info *info = (struct ipt_connmark_info *)match->data;
+
printf("CONNMARK match ");
- print_mark(((struct ipt_connmark_info *)match->data)->mark,
- ((struct ipt_connmark_info *)match->data)->mask,
- ((struct ipt_connmark_info *)match->data)->invert, numeric);
+ if (info->invert)
+ printf("!");
+ print_mark(info->mark, info->mask, numeric);
}
/* Saves the union ipt_matchinfo in parsable form to stdout. */
static void
save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
{
+ struct ipt_connmark_info *info = (struct ipt_connmark_info *)match->data;
+
+ if (info->invert)
+ printf("! ");
+
printf("--mark ");
- print_mark(((struct ipt_connmark_info *)match->data)->mark,
- ((struct ipt_connmark_info *)match->data)->mask,
- ((struct ipt_connmark_info *)match->data)->invert, 0);
+ print_mark(info->mark, info->mask, 0);
}
static
diff --git a/extensions/libipt_mark.c b/extensions/libipt_mark.c
index 82e826d5..4aa780bc 100644
--- a/extensions/libipt_mark.c
+++ b/extensions/libipt_mark.c
@@ -65,11 +65,8 @@ parse(int c, char **argv, int invert, unsigned int *flags,
}
static void
-print_mark(unsigned long mark, unsigned long mask, int invert, int numeric)
+print_mark(unsigned long mark, unsigned long mask, int numeric)
{
- if (invert)
- fputc('!', stdout);
-
if(mask != 0xffffffff)
printf("0x%lx/0x%lx ", mark, mask);
else
@@ -91,20 +88,27 @@ print(const struct ipt_ip *ip,
const struct ipt_entry_match *match,
int numeric)
{
+ struct ipt_mark_info *info = (struct ipt_mark_info *)match->data;
+
printf("MARK match ");
- print_mark(((struct ipt_mark_info *)match->data)->mark,
- ((struct ipt_mark_info *)match->data)->mask,
- ((struct ipt_mark_info *)match->data)->invert, numeric);
+
+ if (info->invert)
+ printf("!");
+
+ print_mark(info->mark, info->mask, numeric);
}
/* Saves the union ipt_matchinfo in parsable form to stdout. */
static void
save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
{
+ struct ipt_mark_info *info = (struct ipt_mark_info *)match->data;
+
+ if (info->invert)
+ printf("! ");
+
printf("--mark ");
- print_mark(((struct ipt_mark_info *)match->data)->mark,
- ((struct ipt_mark_info *)match->data)->mask,
- ((struct ipt_mark_info *)match->data)->invert, 0);
+ print_mark(info->mark, info->mask, 0);
}
static