All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Woerner <twoerner@redhat.com>
To: netfilter-devel@lists.netfilter.org
Subject: iptables-save (1.2.8): ports and levels
Date: Thu, 10 Jul 2003 15:55:39 +0200	[thread overview]
Message-ID: <3F0D705B.8000708@redhat.com> (raw)

[-- 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 ");

             reply	other threads:[~2003-07-10 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-10 13:55 Thomas Woerner [this message]
2003-07-14  7:44 ` iptables-save (1.2.8): ports and levels 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=3F0D705B.8000708@redhat.com \
    --to=twoerner@redhat.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.