All of lore.kernel.org
 help / color / mirror / Atom feed
* iptables-save (1.2.8): ports and levels
@ 2003-07-10 13:55 Thomas Woerner
  2003-07-14  7:44 ` Harald Welte
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Woerner @ 2003-07-10 13:55 UTC (permalink / raw)
  To: netfilter-devel

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


Hello,


I have attached a patch to fix iptable-save behavior. Normally port 
numbers are saved. But multiport and mport are saving service names 
instead of port numbers.
LOG is also saving log names instead of log levels.

The patch enables numeric output for multiport and mport. The patch is 
fixing this.


Thanks in advance
Thomas Woerner

-- 
Thomas Woerner, Software Developer     Phone: +49-711-96437-0
Red Hat GmbH                           Fax  : +49-711-96437-111
Hauptstaetterstr. 58                   Email: twoerner@redhat.com
D-70178 Stuttgart                      Web  : http://www.redhat.de/

[-- Attachment #2: iptables-1.2.8-numeric.patch --]
[-- Type: text/plain, Size: 2926 bytes --]

--- iptables-1.2.8/extensions/libip6t_multiport.c.numeric	2003-07-10 12:35:27.000000000 +0200
+++ iptables-1.2.8/extensions/libip6t_multiport.c	2003-07-10 12:35:27.000000000 +0200
@@ -237,7 +237,7 @@
 
 	for (i=0; i < multiinfo->count; i++) {
 		printf("%s", i ? "," : "");
-		print_port(multiinfo->ports[i], ip->proto, 0);
+		print_port(multiinfo->ports[i], ip->proto, 1);
 	}
 	printf(" ");
 }
--- iptables-1.2.8/extensions/libipt_mport.c.numeric	2003-07-10 12:35:27.000000000 +0200
+++ iptables-1.2.8/extensions/libipt_mport.c	2003-07-10 12:35:27.000000000 +0200
@@ -276,10 +276,10 @@
                     && minfo->ports[i-1] == minfo->ports[i])
                         break;
 		printf("%s", i ? "," : "");
-		print_port(minfo->ports[i], ip->proto, 0);
+		print_port(minfo->ports[i], ip->proto, 1);
                 if (pflags & (1<<i)) {
                         printf(":");
-                        print_port(minfo->ports[++i], ip->proto, 0);
+                        print_port(minfo->ports[++i], ip->proto, 1);
                 }
 	}
 	printf(" ");
--- iptables-1.2.8/extensions/libipt_multiport.c.numeric	2003-07-10 12:35:27.000000000 +0200
+++ iptables-1.2.8/extensions/libipt_multiport.c	2003-07-10 12:35:27.000000000 +0200
@@ -237,7 +237,7 @@
 
 	for (i=0; i < multiinfo->count; i++) {
 		printf("%s", i ? "," : "");
-		print_port(multiinfo->ports[i], ip->proto, 0);
+		print_port(multiinfo->ports[i], ip->proto, 1);
 	}
 	printf(" ");
 }
--- iptables-1.2.8/extensions/libipt_LOG.c.numeric	2003-07-10 12:35:27.000000000 +0200
+++ iptables-1.2.8/extensions/libipt_LOG.c	2003-07-10 12:43:20.000000000 +0200
@@ -230,16 +230,8 @@
 	if (strcmp(loginfo->prefix, "") != 0)
 		printf("--log-prefix \"%s\" ", loginfo->prefix);
 
-	if (loginfo->level != LOG_DEFAULT_LEVEL) {
-		for (i = 0;
-		     i < sizeof(ipt_log_names) / sizeof(struct ipt_log_names);
-		     i++) {
-			if (loginfo->level == ipt_log_names[i].level) {
-				printf("--log-level %s ", ipt_log_names[i].name);
-				break;
-			}
-        }
-    }
+	if (loginfo->level != LOG_DEFAULT_LEVEL)
+		printf("--log-level %d ", loginfo->level);
 
 	if (loginfo->logflags & IPT_LOG_TCPSEQ)
 		printf("--log-tcp-sequence ");
--- iptables-1.2.8/extensions/libip6t_LOG.c.numeric	2003-07-10 12:35:27.000000000 +0200
+++ iptables-1.2.8/extensions/libip6t_LOG.c	2003-07-10 12:43:15.000000000 +0200
@@ -230,16 +230,8 @@
 	if (strcmp(loginfo->prefix, "") != 0)
 		printf("--log-prefix \"%s\" ", loginfo->prefix);
 
-	if (loginfo->level != LOG_DEFAULT_LEVEL) {
-		for (i = 0;
-		     i < sizeof(ip6t_log_names) / sizeof(struct ip6t_log_names);
-		     i++) {
-			if (loginfo->level == ip6t_log_names[i].level) {
-				printf("--log-level %s ", ip6t_log_names[i].name);
-				break;
-			}
-        }
-    }
+	if (loginfo->level != LOG_DEFAULT_LEVEL)
+		printf("--log-level %d ", loginfo->level);
 
 	if (loginfo->logflags & IP6T_LOG_TCPSEQ)
 		printf("--log-tcp-sequence ");

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

* Re: iptables-save (1.2.8): ports and levels
  2003-07-10 13:55 iptables-save (1.2.8): ports and levels Thomas Woerner
@ 2003-07-14  7:44 ` Harald Welte
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Welte @ 2003-07-14  7:44 UTC (permalink / raw)
  To: Thomas Woerner; +Cc: netfilter-devel

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

On Thu, Jul 10, 2003 at 03:55:39PM +0200, Thomas Woerner wrote:
> Hello,
> 
> I have attached a patch to fix iptable-save behavior. Normally port 
> numbers are saved. But multiport and mport are saving service names 
> instead of port numbers.
> LOG is also saving log names instead of log levels.
> 
> The patch enables numeric output for multiport and mport. The patch is 
> fixing this.

Thanks.  I will include this patch in iptables CVS as soon as I have
some IP connectivity again (travelling).

> Thomas Woerner
-- 
- Harald Welte <laforge@netfilter.org>             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

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

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

end of thread, other threads:[~2003-07-14  7:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-10 13:55 iptables-save (1.2.8): ports and levels Thomas Woerner
2003-07-14  7:44 ` 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.