All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iptables-save match tos bug-fix
@ 2002-11-26  2:28 Michael Schwendt
  2002-11-28  8:02 ` Harald Welte
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Schwendt @ 2002-11-26  2:28 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Harald Welte

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] iptables-save match tos bug-fix
  2002-11-26  2:28 [PATCH] iptables-save match tos bug-fix Michael Schwendt
@ 2002-11-28  8:02 ` Harald Welte
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Welte @ 2002-11-28  8:02 UTC (permalink / raw)
  To: Michael Schwendt; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

On Tue, Nov 26, 2002 at 03:28:27AM +0100, Michael Schwendt wrote:
> -----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.

thanks. I'll apply it as soon as I have IP connectivity again.

> Michael

-- 
Live long and prosper
- Harald Welte / laforge@gnumonks.org               http://www.gnumonks.org/
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M- 
V-- PS+ PE-- Y+ PGP++ t++ 5-- !X !R tv-- b+++ DI? !D G+ e* h+ r% y+(*)

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-28  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-26  2:28 [PATCH] iptables-save match tos bug-fix Michael Schwendt
2002-11-28  8:02 ` Harald Welte

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.