1 /* This is a module which is used for setting the NFMARK field of an skb. */
3 /* (C) 1999-2001 Marc Boucher <marc@mbsi.ca>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #include <linux/module.h>
11 #include <linux/skbuff.h>
13 #include <net/checksum.h>
15 #include <linux/netfilter_ipv6/ip6_tables.h>
16 #include <linux/netfilter_ipv6/ip6t_MARK.h>
18 MODULE_LICENSE("GPL");
19 MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
22 target(struct sk_buff
**pskb
,
23 const struct net_device
*in
,
24 const struct net_device
*out
,
29 const struct ip6t_mark_target_info
*markinfo
= targinfo
;
31 if((*pskb
)->nfmark
!= markinfo
->mark
) {
32 (*pskb
)->nfmark
= markinfo
->mark
;
33 (*pskb
)->nfcache
|= NFC_ALTERED
;
39 checkentry(const char *tablename
,
40 const struct ip6t_entry
*e
,
42 unsigned int targinfosize
,
43 unsigned int hook_mask
)
45 if (targinfosize
!= IP6T_ALIGN(sizeof(struct ip6t_mark_target_info
))) {
46 printk(KERN_WARNING
"MARK: targinfosize %u != %Zu\n",
48 IP6T_ALIGN(sizeof(struct ip6t_mark_target_info
)));
52 if (strcmp(tablename
, "mangle") != 0) {
53 printk(KERN_WARNING
"MARK: can only be called from \"mangle\" table, not \"%s\"\n", tablename
);
60 static struct ip6t_target ip6t_mark_reg
61 = { { NULL
, NULL
}, "MARK", target
, checkentry
, NULL
, THIS_MODULE
};
63 static int __init
init(void)
65 printk(KERN_DEBUG
"registering ipv6 mark target\n");
66 if (ip6t_register_target(&ip6t_mark_reg
))
72 static void __exit
fini(void)
74 ip6t_unregister_target(&ip6t_mark_reg
);