iptables-save (1.2.8): ports and levels
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
Signature · 4 lines
Thomas Woerner, Software Developer Phone: +49-711-96437-0 Red Hat GmbH Fax : +49-711-96437-111 Hauptstaetterstr. 58 Email: [email protected] D-70178 Stuttgart Web : http://www.redhat.de/
extensions/libip6t_multiport.c renamed from extensions/libip6t_multiport.c.numeric +1 -1
@@ -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 (" " ); }
extensions/libipt_mport.c renamed from extensions/libipt_mport.c.numeric +2 -2
@@ -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 (" " );
extensions/libipt_multiport.c renamed from extensions/libipt_multiport.c.numeric +1 -1
@@ -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 (" " ); }
extensions/libipt_LOG.c renamed from extensions/libipt_LOG.c.numeric +2 -10
@@ -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 " );
extensions/libip6t_LOG.c renamed from extensions/libip6t_LOG.c.numeric +2 -10
@@ -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 " );
Quoted 9 lines · Thomas Woerner
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).
Quoted 1 line
Thomas Woerner
Signature · 5 lines
- Harald Welte <[email protected]> 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