Patch to save ca 100.000 kbyte, integrate save & restore to iptables
Hi all,
A patch to save flash memory in embedded system and make a symbolic link to iptables to iptables-save and iptables-restore. More than 100.000 kbyte saved with this patch.
//Jan
iptables-restore.c +1 -1
@@ -97,7 +97,7 @@free (newargv[i]); } -int main (int argc,char *argv[]) +int do_restore (int argc,char *argv[]) {iptc_handle_t handle =NULL ;char buffer[10240 ];
Only in iptables-1.2.9-p/: iptables-save
iptables-save.c +1 -1
@@ -313,7 +313,7 @@* :Chain name POLICY packets bytes * rule */ -int main (int argc,char *argv[]) +int do_save (int argc,char *argv[]) {const char *tablename =NULL ;int c;
iptables-standalone.c +14 -2
@@ -37,6 +37,10 @@#include <string.h> #include <iptables.h> +int do_save (int ,char *[]); + +int do_restore (int ,char *[]); +int main (int argc,char *argv[]) {
@@ -50,7 +54,15 @@#ifdef NO_SHARED_LIBS init_extensions ();#endif - + +if (strlen (argv[0 ]) >=13 && + !strncmp (argv[0 ]+strlen (argv[0 ])-13 ,"iptables-save" ,13 )) +return (do_save (argc, argv)); + +if (strlen (argv[0 ]) >=16 && + !strncmp (argv[0 ]+strlen (argv[0 ])-16 ,"iptables-restore" ,16 )) +return (do_restore (argc, argv)); + ret =do_command (argc, argv, &table, &handle);if (ret) ret =iptc_commit (&handle);
@@ -58,6 +70,6 @@if (!ret)fprintf (stderr,"iptables: %s\n" ,iptc_strerror (errno)); - +exit (!ret); }
Only in iptables-1.2.9-p/: iptables-standalone.d
iptables.c +1 -0
@@ -2296,3 +2296,4 @@return ret; } +
Only in iptables-1.2.9-p/: iptables.d
Only in iptables-1.2.9-p/libiptc: libip4tc.d
Only in iptables-1.2.9-p/libiptc: libip6tc.d
Only in iptables-1.2.9-p/: patch-o-matic
Quoted 5 lines · Jan Holmberg
Hi all,
A patch to save flash memory in embedded system and make a symbolic link to iptables to iptables-save and iptables-restore. More than 100.000 kbyte saved with this patch.
Thanks, but this is already implemented in our CVS tree since Fri Jun 25 11:18:57 2004 UTC
Quoted 1 line
//Jan
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