From: Michael Schwendt <rh0209ms@arcor.de>
To: netfilter-devel@lists.netfilter.org
Cc: Harald Welte <laforge@gnumonks.org>
Subject: [PATCH] iptables-save match tos bug-fix
Date: Tue, 26 Nov 2002 03:28:27 +0100 [thread overview]
Message-ID: <20021126032827.0c755686.rh0209ms@arcor.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 620 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi everyone!
Here's one more patch for another "missing space in save() function"
bug. This time it's the "tos match" userspace extension. An inverted
TOS match is not saved correctly, so that iptables-restore would
understand it.
The patch is a bit longer because it tidies up save() as used by
iptables-save without adding white-space in print() as used by
iptables -L.
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
iD8DBQE94txL0iMVcrivHFQRArTjAJ48jzFMAOFDsHU+VIM+J2gF4eawBACghhPi
u7pLzmwY1GqFXcfcnxWwxo0=
=6m+o
-----END PGP SIGNATURE-----
[-- Attachment #2: iptables-1.2.7a-savetos.patch --]
[-- Type: application/octet-stream, Size: 1410 bytes --]
Fix save function of tos match.
diff -Naur iptables-1.2.7a-orig/extensions/libipt_tos.c iptables-1.2.7a/extensions/libipt_tos.c
--- iptables-1.2.7a-orig/extensions/libipt_tos.c Wed May 29 15:08:16 2002
+++ iptables-1.2.7a/extensions/libipt_tos.c Tue Nov 26 02:56:40 2002
@@ -105,13 +105,10 @@
}
static void
-print_tos(u_int8_t tos, int invert, int numeric)
+print_tos(u_int8_t tos, int numeric)
{
unsigned int i;
- if (invert)
- fputc('!', stdout);
-
if (!numeric) {
for (i = 0; i<sizeof(TOS_values)/sizeof(struct TOS_value); i++)
if (TOS_values[i].TOS == tos) {
@@ -137,18 +134,24 @@
const struct ipt_entry_match *match,
int numeric)
{
+ const struct ipt_tos_info *info = (const struct ipt_tos_info *)match->data;
+
printf("TOS match ");
- print_tos(((struct ipt_tos_info *)match->data)->tos,
- ((struct ipt_tos_info *)match->data)->invert, numeric);
+ if (info->invert)
+ printf("!");
+ print_tos(info->tos, 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)
{
+ const struct ipt_tos_info *info = (const struct ipt_tos_info *)match->data;
+
+ if (info->invert)
+ printf("! ");
printf("--tos ");
- print_tos(((struct ipt_tos_info *)match->data)->tos,
- ((struct ipt_tos_info *)match->data)->invert, 0);
+ print_tos(info->tos, 0);
}
static
next reply other threads:[~2002-11-26 2:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-26 2:28 Michael Schwendt [this message]
2002-11-28 8:02 ` [PATCH] iptables-save match tos bug-fix 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=20021126032827.0c755686.rh0209ms@arcor.de \
--to=rh0209ms@arcor.de \
--cc=laforge@gnumonks.org \
--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.