[PATCH] VM: add page_state info to per-node meminfo
[linux-ginger.git] / net / bridge / netfilter / ebt_mark.c
blobc93d35ab95c02ac50bb7edfe139e2766a3bf6d2b
1 /*
2 * ebt_mark
4 * Authors:
5 * Bart De Schuymer <bdschuym@pandora.be>
7 * July, 2002
9 */
11 /* The mark target can be used in any chain,
12 * I believe adding a mangle table just for marking is total overkill.
13 * Marking a frame doesn't really change anything in the frame anyway.
16 #include <linux/netfilter_bridge/ebtables.h>
17 #include <linux/netfilter_bridge/ebt_mark_t.h>
18 #include <linux/module.h>
20 static int ebt_target_mark(struct sk_buff **pskb, unsigned int hooknr,
21 const struct net_device *in, const struct net_device *out,
22 const void *data, unsigned int datalen)
24 struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data;
26 if ((*pskb)->nfmark != info->mark)
27 (*pskb)->nfmark = info->mark;
29 return info->target;
32 static int ebt_target_mark_check(const char *tablename, unsigned int hookmask,
33 const struct ebt_entry *e, void *data, unsigned int datalen)
35 struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data;
37 if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_t_info)))
38 return -EINVAL;
39 if (BASE_CHAIN && info->target == EBT_RETURN)
40 return -EINVAL;
41 CLEAR_BASE_CHAIN_BIT;
42 if (INVALID_TARGET)
43 return -EINVAL;
44 return 0;
47 static struct ebt_target mark_target =
49 .name = EBT_MARK_TARGET,
50 .target = ebt_target_mark,
51 .check = ebt_target_mark_check,
52 .me = THIS_MODULE,
55 static int __init init(void)
57 return ebt_register_target(&mark_target);
60 static void __exit fini(void)
62 ebt_unregister_target(&mark_target);
65 module_init(init);
66 module_exit(fini);
67 MODULE_LICENSE("GPL");