From c4edfa63eda06f02cc5bc1a65d366c55bd2eda30 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 30 Mar 2009 00:44:46 +0200 Subject: libxtables: reorder .version member 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 --- include/xtables.h.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/xtables.h.in b/include/xtables.h.in index d86276e7..a399f90f 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -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; -- cgit v1.2.3