]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/netfilter/xt_sctp.c
netfilter: xt_sctp: use WORD_ROUND macro to calculate length of multiple of 4 bytes
[net-next-2.6.git] / net / netfilter / xt_sctp.c
index c3694df5467273e29ab9891c7539a8116896a5b9..ef36a56a02c6881c58296b2bf45c4b99d3836456 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/skbuff.h>
 #include <net/ip.h>
 #include <net/ipv6.h>
+#include <net/sctp/sctp.h>
 #include <linux/sctp.h>
 
 #include <linux/netfilter/x_tables.h>
@@ -67,7 +68,7 @@ match_packet(const struct sk_buff *skb,
                         ++i, offset, sch->type, htons(sch->length),
                         sch->flags);
 #endif
-               offset += (ntohs(sch->length) + 3) & ~3;
+               offset += WORD_ROUND(ntohs(sch->length));
 
                pr_debug("skb->len: %d\toffset: %d\n", skb->len, offset);
 
@@ -114,7 +115,7 @@ match_packet(const struct sk_buff *skb,
 }
 
 static bool
-sctp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
+sctp_mt(const struct sk_buff *skb, struct xt_action_param *par)
 {
        const struct xt_sctp_info *info = par->matchinfo;
        const sctp_sctphdr_t *sh;
@@ -128,7 +129,7 @@ sctp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
        sh = skb_header_pointer(skb, par->thoff, sizeof(_sh), &_sh);
        if (sh == NULL) {
                pr_debug("Dropping evil TCP offset=0 tinygram.\n");
-               *par->hotdrop = true;
+               par->hotdrop = true;
                return false;
        }
        pr_debug("spt: %d\tdpt: %d\n", ntohs(sh->source), ntohs(sh->dest));
@@ -140,7 +141,7 @@ sctp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
                        && ntohs(sh->dest) <= info->dpts[1],
                        XT_SCTP_DEST_PORTS, info->flags, info->invflags)
                && SCCHECK(match_packet(skb, par->thoff + sizeof(sctp_sctphdr_t),
-                                       info, par->hotdrop),
+                                       info, &par->hotdrop),
                           XT_SCTP_CHUNK_TYPES, info->flags, info->invflags);
 }