diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-05-26 12:29:52 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-05-26 13:05:00 +0200 |
commit | 980b7859bbd1db1e5e46422fccccbce38f9809ab (patch) | |
tree | 6913634090e21f23e45428e761d7949d6e8e0aa5 | |
parent | 9c8f9bea8e3356788c2208fa2a9be6c419480ddf (diff) | |
download | firewall3-980b7859bbd1db1e5e46422fccccbce38f9809ab.tar.gz |
Rework match initialization
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | iptables.c | 18 | ||||
-rw-r--r-- | iptables.h | 46 |
3 files changed, 9 insertions, 62 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bfaa3eb..22e890d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,14 +5,7 @@ ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) SET(iptc_libs ip4tc) -SET(sed_match "^[[:space:]]*__ipt_module(\\(.*\\)).*") -SET(sed_replace "-Wl,--undefined=libxt_\\1_init -Wl,--undefined=libipt_\\1_init -Wl,--undefined=libip6t_\\1_init") - -EXECUTE_PROCESS(COMMAND sed -n -e "s/${sed_match}/${sed_replace}/; T n; H; :n; \${ x; s/^\\n//; s/\\n/ /gp }" ${CMAKE_SOURCE_DIR}/iptables.h - OUTPUT_VARIABLE ext_syms OUTPUT_STRIP_TRAILING_WHITESPACE) - SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unresolved-symbols=ignore-all ${ext_syms}") LIST(APPEND ext_libs iptext) LIST(APPEND ext_libs iptext4) @@ -53,22 +53,14 @@ get_kernel_version(void) kernel_version = 0x10000 * x + 0x100 * y + z; } -#ifdef DISABLE_IPV6 -#undef __ipt_module -#define __ipt_module(x) libxt_##x##_init, libipt_##x##_init, -#else -#undef __ipt_module -#define __ipt_module(x) libxt_##x##_init, libipt_##x##_init, libip6t_##x##_init, -#endif - static void fw3_init_extensions(void) { - int i; - void (*initfuncs[])(void) = { FW3_IPT_MODULES }; + init_extensions(); + init_extensions4(); - for (i = 0; i < sizeof(initfuncs)/sizeof(initfuncs[0]); i++) - if (initfuncs[i]) - initfuncs[i](); +#ifndef DISABLE_IPV6 + init_extensions6(); +#endif } struct fw3_ipt_handle * @@ -39,48 +39,10 @@ # error "Unsupported xtables version" #endif -/* libext.a interface */ -#define FW3_IPT_MODULES \ - __ipt_module(comment) \ - __ipt_module(conntrack) \ - __ipt_module(icmp) \ - __ipt_module(icmp6) \ - __ipt_module(limit) \ - __ipt_module(connlimit) \ - __ipt_module(mac) \ - __ipt_module(mark) \ - __ipt_module(multiport) \ - __ipt_module(set) \ - __ipt_module(standard) \ - __ipt_module(tcp) \ - __ipt_module(time) \ - __ipt_module(udp) \ - __ipt_module(CT) \ - __ipt_module(DNAT) \ - __ipt_module(LOG) \ - __ipt_module(MARK) \ - __ipt_module(MASQUERADE) \ - __ipt_module(REDIRECT) \ - __ipt_module(REJECT) \ - __ipt_module(SET) \ - __ipt_module(SNAT) \ - __ipt_module(TCPMSS) - -#ifdef DISABLE_IPV6 -#undef __ipt_module -#define __ipt_module(x) \ - extern void libxt_##x##_init(void) __attribute__((weak)); \ - extern void libipt_##x##_init(void) __attribute__((weak)); -#else -#undef __ipt_module -#define __ipt_module(x) \ - extern void libxt_##x##_init(void) __attribute__((weak)); \ - extern void libipt_##x##_init(void) __attribute__((weak)); \ - extern void libip6t_##x##_init(void) __attribute__((weak)); -#endif - -FW3_IPT_MODULES - +/* libipt*ext.so interfaces */ +extern void init_extensions(void); +extern void init_extensions4(void); +extern void init_extensions6(void); /* Required by certain extensions like SNAT and DNAT */ extern int kernel_version; |