2 * xt_MARK - Netfilter module to modify the NFMARK field of an skb
4 * (C) 1999-2001 Marc Boucher <marc@mbsi.ca>
5 * Copyright © CC Computer Consultants GmbH, 2007 - 2008
6 * Jan Engelhardt <jengelh@computergmbh.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/module.h>
14 #include <linux/skbuff.h>
16 #include <net/checksum.h>
18 #include <linux/netfilter/x_tables.h>
19 #include <linux/netfilter/xt_MARK.h>
21 MODULE_LICENSE("GPL");
22 MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
23 MODULE_DESCRIPTION("Xtables: packet mark modification");
24 MODULE_ALIAS("ipt_MARK");
25 MODULE_ALIAS("ip6t_MARK");
28 mark_tg(struct sk_buff *skb, const struct xt_target_param *par)
30 const struct xt_mark_tginfo2 *info = par->targinfo;
32 skb->mark = (skb->mark & ~info->mask) ^ info->mark;
36 static struct xt_target mark_tg_reg __read_mostly = {
39 .family = NFPROTO_UNSPEC,
41 .targetsize = sizeof(struct xt_mark_tginfo2),
45 static int __init mark_tg_init(void)
47 return xt_register_target(&mark_tg_reg);
50 static void __exit mark_tg_exit(void)
52 xt_unregister_target(&mark_tg_reg);
55 module_init(mark_tg_init);
56 module_exit(mark_tg_exit);