]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables: move kernel version find routing into libxtables
authorJan Engelhardt <jengelh@medozas.de>
Sat, 3 Sep 2011 12:27:55 +0000 (14:27 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Sat, 3 Sep 2011 12:27:55 +0000 (14:27 +0200)
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 <jengelh@medozas.de>
Makefile.am
include/iptables.h
include/xtables.h.in
iptables/Makefile.am
iptables/iptables.c
iptables/xtables.c

index 34b350122177b8b80a7eed29f07a4b445b0495c1..9167e8e3866615cb7e77b4ce4b93547e90e38ced 100644 (file)
@@ -3,7 +3,7 @@
 ACLOCAL_AMFLAGS  = -I m4
 AUTOMAKE_OPTIONS = foreign subdir-objects
 
-SUBDIRS          = extensions libiptc iptables
+SUBDIRS          = libiptc iptables
 if ENABLE_DEVEL
 SUBDIRS         += include
 endif
@@ -13,6 +13,7 @@ endif
 if HAVE_LIBNFNETLINK
 SUBDIRS         += utils
 endif
+SUBDIRS         += extensions
 
 .PHONY: tarball
 tarball:
index 65b32909e4721c37f326fe66184239d8defe3fcb..89217e297ffd805973aec6a42639fbdaf76ac18f 100644 (file)
@@ -18,14 +18,6 @@ extern int for_each_chain4(int (*fn)(const ipt_chainlabel, int, struct iptc_hand
 extern void print_rule4(const struct ipt_entry *e,
                struct iptc_handle *handle, const char *chain, int counters);
 
-/* kernel revision handling */
-extern int kernel_version;
-extern void get_kernel_version(void);
-#define LINUX_VERSION(x,y,z)   (0x10000*(x) + 0x100*(y) + z)
-#define LINUX_VERSION_MAJOR(x) (((x)>>16) & 0xFF)
-#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
-#define LINUX_VERSION_PATCH(x) ( (x)      & 0xFF)
-
 extern struct xtables_globals iptables_globals;
 
 #endif /*_IPTABLES_USER_H*/
index d50df79a9f41b0ece12c7f04d909d92229ee67f9..28e293379258e1ac48fea80f59e9d76eea13f164 100644 (file)
@@ -477,6 +477,14 @@ extern void xtables_save_string(const char *value);
 extern const struct xtables_pprot xtables_chain_protos[];
 extern u_int16_t xtables_parse_protocol(const char *s);
 
+/* kernel revision handling */
+extern int kernel_version;
+extern void get_kernel_version(void);
+#define LINUX_VERSION(x,y,z)   (0x10000*(x) + 0x100*(y) + z)
+#define LINUX_VERSION_MAJOR(x) (((x)>>16) & 0xFF)
+#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
+#define LINUX_VERSION_PATCH(x) ( (x)      & 0xFF)
+
 /* xtoptions.c */
 extern void xtables_option_metavalidate(const char *,
                                        const struct xt_option_entry *);
index f6db32d0c7d23640a1dab57672bc6cc4261cbada..af620f76eda4652301c9119200f37ecd9b0e5ed5 100644 (file)
@@ -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
index 50dc1e7a03895f26c646be6dc47f80c9e14a132c..830ddbcb804c3bfbdb9f7ed10c217cfbef0ba81c 100644 (file)
@@ -39,7 +39,6 @@
 #include <iptables.h>
 #include <xtables.h>
 #include <fcntl.h>
-#include <sys/utsname.h>
 #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;
index e72aa2844ce48f0f5dc144c81b9b240d5b488971..014e115b759be24f9b283570294153f048786dcd 100644 (file)
@@ -31,6 +31,7 @@
 #include <sys/stat.h>
 #include <sys/statfs.h>
 #include <sys/types.h>
+#include <sys/utsname.h>
 #include <sys/wait.h>
 #include <arpa/inet.h>
 #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);
+}