]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv6/netfilter/ip6t_mh.c
netfilter: xtables: substitute temporary defines by final name
[net-next-2.6.git] / net / ipv6 / netfilter / ip6t_mh.c
index aafe4e66577b54332919e1f67dc27c48f19629a8..4a60788873fdf6e71cc8d8edf4bac4aba5ca9c24 100644 (file)
@@ -11,6 +11,7 @@
  * Based on net/netfilter/xt_tcpudp.c
  *
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/types.h>
 #include <linux/module.h>
 #include <net/ip.h>
 MODULE_DESCRIPTION("Xtables: IPv6 Mobility Header match");
 MODULE_LICENSE("GPL");
 
-#ifdef DEBUG_IP_FIREWALL_USER
-#define duprintf(format, args...) printk(format , ## args)
-#else
-#define duprintf(format, args...)
-#endif
-
 /* Returns 1 if the type is matched by the range, 0 otherwise */
 static inline bool
 type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert)
@@ -37,7 +32,8 @@ type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert)
        return (type >= min && type <= max) ^ invert;
 }
 
-static bool mh_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
+static bool mh_mt6(const struct sk_buff *skb,
+                  const struct xt_action_param *par)
 {
        struct ip6_mh _mh;
        const struct ip6_mh *mh;
@@ -51,13 +47,13 @@ static bool mh_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
        if (mh == NULL) {
                /* We've been asked to examine this packet, and we
                   can't.  Hence, no choice but to drop. */
-               duprintf("Dropping evil MH tinygram.\n");
+               pr_debug("Dropping evil MH tinygram.\n");
                *par->hotdrop = true;
                return false;
        }
 
        if (mh->ip6mh_proto != IPPROTO_NONE) {
-               duprintf("Dropping invalid MH Payload Proto: %u\n",
+               pr_debug("Dropping invalid MH Payload Proto: %u\n",
                         mh->ip6mh_proto);
                *par->hotdrop = true;
                return false;
@@ -67,12 +63,12 @@ static bool mh_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
                          !!(mhinfo->invflags & IP6T_MH_INV_TYPE));
 }
 
-static bool mh_mt6_check(const struct xt_mtchk_param *par)
+static int mh_mt6_check(const struct xt_mtchk_param *par)
 {
        const struct ip6t_mh *mhinfo = par->matchinfo;
 
        /* Must specify no unknown invflags */
-       return !(mhinfo->invflags & ~IP6T_MH_INV_MASK);
+       return (mhinfo->invflags & ~IP6T_MH_INV_MASK) ? -EINVAL : 0;
 }
 
 static struct xt_match mh_mt6_reg __read_mostly = {