Make loading of static extensions optional to support vanilla iptables
in it's default configuration by setting DISABLE_STATIC_EXTENSIONS
instead of hackery.
In case iptables is built with --disable-static libext.a, libext4.a and
libext6.a which OpenWrt installs in the form of libiptext.so,
libiptext4.so, libiptext6.so to save a couple more bytes are of no use
or non-existent one could say. So this commit avoids requiring a
tampered with iptables.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
[Jo-Philipp Wich: stub init_extensions*() instead to reduce amount of ifdefs]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-LIST(APPEND ext_libs iptext)
-LIST(APPEND ext_libs iptext4)
+IF (NOT DISABLE_STATIC_EXTENSIONS)
+ LIST(APPEND ext_libs iptext)
+ LIST(APPEND ext_libs iptext4)
+ IF (NOT DISABLE_IPV6)
+ LIST(APPEND ext_libs iptext6)
+ ENDIF()
+ELSE()
+ ADD_DEFINITIONS(-DDISABLE_STATIC_EXTENSIONS)
+ENDIF()
IF (NOT DISABLE_IPV6)
- LIST(APPEND ext_libs iptext6)
LIST(APPEND iptc_libs ip6tc)
ELSE()
ADD_DEFINITIONS(-DDISABLE_IPV6)
# error "Unsupported xtables version"
#endif
+#ifndef DISABLE_STATIC_EXTENSIONS
/* libipt*ext.so interfaces */
extern void init_extensions(void);
extern void init_extensions4(void);
extern void init_extensions6(void);
+#else
+static inline void init_extensions(void) { }
+static inline void init_extensions4(void) { }
+static inline void init_extensions6(void) { }
+#endif
/* Required by certain extensions like SNAT and DNAT */
extern int kernel_version;