]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
src: replace old IP*T_ALIGN macros
authorJan Engelhardt <jengelh@medozas.de>
Mon, 9 May 2011 17:32:05 +0000 (19:32 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Thu, 12 May 2011 10:09:13 +0000 (12:09 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
include/libiptc/libip6tc.h
include/libiptc/libiptc.h
ip6tables.c
iptables.c
libiptc/libip4tc.c
libiptc/libip6tc.c

index 9796574ffefed4645c9ae9045fe089cdaddb6545..4f2d1f878955e13cb0e296846d9082a89656d067 100644 (file)
 #endif
 #include <linux/netfilter_ipv6/ip6_tables.h>
 
-#ifndef IP6T_MIN_ALIGN
-#define IP6T_MIN_ALIGN (__alignof__(struct ip6t_entry))
-#endif
-#define IP6T_ALIGN(s) (((s) + (IP6T_MIN_ALIGN-1)) & ~(IP6T_MIN_ALIGN-1))
-
 struct ip6tc_handle;
 
 typedef char ip6t_chainlabel[32];
index 4355ac9216bb2b36cfc695cda8ffd0eab7861b6c..3497d6aedc4eb8daa3611fb9b99ec870e8aed985 100644 (file)
 extern "C" {
 #endif
 
-#ifndef IPT_MIN_ALIGN
-/* ipt_entry has pointers and u_int64_t's in it, so if you align to
-   it, you'll also align to any crazy matches and targets someone
-   might write */
-#define IPT_MIN_ALIGN (__alignof__(struct ipt_entry))
-#endif
-
-#define IPT_ALIGN(s) (((s) + ((IPT_MIN_ALIGN)-1)) & ~((IPT_MIN_ALIGN)-1))
-
 struct iptc_handle;
 
 typedef char ipt_chainlabel[32];
index 967a5f80db8a79eb5a46e70e0ff8d3b6525f4d96..58c7e2df577a2a99df0eb9d30c6f26cd38929243 100644 (file)
@@ -768,10 +768,10 @@ make_delete_mask(const struct xtables_rule_match *matches,
 
        size = sizeof(struct ip6t_entry);
        for (matchp = matches; matchp; matchp = matchp->next)
-               size += IP6T_ALIGN(sizeof(struct ip6t_entry_match)) + matchp->match->size;
+               size += XT_ALIGN(sizeof(struct ip6t_entry_match)) + matchp->match->size;
 
        mask = xtables_calloc(1, size
-                        + IP6T_ALIGN(sizeof(struct ip6t_entry_target))
+                        + XT_ALIGN(sizeof(struct ip6t_entry_target))
                         + target->size);
 
        memset(mask, 0xFF, sizeof(struct ip6t_entry));
@@ -779,13 +779,13 @@ make_delete_mask(const struct xtables_rule_match *matches,
 
        for (matchp = matches; matchp; matchp = matchp->next) {
                memset(mptr, 0xFF,
-                      IP6T_ALIGN(sizeof(struct ip6t_entry_match))
+                      XT_ALIGN(sizeof(struct ip6t_entry_match))
                       + matchp->match->userspacesize);
-               mptr += IP6T_ALIGN(sizeof(struct ip6t_entry_match)) + matchp->match->size;
+               mptr += XT_ALIGN(sizeof(struct ip6t_entry_match)) + matchp->match->size;
        }
 
        memset(mptr, 0xFF,
-              IP6T_ALIGN(sizeof(struct ip6t_entry_target))
+              XT_ALIGN(sizeof(struct ip6t_entry_target))
               + target->userspacesize);
 
        return mask;
@@ -1306,7 +1306,7 @@ static void command_default(struct iptables_command_state *cs)
 
                cs->proto_used = 1;
 
-               size = IP6T_ALIGN(sizeof(struct ip6t_entry_match)) + m->size;
+               size = XT_ALIGN(sizeof(struct ip6t_entry_match)) + m->size;
 
                m->m = xtables_calloc(1, size);
                m->m->u.match_size = size;
@@ -1351,7 +1351,7 @@ static void command_jump(struct iptables_command_state *cs)
        if (cs->target == NULL)
                return;
 
-       size = IP6T_ALIGN(sizeof(struct ip6t_entry_target)) + cs->target->size;
+       size = XT_ALIGN(sizeof(struct ip6t_entry_target)) + cs->target->size;
 
        cs->target->t = xtables_calloc(1, size);
        cs->target->t->u.target_size = size;
@@ -1381,7 +1381,7 @@ static void command_match(struct iptables_command_state *cs)
                           "unexpected ! flag before --match");
 
        m = xtables_find_match(optarg, XTF_LOAD_MUST_SUCCEED, &cs->matches);
-       size = IP6T_ALIGN(sizeof(struct ip6t_entry_match)) + m->size;
+       size = XT_ALIGN(sizeof(struct ip6t_entry_match)) + m->size;
        m->m = xtables_calloc(1, size);
        m->m->u.match_size = size;
        strcpy(m->m->u.user.name, m->name);
index cc7525a1afa189560df6afbba5efb4c8b0adf936..d01e82813487663e2f126b90219a43560f04681e 100644 (file)
@@ -771,10 +771,10 @@ make_delete_mask(const struct xtables_rule_match *matches,
 
        size = sizeof(struct ipt_entry);
        for (matchp = matches; matchp; matchp = matchp->next)
-               size += IPT_ALIGN(sizeof(struct ipt_entry_match)) + matchp->match->size;
+               size += XT_ALIGN(sizeof(struct ipt_entry_match)) + matchp->match->size;
 
        mask = xtables_calloc(1, size
-                        + IPT_ALIGN(sizeof(struct ipt_entry_target))
+                        + XT_ALIGN(sizeof(struct ipt_entry_target))
                         + target->size);
 
        memset(mask, 0xFF, sizeof(struct ipt_entry));
@@ -782,13 +782,13 @@ make_delete_mask(const struct xtables_rule_match *matches,
 
        for (matchp = matches; matchp; matchp = matchp->next) {
                memset(mptr, 0xFF,
-                      IPT_ALIGN(sizeof(struct ipt_entry_match))
+                      XT_ALIGN(sizeof(struct ipt_entry_match))
                       + matchp->match->userspacesize);
-               mptr += IPT_ALIGN(sizeof(struct ipt_entry_match)) + matchp->match->size;
+               mptr += XT_ALIGN(sizeof(struct ipt_entry_match)) + matchp->match->size;
        }
 
        memset(mptr, 0xFF,
-              IPT_ALIGN(sizeof(struct ipt_entry_target))
+              XT_ALIGN(sizeof(struct ipt_entry_target))
               + target->userspacesize);
 
        return mask;
@@ -1330,7 +1330,7 @@ static void command_default(struct iptables_command_state *cs)
 
                cs->proto_used = 1;
 
-               size = IPT_ALIGN(sizeof(struct ipt_entry_match)) + m->size;
+               size = XT_ALIGN(sizeof(struct ipt_entry_match)) + m->size;
 
                m->m = xtables_calloc(1, size);
                m->m->u.match_size = size;
@@ -1376,7 +1376,7 @@ static void command_jump(struct iptables_command_state *cs)
        if (cs->target == NULL)
                return;
 
-       size = IPT_ALIGN(sizeof(struct ipt_entry_target))
+       size = XT_ALIGN(sizeof(struct ipt_entry_target))
                + cs->target->size;
 
        cs->target->t = xtables_calloc(1, size);
@@ -1407,7 +1407,7 @@ static void command_match(struct iptables_command_state *cs)
                           "unexpected ! flag before --match");
 
        m = xtables_find_match(optarg, XTF_LOAD_MUST_SUCCEED, &cs->matches);
-       size = IPT_ALIGN(sizeof(struct ipt_entry_match)) + m->size;
+       size = XT_ALIGN(sizeof(struct ipt_entry_match)) + m->size;
        m->m = xtables_calloc(1, size);
        m->m->u.match_size = size;
        strcpy(m->m->u.user.name, m->name);
index e2d2a5ee0eba3c39de86e0f4eb955ecc829bb09f..cf66709e42641dc77542342d63830b996823082f 100644 (file)
@@ -112,7 +112,7 @@ typedef unsigned int socklen_t;
 #define LABEL_DROP             IPTC_LABEL_DROP
 #define LABEL_QUEUE            IPTC_LABEL_QUEUE
 
-#define ALIGN                  IPT_ALIGN
+#define ALIGN                  XT_ALIGN
 #define RETURN                 IPT_RETURN
 
 #include "libiptc.c"
@@ -209,7 +209,7 @@ is_same(const STRUCT_ENTRY *a, const STRUCT_ENTRY *b, unsigned char *matchmask)
        mptr = matchmask + sizeof(STRUCT_ENTRY);
        if (IPT_MATCH_ITERATE(a, match_different, a->elems, b->elems, &mptr))
                return NULL;
-       mptr += IPT_ALIGN(sizeof(struct ipt_entry_target));
+       mptr += XT_ALIGN(sizeof(struct ipt_entry_target));
 
        return mptr;
 }
index c1508cd598b75cf7fb5100c218a3b4ea67ba653a..0f8a889d29d6fef26deb0bd7baf0b6a87c84491a 100644 (file)
@@ -107,7 +107,7 @@ typedef unsigned int socklen_t;
 #define LABEL_DROP             IP6TC_LABEL_DROP
 #define LABEL_QUEUE            IP6TC_LABEL_QUEUE
 
-#define ALIGN                  IP6T_ALIGN
+#define ALIGN                  XT_ALIGN
 #define RETURN                 IP6T_RETURN
 
 #include "libiptc.c"
@@ -241,7 +241,7 @@ is_same(const STRUCT_ENTRY *a, const STRUCT_ENTRY *b,
        mptr = matchmask + sizeof(STRUCT_ENTRY);
        if (IP6T_MATCH_ITERATE(a, match_different, a->elems, b->elems, &mptr))
                return NULL;
-       mptr += IP6T_ALIGN(sizeof(struct ip6t_entry_target));
+       mptr += XT_ALIGN(sizeof(struct ip6t_entry_target));
 
        return mptr;
 }