netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* A small series of iptables userspace cleanups
@ 2011-04-01  4:24 Maciej Żenczykowski
  2011-04-01  4:27 ` [PATCH 01/17] man pages: allow underscores in match and target names Maciej Żenczykowski
                   ` (16 more replies)
  0 siblings, 17 replies; 43+ messages in thread
From: Maciej Żenczykowski @ 2011-04-01  4:24 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

I'm going to follow up on this email with a small series of 17 patches
to userspace iptables code.
These patches have all received extensive testing when applied to 1.4.4.
I've ported the patches and tested that everything compiles cleanly
with current head, but they don't have nearly the same level of
thorough testing.

* The first patch simply allows targets and matches to include
underscores.  Without this the relevant man page sections don't get
included.

* The second is a trivial application of a Redhat/Fedora FD_CLOEXEC patch.

* The third fixes an ipv6 comment thinko/typo.

* The fourth is more complex: it delays match and target
initialization to later on.
For built-in matches/targets we run their init code regardless of what
we're doing.
Unfortunately init code can result in modules being autoloaded as a
result of version probing.
This is undesirable, by splitting registration into two fragments this
is prevented.
The code is just a teeny bit tricky because of some pointer to pointer
link muckery.

* The remaining 13 patches rename functions which are duplicated
between v4 and v6 code to suffix '4' or '6'.
After these renames are applied the following grep correctly results
in nothing being found:
  egrep --exclude-dir=.git -r
'(^|[^_])(init_extensions|for_each_chain|flush_entries|delete_chain|print_rule|do_command)([^46]|$)'
.

This combined with the previous patch will hopefully allow building a
single multi-purpose busybox-style ipv4 and ipv6 capable ip6?tables
binary.
I have this working for iptables 1.4.4, but haven't yet ported all of
the Makefile/etc changes to the current iptables master branch.

With UPX compression a relatively full-featured static multipurpose
single-binary build of 1.4.4 uses 100KB for i386 and 120KB for x86_64.

/sbin/iptables -> /bin/argv0switch
/sbin/iptables32 -> xtables-tiny32
/sbin/iptables64 -> xtables-tiny64
/sbin/iptables-restore -> /bin/argv0switch
/sbin/iptables-restore32 -> xtables-tiny32
/sbin/iptables-restore64 -> xtables-tiny64
/sbin/iptables-save -> /bin/argv0switch
/sbin/iptables-save32 -> xtables-tiny32
/sbin/iptables-save64 -> xtables-tiny64
/sbin/xtables-tiny32 [100796 bytes]
/sbin/xtables-tiny64 [120044 bytes]

(as you can probably guess /bin/argv0switch picks argv0+"32" or
argv[0]+"64" based on machine architecture)

Cheers,
Maciej Żenczykowski
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-04-04 19:48 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01  4:24 A small series of iptables userspace cleanups Maciej Żenczykowski
2011-04-01  4:27 ` [PATCH 01/17] man pages: allow underscores in match and target names Maciej Żenczykowski
2011-04-04 13:30   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 02/17] mark newly opened fds as FD_CLOEXEC (close on exec) Maciej Żenczykowski
2011-04-01  9:31   ` Jan Engelhardt
2011-04-01 21:34     ` Maciej Żenczykowski
2011-04-04 12:58       ` Patrick McHardy
2011-04-04 13:00         ` Jan Engelhardt
2011-04-04 13:30   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 03/17] xtables_ip6addr_to_numeric: fix typo in comment Maciej Żenczykowski
2011-04-04 13:31   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 04/17] Delay (statically built) match/target initialization Maciej Żenczykowski
2011-04-04 13:32   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 05/17] v4: rename init_extensions() to init_extensions4() Maciej Żenczykowski
2011-04-01 10:15   ` Jan Engelhardt
2011-04-01 21:38     ` Maciej Żenczykowski
2011-04-04 13:33   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 06/17] v6: rename init_extensions() to init_extensions6() Maciej Żenczykowski
2011-04-04 13:33   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 07/17] xtables.h: init_extensions() no longer exists Maciej Żenczykowski
2011-04-04 13:34   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 08/17] v4: rename for_each_chain() to for_each_chain4() Maciej Żenczykowski
2011-04-04 13:34   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 09/17] v6: rename for_each_chain() to for_each_chain6() Maciej Żenczykowski
2011-04-04 13:35   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 10/17] v4: rename flush_entries() to flush_entries4() Maciej Żenczykowski
2011-04-04 13:35   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 11/17] v6: rename flush_entries() to flush_entries6() Maciej Żenczykowski
2011-04-04 13:36   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 12/17] v4: rename delete_chain() to delete_chain4() Maciej Żenczykowski
2011-04-04 13:36   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 13/17] v6: rename delete_chain() to delete_chain6() Maciej Żenczykowski
2011-04-04 13:37   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 14/17] v4: rename print_rule() to print_rule4() Maciej Żenczykowski
2011-04-04 13:37   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 15/17] v6: rename print_rule() to print_rule6() Maciej Żenczykowski
2011-04-04 13:38   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 16/17] v4: rename do_command() to do_command4() Maciej Żenczykowski
2011-04-04 13:38   ` Patrick McHardy
2011-04-01  4:27 ` [PATCH 17/17] v6: rename do_command() to do_command6() Maciej Żenczykowski
2011-04-04 13:40   ` Patrick McHardy
2011-04-04 19:33     ` Maciej Żenczykowski
2011-04-04 19:48       ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).