2019-06-04 02:11:33 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* This is a module which is used for setting the skb->priority field
|
|
|
|
* of an skb for qdisc classification.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* (C) 2001-2002 Patrick McHardy <kaber@trash.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/ip.h>
|
|
|
|
#include <net/checksum.h>
|
|
|
|
|
2007-02-12 12:14:43 -07:00
|
|
|
#include <linux/netfilter_ipv4.h>
|
|
|
|
#include <linux/netfilter_ipv6.h>
|
[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables
This monster-patch tries to do the best job for unifying the data
structures and backend interfaces for the three evil clones ip_tables,
ip6_tables and arp_tables. In an ideal world we would never have
allowed this kind of copy+paste programming... but well, our world
isn't (yet?) ideal.
o introduce a new x_tables module
o {ip,arp,ip6}_tables depend on this x_tables module
o registration functions for tables, matches and targets are only
wrappers around x_tables provided functions
o all matches/targets that are used from ip_tables and ip6_tables
are now implemented as xt_FOOBAR.c files and provide module aliases
to ipt_FOOBAR and ip6t_FOOBAR
o header files for xt_matches are in include/linux/netfilter/,
include/linux/netfilter_{ipv4,ipv6} contains compatibility wrappers
around the xt_FOOBAR.h headers
Based on this patchset we're going to further unify the code,
gradually getting rid of all the layer 3 specific assumptions.
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-01-12 14:30:04 -07:00
|
|
|
#include <linux/netfilter/x_tables.h>
|
|
|
|
#include <linux/netfilter/xt_CLASSIFY.h>
|
2010-11-15 05:57:56 -07:00
|
|
|
#include <linux/netfilter_arp.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
|
|
|
|
MODULE_LICENSE("GPL");
|
2008-01-15 00:42:28 -07:00
|
|
|
MODULE_DESCRIPTION("Xtables: Qdisc classification");
|
[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables
This monster-patch tries to do the best job for unifying the data
structures and backend interfaces for the three evil clones ip_tables,
ip6_tables and arp_tables. In an ideal world we would never have
allowed this kind of copy+paste programming... but well, our world
isn't (yet?) ideal.
o introduce a new x_tables module
o {ip,arp,ip6}_tables depend on this x_tables module
o registration functions for tables, matches and targets are only
wrappers around x_tables provided functions
o all matches/targets that are used from ip_tables and ip6_tables
are now implemented as xt_FOOBAR.c files and provide module aliases
to ipt_FOOBAR and ip6t_FOOBAR
o header files for xt_matches are in include/linux/netfilter/,
include/linux/netfilter_{ipv4,ipv6} contains compatibility wrappers
around the xt_FOOBAR.h headers
Based on this patchset we're going to further unify the code,
gradually getting rid of all the layer 3 specific assumptions.
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-01-12 14:30:04 -07:00
|
|
|
MODULE_ALIAS("ipt_CLASSIFY");
|
2007-10-11 15:36:40 -06:00
|
|
|
MODULE_ALIAS("ip6t_CLASSIFY");
|
2010-11-15 05:57:56 -07:00
|
|
|
MODULE_ALIAS("arpt_CLASSIFY");
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
static unsigned int
|
2009-07-05 11:43:26 -06:00
|
|
|
classify_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2008-10-08 03:35:19 -06:00
|
|
|
const struct xt_classify_target_info *clinfo = par->targinfo;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2007-10-15 01:53:15 -06:00
|
|
|
skb->priority = clinfo->priority;
|
[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables
This monster-patch tries to do the best job for unifying the data
structures and backend interfaces for the three evil clones ip_tables,
ip6_tables and arp_tables. In an ideal world we would never have
allowed this kind of copy+paste programming... but well, our world
isn't (yet?) ideal.
o introduce a new x_tables module
o {ip,arp,ip6}_tables depend on this x_tables module
o registration functions for tables, matches and targets are only
wrappers around x_tables provided functions
o all matches/targets that are used from ip_tables and ip6_tables
are now implemented as xt_FOOBAR.c files and provide module aliases
to ipt_FOOBAR and ip6t_FOOBAR
o header files for xt_matches are in include/linux/netfilter/,
include/linux/netfilter_{ipv4,ipv6} contains compatibility wrappers
around the xt_FOOBAR.h headers
Based on this patchset we're going to further unify the code,
gradually getting rid of all the layer 3 specific assumptions.
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-01-12 14:30:04 -07:00
|
|
|
return XT_CONTINUE;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2010-11-15 05:57:56 -07:00
|
|
|
static struct xt_target classify_tg_reg[] __read_mostly = {
|
|
|
|
{
|
|
|
|
.name = "CLASSIFY",
|
|
|
|
.revision = 0,
|
|
|
|
.family = NFPROTO_UNSPEC,
|
|
|
|
.hooks = (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_FORWARD) |
|
|
|
|
(1 << NF_INET_POST_ROUTING),
|
|
|
|
.target = classify_tg,
|
|
|
|
.targetsize = sizeof(struct xt_classify_target_info),
|
|
|
|
.me = THIS_MODULE,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "CLASSIFY",
|
|
|
|
.revision = 0,
|
|
|
|
.family = NFPROTO_ARP,
|
|
|
|
.hooks = (1 << NF_ARP_OUT) | (1 << NF_ARP_FORWARD),
|
|
|
|
.target = classify_tg,
|
|
|
|
.targetsize = sizeof(struct xt_classify_target_info),
|
|
|
|
.me = THIS_MODULE,
|
|
|
|
},
|
[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables
This monster-patch tries to do the best job for unifying the data
structures and backend interfaces for the three evil clones ip_tables,
ip6_tables and arp_tables. In an ideal world we would never have
allowed this kind of copy+paste programming... but well, our world
isn't (yet?) ideal.
o introduce a new x_tables module
o {ip,arp,ip6}_tables depend on this x_tables module
o registration functions for tables, matches and targets are only
wrappers around x_tables provided functions
o all matches/targets that are used from ip_tables and ip6_tables
are now implemented as xt_FOOBAR.c files and provide module aliases
to ipt_FOOBAR and ip6t_FOOBAR
o header files for xt_matches are in include/linux/netfilter/,
include/linux/netfilter_{ipv4,ipv6} contains compatibility wrappers
around the xt_FOOBAR.h headers
Based on this patchset we're going to further unify the code,
gradually getting rid of all the layer 3 specific assumptions.
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-01-12 14:30:04 -07:00
|
|
|
};
|
|
|
|
|
2007-12-05 00:24:03 -07:00
|
|
|
static int __init classify_tg_init(void)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2010-11-15 05:57:56 -07:00
|
|
|
return xt_register_targets(classify_tg_reg, ARRAY_SIZE(classify_tg_reg));
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2007-12-05 00:24:03 -07:00
|
|
|
static void __exit classify_tg_exit(void)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2010-11-15 05:57:56 -07:00
|
|
|
xt_unregister_targets(classify_tg_reg, ARRAY_SIZE(classify_tg_reg));
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2007-12-05 00:24:03 -07:00
|
|
|
module_init(classify_tg_init);
|
|
|
|
module_exit(classify_tg_exit);
|