From: Jan Holmberg <jan@artech.net>
To: netfilter-devel@lists.netfilter.org
Subject: Patch to save ca 100.000 kbyte, integrate save & restore to iptables
Date: Mon, 20 Sep 2004 17:24:08 +0200 [thread overview]
Message-ID: <414EF618.4070602@artech.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 191 bytes --]
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
[-- Attachment #2: patch-iptables-1.2.9-hoj.diff --]
[-- Type: text/plain, Size: 2257 bytes --]
diff -ur iptables-1.2.9/iptables-restore.c iptables-1.2.9-p/iptables-restore.c
--- iptables-1.2.9/iptables-restore.c Sat May 3 20:52:13 2003
+++ iptables-1.2.9-p/iptables-restore.c Sun May 23 23:14:51 2004
@@ -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
diff -ur iptables-1.2.9/iptables-save.c iptables-1.2.9-p/iptables-save.c
--- iptables-1.2.9/iptables-save.c Sat May 3 20:52:13 2003
+++ iptables-1.2.9-p/iptables-save.c Sun May 23 22:46:22 2004
@@ -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;
diff -ur iptables-1.2.9/iptables-standalone.c iptables-1.2.9-p/iptables-standalone.c
--- iptables-1.2.9/iptables-standalone.c Thu Aug 8 15:36:19 2002
+++ iptables-1.2.9-p/iptables-standalone.c Sun May 23 23:15:52 2004
@@ -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
diff -ur iptables-1.2.9/iptables.c iptables-1.2.9-p/iptables.c
--- iptables-1.2.9/iptables.c Sun Jun 15 00:39:35 2003
+++ iptables-1.2.9-p/iptables.c Sun May 23 22:30:18 2004
@@ -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
next reply other threads:[~2004-09-20 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-20 15:24 Jan Holmberg [this message]
2004-09-21 14:16 ` Patch to save ca 100.000 kbyte, integrate save & restore to iptables 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=414EF618.4070602@artech.net \
--to=jan@artech.net \
--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.