]> err.no Git - linux-2.6/blobdiff - net/netfilter/xt_sctp.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6] / net / netfilter / xt_sctp.c
index c6eb24a2fe13e2eb90e48253d580daaf673e71b5..843383e01d4155179c66928fafd08e5e64f2f8ac 100644 (file)
@@ -62,7 +62,7 @@ match_packet(const struct sk_buff *skb,
 
        do {
                sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch);
-               if (sch == NULL) {
+               if (sch == NULL || sch->length == 0) {
                        duprintf("Dropping invalid SCTP packet.\n");
                        *hotdrop = 1;
                        return 0;
@@ -129,11 +129,9 @@ match(const struct sk_buff *skb,
       unsigned int protoff,
       int *hotdrop)
 {
-       const struct xt_sctp_info *info;
+       const struct xt_sctp_info *info = matchinfo;
        sctp_sctphdr_t _sh, *sh;
 
-       info = (const struct xt_sctp_info *)matchinfo;
-
        if (offset) {
                duprintf("Dropping non-first fragment.. FIXME\n");
                return 0;
@@ -153,7 +151,7 @@ match(const struct sk_buff *skb,
                && SCCHECK(((ntohs(sh->dest) >= info->dpts[0]) 
                        && (ntohs(sh->dest) <= info->dpts[1])), 
                        XT_SCTP_DEST_PORTS, info->flags, info->invflags)
-               && SCCHECK(match_packet(skb, protoff,
+               && SCCHECK(match_packet(skb, protoff + sizeof (sctp_sctphdr_t),
                                        info->chunkmap, info->chunk_match_type,
                                        info->flag_info, info->flag_count, 
                                        hotdrop),
@@ -200,7 +198,7 @@ static struct xt_match sctp6_match = {
        .me             = THIS_MODULE
 };
 
-static int __init init(void)
+static int __init xt_sctp_init(void)
 {
        int ret;
        ret = xt_register_match(&sctp_match);
@@ -214,11 +212,11 @@ static int __init init(void)
        return ret;
 }
 
-static void __exit fini(void)
+static void __exit xt_sctp_fini(void)
 {
        xt_unregister_match(&sctp6_match);
        xt_unregister_match(&sctp_match);
 }
 
-module_init(init);
-module_exit(fini);
+module_init(xt_sctp_init);
+module_exit(xt_sctp_fini);