[NETFILTER]: x_tables: consistent and unique symbol names
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / netfilter / xt_realm.c
CommitLineData
1da177e4 1/* IP tables module for matching the routing realm
1da177e4
LT
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
2e4e6a17
HW
15#include <linux/netfilter_ipv4.h>
16#include <linux/netfilter/xt_realm.h>
17#include <linux/netfilter/x_tables.h>
1da177e4
LT
18
19MODULE_AUTHOR("Sampsa Ranta <sampsa@netsonic.fi>");
20MODULE_LICENSE("GPL");
2e4e6a17
HW
21MODULE_DESCRIPTION("X_tables realm match");
22MODULE_ALIAS("ipt_realm");
1da177e4 23
1d93a9cb 24static bool
d3c5ee6d
JE
25realm_mt(const struct sk_buff *skb, const struct net_device *in,
26 const struct net_device *out, const struct xt_match *match,
27 const void *matchinfo, int offset, unsigned int protoff,
28 bool *hotdrop)
1da177e4 29{
2e4e6a17 30 const struct xt_realm_info *info = matchinfo;
a47362a2 31 const struct dst_entry *dst = skb->dst;
601e68e1 32
1da177e4
LT
33 return (info->id == (dst->tclassid & info->mask)) ^ info->invert;
34}
35
d3c5ee6d 36static struct xt_match realm_mt_reg __read_mostly = {
1da177e4 37 .name = "realm",
d3c5ee6d 38 .match = realm_mt,
5d04bff0 39 .matchsize = sizeof(struct xt_realm_info),
6e23ae2a
PM
40 .hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_FORWARD) |
41 (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_LOCAL_IN),
a45049c5 42 .family = AF_INET,
1da177e4
LT
43 .me = THIS_MODULE
44};
45
d3c5ee6d 46static int __init realm_mt_init(void)
1da177e4 47{
d3c5ee6d 48 return xt_register_match(&realm_mt_reg);
1da177e4
LT
49}
50
d3c5ee6d 51static void __exit realm_mt_exit(void)
1da177e4 52{
d3c5ee6d 53 xt_unregister_match(&realm_mt_reg);
1da177e4
LT
54}
55
d3c5ee6d
JE
56module_init(realm_mt_init);
57module_exit(realm_mt_exit);