]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
fix connmark and mark match save() functions
authorHarald Welte <laforge@gnumonks.org>
Fri, 20 Sep 2002 15:25:13 +0000 (15:25 +0000)
committerHarald Welte <laforge@gnumonks.org>
Fri, 20 Sep 2002 15:25:13 +0000 (15:25 +0000)
extensions/libipt_connmark.c
extensions/libipt_mark.c

index 14cbe33125103683a99a2065c45f42858624e5b9..8f81f02b0800a5fc563f7144e126c23acdd69a78 100644 (file)
@@ -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
index 82e826d5c2dbafafa35869acd25421a429ba311a..4aa780bcdf012b67ecdd14f773b5d5ae6e6179c1 100644 (file)
@@ -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