1 /* This is a module which is used for setting the NFMARK field of an skb. */
2 #include <linux/module.h>
3 #include <linux/skbuff.h>
5 #include <net/checksum.h>
7 #include <linux/netfilter_ipv6/ip6_tables.h>
8 #include <linux/netfilter_ipv6/ip6t_MARK.h>
11 target(struct sk_buff **pskb,
13 const struct net_device *in,
14 const struct net_device *out,
18 const struct ip6t_mark_target_info *markinfo = targinfo;
20 if((*pskb)->nfmark != markinfo->mark) {
21 (*pskb)->nfmark = markinfo->mark;
22 (*pskb)->nfcache |= NFC_ALTERED;
28 checkentry(const char *tablename,
29 const struct ip6t_entry *e,
31 unsigned int targinfosize,
32 unsigned int hook_mask)
34 if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_mark_target_info))) {
35 printk(KERN_WARNING "MARK: targinfosize %u != %Zu\n",
37 IP6T_ALIGN(sizeof(struct ip6t_mark_target_info)));
41 if (strcmp(tablename, "mangle") != 0) {
42 printk(KERN_WARNING "MARK: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
49 static struct ip6t_target ip6t_mark_reg
50 = { { NULL, NULL }, "MARK", target, checkentry, NULL, THIS_MODULE };
52 static int __init init(void)
54 printk(KERN_DEBUG "registering ipv6 mark target\n");
55 if (ip6t_register_target(&ip6t_mark_reg))
61 static void __exit fini(void)
63 ip6t_unregister_target(&ip6t_mark_reg);
68 MODULE_LICENSE("GPL");