]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv6/netfilter/ip6table_security.c
netfilter: xtables: compact table hook functions (1/2)
[net-next-2.6.git] / net / ipv6 / netfilter / ip6table_security.c
index baa8d4ef3b0a6283842effc5e95e0a2576e71499..835858929358f0ba86bb5341e0f380e4429d9545 100644 (file)
@@ -64,56 +64,37 @@ static const struct xt_table security_table = {
 };
 
 static unsigned int
-ip6t_local_in_hook(unsigned int hook,
-                  struct sk_buff *skb,
-                  const struct net_device *in,
-                  const struct net_device *out,
-                  int (*okfn)(struct sk_buff *))
+ip6table_security_hook(unsigned int hook, struct sk_buff *skb,
+                      const struct net_device *in,
+                      const struct net_device *out,
+                      int (*okfn)(struct sk_buff *))
 {
-       return ip6t_do_table(skb, hook, in, out,
-                            dev_net(in)->ipv6.ip6table_security);
-}
+       if (hook == NF_INET_LOCAL_OUT)
+               return ip6t_do_table(skb, hook, in, out,
+                                    dev_net(out)->ipv6.ip6table_security);
 
-static unsigned int
-ip6t_forward_hook(unsigned int hook,
-                 struct sk_buff *skb,
-                 const struct net_device *in,
-                 const struct net_device *out,
-                 int (*okfn)(struct sk_buff *))
-{
+       /* INPUT/FORWARD: */
        return ip6t_do_table(skb, hook, in, out,
                             dev_net(in)->ipv6.ip6table_security);
 }
 
-static unsigned int
-ip6t_local_out_hook(unsigned int hook,
-                   struct sk_buff *skb,
-                   const struct net_device *in,
-                   const struct net_device *out,
-                   int (*okfn)(struct sk_buff *))
-{
-       /* TBD: handle short packets via raw socket */
-       return ip6t_do_table(skb, hook, in, out,
-                            dev_net(out)->ipv6.ip6table_security);
-}
-
 static struct nf_hook_ops ip6t_ops[] __read_mostly = {
        {
-               .hook           = ip6t_local_in_hook,
+               .hook           = ip6table_security_hook,
                .owner          = THIS_MODULE,
                .pf             = NFPROTO_IPV6,
                .hooknum        = NF_INET_LOCAL_IN,
                .priority       = NF_IP6_PRI_SECURITY,
        },
        {
-               .hook           = ip6t_forward_hook,
+               .hook           = ip6table_security_hook,
                .owner          = THIS_MODULE,
                .pf             = NFPROTO_IPV6,
                .hooknum        = NF_INET_FORWARD,
                .priority       = NF_IP6_PRI_SECURITY,
        },
        {
-               .hook           = ip6t_local_out_hook,
+               .hook           = ip6table_security_hook,
                .owner          = THIS_MODULE,
                .pf             = NFPROTO_IPV6,
                .hooknum        = NF_INET_LOCAL_OUT,