realm match inversion fixes
PATCH 1/1 realm match inversion fixes
Below is a combination of Harald's suggested fix for bugzilla 297, plus my addition which fixes the case of ! being used before the value.
Phil
extensions/libipt_realm.c +15 -12
@@ -49,7 +49,7 @@switch (c) {char *end;case '1' : -check_inverse (argv[optind], &invert, &optind,0 ); +check_inverse (argv[optind-1 ], &invert, &optind,0 ); optarg = argv[optind-1 ]; realminfo->id =strtoul (optarg, &end,0 );if (*end =='/' ) {
@@ -70,12 +70,9 @@ }static void -print_realm (unsigned long id,unsigned long mask,int invert,int numeric) +print_realm (unsigned long id,unsigned long mask) { -if (invert) -printf ("! " ); - -if (mask !=0xffffffff ) +if (mask !=0xffffffff )printf ("0x%lx/0x%lx " , id, mask);else printf ("0x%lx " , id);
@@ -87,10 +84,13 @@ const struct ipt_entry_match *match, int numeric) { +struct ipt_realm_info *ri = (struct ipt_realm_info *) match->data; + +if (ri->invert) +printf ("! " ); +printf ("REALM match " ); -print_realm (((struct ipt_realm_info *)match->data)->id, - ((struct ipt_realm_info *)match->data)->mask, - ((struct ipt_realm_info *)match->data)->invert, numeric); +print_realm (ri->id, ri->mask); }
@@ -98,10 +98,13 @@static void save (const struct ipt_ip *ip,const struct ipt_entry_match *match) { +struct ipt_realm_info *ri = (struct ipt_realm_info *) match->data; + +if (ri->invert) +printf ("! " ); +printf ("--realm " ); -print_realm (((struct ipt_realm_info *)match->data)->id, - ((struct ipt_realm_info *)match->data)->mask, - ((struct ipt_realm_info *)match->data)->invert,0 ); +print_realm (ri->id, ri->mask); }/* Final check; must have specified --mark. */
Quoted 3 lines · Phil Oester
Below is a combination of Harald's suggested fix for bugzilla 297, plus my addition which fixes the case of ! being used before the value.
thanks, already applied to svn
Signature · 5 lines
- Harald Welte <[email protected]> http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie