OMAP3430SDP: Enable config options CONFIG_OMAP_RESET_CLOCKS and CONFIG_SUSPEND
[linux-ginger.git] / net / netfilter / xt_realm.c
blob7df1627c536f27a350010948a2d2778c6d03639d
1 /* IP tables module for matching the routing realm
3 * (C) 2003 by Sampsa Ranta <sampsa@netsonic.fi>
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 */
10 #include <linux/module.h>
11 #include <linux/skbuff.h>
12 #include <linux/netdevice.h>
13 #include <net/route.h>
15 #include <linux/netfilter_ipv4.h>
16 #include <linux/netfilter/xt_realm.h>
17 #include <linux/netfilter/x_tables.h>
19 MODULE_AUTHOR("Sampsa Ranta <sampsa@netsonic.fi>");
20 MODULE_LICENSE("GPL");
21 MODULE_DESCRIPTION("Xtables: Routing realm match");
22 MODULE_ALIAS("ipt_realm");
24 static bool
25 realm_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)
30 const struct xt_realm_info *info = matchinfo;
31 const struct dst_entry *dst = skb->dst;
33 return (info->id == (dst->tclassid & info->mask)) ^ info->invert;
36 static struct xt_match realm_mt_reg __read_mostly = {
37 .name = "realm",
38 .match = realm_mt,
39 .matchsize = sizeof(struct xt_realm_info),
40 .hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_FORWARD) |
41 (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_LOCAL_IN),
42 .family = AF_INET,
43 .me = THIS_MODULE
46 static int __init realm_mt_init(void)
48 return xt_register_match(&realm_mt_reg);
51 static void __exit realm_mt_exit(void)
53 xt_unregister_match(&realm_mt_reg);
56 module_init(realm_mt_init);
57 module_exit(realm_mt_exit);