Root/
1 | /* IP tables module for matching the routing realm |
2 | * |
3 | * (C) 2003 by Sampsa Ranta <sampsa@netsonic.fi> |
4 | * |
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. |
8 | */ |
9 | |
10 | #include <linux/module.h> |
11 | #include <linux/skbuff.h> |
12 | #include <linux/netdevice.h> |
13 | #include <net/route.h> |
14 | |
15 | #include <linux/netfilter_ipv4.h> |
16 | #include <linux/netfilter/xt_realm.h> |
17 | #include <linux/netfilter/x_tables.h> |
18 | |
19 | MODULE_AUTHOR("Sampsa Ranta <sampsa@netsonic.fi>"); |
20 | MODULE_LICENSE("GPL"); |
21 | MODULE_DESCRIPTION("Xtables: Routing realm match"); |
22 | MODULE_ALIAS("ipt_realm"); |
23 | |
24 | static bool |
25 | realm_mt(const struct sk_buff *skb, const struct xt_match_param *par) |
26 | { |
27 | const struct xt_realm_info *info = par->matchinfo; |
28 | const struct dst_entry *dst = skb_dst(skb); |
29 | |
30 | return (info->id == (dst->tclassid & info->mask)) ^ info->invert; |
31 | } |
32 | |
33 | static struct xt_match realm_mt_reg __read_mostly = { |
34 | .name = "realm", |
35 | .match = realm_mt, |
36 | .matchsize = sizeof(struct xt_realm_info), |
37 | .hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_FORWARD) | |
38 | (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_LOCAL_IN), |
39 | .family = NFPROTO_UNSPEC, |
40 | .me = THIS_MODULE |
41 | }; |
42 | |
43 | static int __init realm_mt_init(void) |
44 | { |
45 | return xt_register_match(&realm_mt_reg); |
46 | } |
47 | |
48 | static void __exit realm_mt_exit(void) |
49 | { |
50 | xt_unregister_match(&realm_mt_reg); |
51 | } |
52 | |
53 | module_init(realm_mt_init); |
54 | module_exit(realm_mt_exit); |
55 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9