Add abstract fw3_xt_reset() implementation
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 27 May 2013 13:46:15 +0000 (15:46 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 27 May 2013 13:47:47 +0000 (15:47 +0200)
iptables.c
iptables.h
xtables-10.h
xtables-5.h

index a189745..9565f8d 100644 (file)
@@ -101,12 +101,7 @@ fw3_ipt_open(enum fw3_family family, enum fw3_table table)
                return NULL;
        }
 
                return NULL;
        }
 
-       xtables_pending_matches = NULL;
-       xtables_pending_targets = NULL;
-
-       xtables_matches = NULL;
-       xtables_targets = NULL;
-
+       fw3_xt_reset();
        fw3_init_extensions();
 
        return h;
        fw3_init_extensions();
 
        return h;
index 05a1c72..51c63d0 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "options.h"
 
 
 #include "options.h"
 
-
+/* xtables interface */
 #if (XTABLES_VERSION_CODE == 10)
 # include "xtables-10.h"
 #elif (XTABLES_VERSION_CODE == 5)
 #if (XTABLES_VERSION_CODE == 10)
 # include "xtables-10.h"
 #elif (XTABLES_VERSION_CODE == 5)
@@ -38,9 +38,6 @@
 # error "Unsupported xtables version"
 #endif
 
 # error "Unsupported xtables version"
 #endif
 
-extern struct xtables_match *xtables_pending_matches;
-extern struct xtables_target *xtables_pending_targets;
-
 /* libext.a interface */
 #define FW3_IPT_MODULES                        \
        __ipt_module(comment)           \
 /* libext.a interface */
 #define FW3_IPT_MODULES                        \
        __ipt_module(comment)           \
index 6b52fff..2372b8c 100644 (file)
 #ifndef __FW3_XTABLES_10_H
 #define __FW3_XTABLES_10_H
 
 #ifndef __FW3_XTABLES_10_H
 #define __FW3_XTABLES_10_H
 
+extern struct xtables_match *xtables_pending_matches;
+extern struct xtables_target *xtables_pending_targets;
+
+static inline void
+fw3_xt_reset(void)
+{
+       xtables_matches = NULL;
+       xtables_targets = NULL;
+
+       xtables_pending_matches = NULL;
+       xtables_pending_targets = NULL;
+}
+
+
 static inline const char *
 fw3_xt_get_match_name(struct xtables_match *m)
 {
 static inline const char *
 fw3_xt_get_match_name(struct xtables_match *m)
 {
index 263d012..1ae8334 100644 (file)
 #ifndef __FW3_XTABLES_5_H
 #define __FW3_XTABLES_5_H
 
 #ifndef __FW3_XTABLES_5_H
 #define __FW3_XTABLES_5_H
 
+static inline void
+fw3_xt_reset(void)
+{
+       xtables_matches = NULL;
+       xtables_targets = NULL;
+}
+
+
 static inline const char *
 fw3_xt_get_match_name(struct xtables_match *m)
 {
 static inline const char *
 fw3_xt_get_match_name(struct xtables_match *m)
 {