From 2bcf21ee2e44e9e4158ae4a36a5d73832cd99587 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 17 May 2013 16:32:42 +0200 Subject: [PATCH] Only initialize extensions we actually use --- iptables.c | 31 ++++++++++++++++++++++++++++--- iptables.h | 26 +++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/iptables.c b/iptables.c index 4956ef7..6a56910 100644 --- a/iptables.c +++ b/iptables.c @@ -54,6 +54,33 @@ get_kernel_version(void) kernel_version = LINUX_VERSION(x, y, z); } +static void fw3_init_extensions(void) +{ + libip6t_icmp6_init(); + libip6t_LOG_init(); + libipt_DNAT_init(); + libipt_icmp_init(); + libipt_LOG_init(); + libipt_MASQUERADE_init(); + libipt_REDIRECT_init(); + libipt_REJECT_init(); + libipt_SNAT_init(); + libxt_comment_init(); + libxt_conntrack_init(); + libxt_CT_init(); + libxt_limit_init(); + libxt_mac_init(); + libxt_mark_init(); + libxt_MARK_init(); + libxt_set_init(); + libxt_SET_init(); + libxt_standard_init(); + libxt_TCPMSS_init(); + libxt_tcp_init(); + libxt_time_init(); + libxt_udp_init(); +} + struct fw3_ipt_handle * fw3_ipt_open(enum fw3_family family, enum fw3_table table) { @@ -94,9 +121,7 @@ fw3_ipt_open(enum fw3_family family, enum fw3_table table) xtables_matches = NULL; xtables_targets = NULL; - init_extensions(); - init_extensions4(); - init_extensions6(); + fw3_init_extensions(); return h; } diff --git a/iptables.h b/iptables.h index 4731104..226e116 100644 --- a/iptables.h +++ b/iptables.h @@ -34,9 +34,29 @@ extern struct xtables_match *xtables_pending_matches; extern struct xtables_target *xtables_pending_targets; /* libext.a interface */ -void init_extensions(void); -void init_extensions4(void); -void init_extensions6(void); +void libip6t_icmp6_init(void); +void libip6t_LOG_init(void); +void libipt_DNAT_init(void); +void libipt_icmp_init(void); +void libipt_LOG_init(void); +void libipt_MASQUERADE_init(void); +void libipt_REDIRECT_init(void); +void libipt_REJECT_init(void); +void libipt_SNAT_init(void); +void libxt_comment_init(void); +void libxt_conntrack_init(void); +void libxt_CT_init(void); +void libxt_limit_init(void); +void libxt_mac_init(void); +void libxt_mark_init(void); +void libxt_MARK_init(void); +void libxt_set_init(void); +void libxt_SET_init(void); +void libxt_standard_init(void); +void libxt_TCPMSS_init(void); +void libxt_tcp_init(void); +void libxt_time_init(void); +void libxt_udp_init(void); /* Required by certain extensions like SNAT and DNAT */ extern int kernel_version; -- 2.30.2