Blame view
net/netfilter/xt_realm.c
1.42 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 |
/* IP tables module for matching the routing realm * |
1da177e4c Linux-2.6.12-rc2 |
3 4 5 6 7 8 9 10 11 12 13 |
* (C) 2003 by Sampsa Ranta <sampsa@netsonic.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/module.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <net/route.h> |
2e4e6a17a [NETFILTER] x_tab... |
14 15 16 |
#include <linux/netfilter_ipv4.h> #include <linux/netfilter/xt_realm.h> #include <linux/netfilter/x_tables.h> |
1da177e4c Linux-2.6.12-rc2 |
17 18 19 |
MODULE_AUTHOR("Sampsa Ranta <sampsa@netsonic.fi>"); MODULE_LICENSE("GPL"); |
2ae15b64e [NETFILTER]: Upda... |
20 |
MODULE_DESCRIPTION("Xtables: Routing realm match"); |
2e4e6a17a [NETFILTER] x_tab... |
21 |
MODULE_ALIAS("ipt_realm"); |
1da177e4c Linux-2.6.12-rc2 |
22 |
|
1d93a9cba [NETFILTER]: x_ta... |
23 |
static bool |
62fc80510 netfilter: xtable... |
24 |
realm_mt(const struct sk_buff *skb, struct xt_action_param *par) |
1da177e4c Linux-2.6.12-rc2 |
25 |
{ |
f7108a20d netfilter: xtable... |
26 |
const struct xt_realm_info *info = par->matchinfo; |
adf30907d net: skb->dst acc... |
27 |
const struct dst_entry *dst = skb_dst(skb); |
601e68e10 [NETFILTER]: Fix ... |
28 |
|
1da177e4c Linux-2.6.12-rc2 |
29 30 |
return (info->id == (dst->tclassid & info->mask)) ^ info->invert; } |
d3c5ee6d5 [NETFILTER]: x_ta... |
31 |
static struct xt_match realm_mt_reg __read_mostly = { |
1da177e4c Linux-2.6.12-rc2 |
32 |
.name = "realm", |
d3c5ee6d5 [NETFILTER]: x_ta... |
33 |
.match = realm_mt, |
5d04bff09 [NETFILTER]: Conv... |
34 |
.matchsize = sizeof(struct xt_realm_info), |
6e23ae2a4 [NETFILTER]: Intr... |
35 36 |
.hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_FORWARD) | (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_LOCAL_IN), |
ab4f21e6f netfilter: xtable... |
37 |
.family = NFPROTO_UNSPEC, |
1da177e4c Linux-2.6.12-rc2 |
38 39 |
.me = THIS_MODULE }; |
d3c5ee6d5 [NETFILTER]: x_ta... |
40 |
static int __init realm_mt_init(void) |
1da177e4c Linux-2.6.12-rc2 |
41 |
{ |
d3c5ee6d5 [NETFILTER]: x_ta... |
42 |
return xt_register_match(&realm_mt_reg); |
1da177e4c Linux-2.6.12-rc2 |
43 |
} |
d3c5ee6d5 [NETFILTER]: x_ta... |
44 |
static void __exit realm_mt_exit(void) |
1da177e4c Linux-2.6.12-rc2 |
45 |
{ |
d3c5ee6d5 [NETFILTER]: x_ta... |
46 |
xt_unregister_match(&realm_mt_reg); |
1da177e4c Linux-2.6.12-rc2 |
47 |
} |
d3c5ee6d5 [NETFILTER]: x_ta... |
48 49 |
module_init(realm_mt_init); module_exit(realm_mt_exit); |