Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / net / bridge / netfilter / ebt_stp.c
index d0299ef..a0bed82 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/netfilter_bridge/ebt_stp.h>
+#include <linux/etherdevice.h>
 #include <linux/module.h>
 
 #define BPDU_TYPE_CONFIG 0
@@ -122,26 +123,30 @@ static int ebt_filter_stp(const struct sk_buff *skb, const struct net_device *in
    const struct net_device *out, const void *data, unsigned int datalen)
 {
        struct ebt_stp_info *info = (struct ebt_stp_info *)data;
-       struct stp_header stph;
+       struct stp_header _stph, *sp;
        uint8_t header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00};
-       if (skb_copy_bits(skb, 0, &stph, sizeof(stph)))
+
+       sp = skb_header_pointer(skb, 0, sizeof(_stph), &_stph);
+       if (sp == NULL)
                return EBT_NOMATCH;
 
        /* The stp code only considers these */
-       if (memcmp(&stph, header, sizeof(header)))
+       if (memcmp(sp, header, sizeof(header)))
                return EBT_NOMATCH;
 
        if (info->bitmask & EBT_STP_TYPE
-           && FWINV(info->type != stph.type, EBT_STP_TYPE))
+           && FWINV(info->type != sp->type, EBT_STP_TYPE))
                return EBT_NOMATCH;
 
-       if (stph.type == BPDU_TYPE_CONFIG &&
+       if (sp->type == BPDU_TYPE_CONFIG &&
            info->bitmask & EBT_STP_CONFIG_MASK) {
-               struct stp_config_pdu stpc;
+               struct stp_config_pdu _stpc, *st;
 
-               if (skb_copy_bits(skb, sizeof(stph), &stpc, sizeof(stpc)))
-                   return EBT_NOMATCH;
-               return ebt_filter_config(info, &stpc);
+               st = skb_header_pointer(skb, sizeof(_stph),
+                                       sizeof(_stpc), &_stpc);
+               if (st == NULL)
+                       return EBT_NOMATCH;
+               return ebt_filter_config(info, st);
        }
        return EBT_MATCH;
 }
@@ -160,8 +165,8 @@ static int ebt_stp_check(const char *tablename, unsigned int hookmask,
        if (datalen != len)
                return -EINVAL;
        /* Make sure the match only receives stp frames */
-       if (memcmp(e->destmac, bridge_ula, ETH_ALEN) ||
-           memcmp(e->destmsk, msk, ETH_ALEN) || !(e->bitmask & EBT_DESTMAC))
+       if (compare_ether_addr(e->destmac, bridge_ula) ||
+           compare_ether_addr(e->destmsk, msk) || !(e->bitmask & EBT_DESTMAC))
                return -EINVAL;
 
        return 0;
@@ -175,16 +180,16 @@ static struct ebt_match filter_stp =
        .me             = THIS_MODULE,
 };
 
-static int __init init(void)
+static int __init ebt_stp_init(void)
 {
        return ebt_register_match(&filter_stp);
 }
 
-static void __exit fini(void)
+static void __exit ebt_stp_fini(void)
 {
        ebt_unregister_match(&filter_stp);
 }
 
-module_init(init);
-module_exit(fini);
+module_init(ebt_stp_init);
+module_exit(ebt_stp_fini);
 MODULE_LICENSE("GPL");