]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/bridge/netfilter/ebt_mark.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[linux-2.6-omap-h63xx.git] / net / bridge / netfilter / ebt_mark.c
index 62d23c7b25e68e701066b7db541da24b57400549..2fee7e8e2e93ec1e89b952d747f4c4385b3333f3 100644 (file)
  * Marking a frame doesn't really change anything in the frame anyway.
  */
 
+#include <linux/module.h>
+#include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/netfilter_bridge/ebt_mark_t.h>
-#include <linux/module.h>
 
-static int ebt_target_mark(struct sk_buff **pskb, unsigned int hooknr,
-   const struct net_device *in, const struct net_device *out,
-   const void *data, unsigned int datalen)
+static unsigned int
+ebt_mark_tg(struct sk_buff *skb, const struct xt_target_param *par)
 {
-       struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data;
+       const struct ebt_mark_t_info *info = par->targinfo;
        int action = info->target & -16;
 
        if (action == MARK_SET_VALUE)
-               (*pskb)->mark = info->mark;
+               skb->mark = info->mark;
        else if (action == MARK_OR_VALUE)
-               (*pskb)->mark |= info->mark;
+               skb->mark |= info->mark;
        else if (action == MARK_AND_VALUE)
-               (*pskb)->mark &= info->mark;
+               skb->mark &= info->mark;
        else
-               (*pskb)->mark ^= info->mark;
+               skb->mark ^= info->mark;
 
        return info->target | ~EBT_VERDICT_BITS;
 }
 
-static int ebt_target_mark_check(const char *tablename, unsigned int hookmask,
-   const struct ebt_entry *e, void *data, unsigned int datalen)
+static bool ebt_mark_tg_check(const struct xt_tgchk_param *par)
 {
-       struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data;
+       const struct ebt_mark_t_info *info = par->targinfo;
        int tmp;
 
-       if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_t_info)))
-               return -EINVAL;
        tmp = info->target | ~EBT_VERDICT_BITS;
        if (BASE_CHAIN && tmp == EBT_RETURN)
-               return -EINVAL;
-       CLEAR_BASE_CHAIN_BIT;
+               return false;
        if (tmp < -NUM_STANDARD_TARGETS || tmp >= 0)
-               return -EINVAL;
+               return false;
        tmp = info->target & ~EBT_VERDICT_BITS;
        if (tmp != MARK_SET_VALUE && tmp != MARK_OR_VALUE &&
            tmp != MARK_AND_VALUE && tmp != MARK_XOR_VALUE)
-               return -EINVAL;
-       return 0;
+               return false;
+       return true;
 }
 
-static struct ebt_target mark_target =
-{
-       .name           = EBT_MARK_TARGET,
-       .target         = ebt_target_mark,
-       .check          = ebt_target_mark_check,
+static struct xt_target ebt_mark_tg_reg __read_mostly = {
+       .name           = "mark",
+       .revision       = 0,
+       .family         = NFPROTO_BRIDGE,
+       .target         = ebt_mark_tg,
+       .checkentry     = ebt_mark_tg_check,
+       .targetsize     = XT_ALIGN(sizeof(struct ebt_mark_t_info)),
        .me             = THIS_MODULE,
 };
 
 static int __init ebt_mark_init(void)
 {
-       return ebt_register_target(&mark_target);
+       return xt_register_target(&ebt_mark_tg_reg);
 }
 
 static void __exit ebt_mark_fini(void)
 {
-       ebt_unregister_target(&mark_target);
+       xt_unregister_target(&ebt_mark_tg_reg);
 }
 
 module_init(ebt_mark_init);
 module_exit(ebt_mark_fini);
+MODULE_DESCRIPTION("Ebtables: Packet mark modification");
 MODULE_LICENSE("GPL");