]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxtables: reorder .version member
authorJan Engelhardt <jengelh@medozas.de>
Sun, 29 Mar 2009 22:44:46 +0000 (00:44 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Fri, 3 Apr 2009 18:51:31 +0000 (20:51 +0200)
When the structure's layout changes, as it did between v1.4.1 and
v1.4.2, trying to compare the version string makes iptables segfault
while it tries to determine whether the module is compatible in the
first place.

By moving the member to a known offset in the struct and keeping it
there, objects (both iptables and 3rd party) compiled from this
commit onwards will avoid the segfault.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
configure.ac
include/xtables.h.in

index 87f693f8b7766be5a75ec53f7c3958103d0a7597..656bd372224de9767ca75eb47acac1af52efc3f7 100644 (file)
@@ -2,7 +2,7 @@
 AC_INIT([iptables], [1.4.3.1])
 
 # See libtool.info "Libtool's versioning system"
-libxtables_vcurrent=1
+libxtables_vcurrent=2
 libxtables_vage=0
 
 AC_CONFIG_HEADERS([config.h])
index d86276e74c4ebc9bd4916d3ee771379b77d92134..a399f90f21ec9d6a4bda32f08e484e072b1ba184 100644 (file)
@@ -37,6 +37,12 @@ struct in_addr;
 /* Include file for additions: new matches and targets. */
 struct xtables_match
 {
+       /*
+        * ABI/API version this module requires. Must be first member,
+        * as the rest of this struct may be subject to ABI changes.
+        */
+       const char *version;
+
        struct xtables_match *next;
 
        const char *name;
@@ -46,8 +52,6 @@ struct xtables_match
 
        u_int16_t family;
 
-       const char *version;
-
        /* Size of match data. */
        size_t size;
 
@@ -93,8 +97,15 @@ struct xtables_match
 
 struct xtables_target
 {
+       /*
+        * ABI/API version this module requires. Must be first member,
+        * as the rest of this struct may be subject to ABI changes.
+        */
+       const char *version;
+
        struct xtables_target *next;
 
+
        const char *name;
 
        /* Revision of target (0 by default). */
@@ -102,7 +113,6 @@ struct xtables_target
 
        u_int16_t family;
 
-       const char *version;
 
        /* Size of target data. */
        size_t size;