netfilter: ebtables: do centralized size checking
[safe/jmp/linux-2.6] / net / bridge / netfilter / ebt_pkttype.c
index 676db32..0190261 100644 (file)
@@ -7,10 +7,10 @@
  *  April, 2003
  *
  */
-
+#include <linux/module.h>
+#include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/netfilter_bridge/ebt_pkttype.h>
-#include <linux/module.h>
 
 static int ebt_filter_pkttype(const struct sk_buff *skb,
    const struct net_device *in,
@@ -28,8 +28,6 @@ static int ebt_pkttype_check(const char *tablename, unsigned int hookmask,
 {
        const struct ebt_pkttype_info *info = data;
 
-       if (datalen != EBT_ALIGN(sizeof(struct ebt_pkttype_info)))
-               return -EINVAL;
        if (info->invert != 0 && info->invert != 1)
                return -EINVAL;
        /* Allow any pkt_type value */
@@ -40,6 +38,7 @@ static struct ebt_match filter_pkttype __read_mostly = {
        .name           = EBT_PKTTYPE_MATCH,
        .match          = ebt_filter_pkttype,
        .check          = ebt_pkttype_check,
+       .matchsize      = XT_ALIGN(sizeof(struct ebt_pkttype_info)),
        .me             = THIS_MODULE,
 };