From f56b8a8bf4b1041cb875fd8439778f35276bdb30 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sat, 3 Sep 2011 14:27:55 +0200 Subject: iptables: move kernel version find routing into libxtables That way, the remaining unreferenced symbols that do appear in libipt_DNAT and libipt_SNAT as part of the new check can be resolved, and the ugly -rdynamic hack can finally be removed. Signed-off-by: Jan Engelhardt --- iptables/Makefile.am | 1 - iptables/iptables.c | 18 ------------------ iptables/xtables.c | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+), 19 deletions(-) (limited to 'iptables') diff --git a/iptables/Makefile.am b/iptables/Makefile.am index f6db32d0..af620f76 100644 --- a/iptables/Makefile.am +++ b/iptables/Makefile.am @@ -21,7 +21,6 @@ endif xtables_multi_SOURCES = xtables-multi.c iptables-xml.c xtables_multi_CFLAGS = ${AM_CFLAGS} -xtables_multi_LDFLAGS = -rdynamic xtables_multi_LDADD = ../extensions/libext.a if ENABLE_STATIC xtables_multi_CFLAGS += -DALL_INCLUSIVE diff --git a/iptables/iptables.c b/iptables/iptables.c index 50dc1e7a..830ddbcb 100644 --- a/iptables/iptables.c +++ b/iptables/iptables.c @@ -39,7 +39,6 @@ #include #include #include -#include #include "xshared.h" #ifndef TRUE @@ -187,8 +186,6 @@ static const int inverse_for_options[NUMBER_OF_OPT] = #define prog_name iptables_globals.program_name #define prog_vers iptables_globals.program_version -int kernel_version; - /* Primitive headers... */ /* defined in netinet/in.h */ #if 0 @@ -1281,21 +1278,6 @@ static void clear_rule_matches(struct xtables_rule_match **matches) *matches = NULL; } -void -get_kernel_version(void) { - static struct utsname uts; - int x = 0, y = 0, z = 0; - - if (uname(&uts) == -1) { - fprintf(stderr, "Unable to retrieve kernel version.\n"); - xtables_free_opts(1); - exit(1); - } - - sscanf(uts.release, "%d.%d.%d", &x, &y, &z); - kernel_version = LINUX_VERSION(x, y, z); -} - static void command_jump(struct iptables_command_state *cs) { size_t size; diff --git a/iptables/xtables.c b/iptables/xtables.c index e72aa284..014e115b 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #if defined(HAVE_LINUX_MAGIC_H) @@ -1812,3 +1813,20 @@ xtables_parse_protocol(const char *s) "unknown protocol \"%s\" specified", s); return -1; } + +int kernel_version; + +void get_kernel_version(void) +{ + static struct utsname uts; + int x = 0, y = 0, z = 0; + + if (uname(&uts) == -1) { + fprintf(stderr, "Unable to retrieve kernel version.\n"); + xtables_free_opts(1); + exit(1); + } + + sscanf(uts.release, "%d.%d.%d", &x, &y, &z); + kernel_version = LINUX_VERSION(x, y, z); +} -- cgit v1.2.3