From: Phil Oester <kernel@linuxace.com>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH] realm match inversion fixes
Date: Sat, 12 Feb 2005 14:39:08 -0800 [thread overview]
Message-ID: <20050212223908.GA2960@linuxace.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 149 bytes --]
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
[-- Attachment #2: patch-realm2 --]
[-- Type: text/plain, Size: 1732 bytes --]
diff -ru ipt-orig/extensions/libipt_realm.c ipt-new/extensions/libipt_realm.c
--- ipt-orig/extensions/libipt_realm.c 2004-12-28 05:11:59.000000000 -0800
+++ ipt-new/extensions/libipt_realm.c 2005-02-12 14:32:24.000000000 -0800
@@ -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. */
next reply other threads:[~2005-02-12 22:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-12 22:39 Phil Oester [this message]
2005-02-14 23:06 ` [PATCH] realm match inversion fixes Harald Welte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050212223908.GA2960@linuxace.com \
--to=kernel@linuxace.com \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.