aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2013-10-10 03:21:55 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2013-10-14 05:29:31 -0400
commit795aa6ef6a1aba99050735eadd0c2341b789b53b (patch)
treeba3b0ee0dadcb55962b596342d5897b02db1d234
parentccdbb6e96beca362db876d820ac1e560ff6d9579 (diff)
netfilter: pass hook ops to hookfn
Pass the hook ops to the hookfn to allow for generic hook functions. This change is required by nf_tables. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/linux/netfilter.h3
-rw-r--r--net/bridge/br_netfilter.c22
-rw-r--r--net/bridge/netfilter/ebtable_filter.c16
-rw-r--r--net/bridge/netfilter/ebtable_nat.c16
-rw-r--r--net/decnet/netfilter/dn_rtmsg.c2
-rw-r--r--net/ipv4/netfilter/arptable_filter.c5
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c2
-rw-r--r--net/ipv4/netfilter/ipt_SYNPROXY.c2
-rw-r--r--net/ipv4/netfilter/iptable_filter.c7
-rw-r--r--net/ipv4/netfilter/iptable_mangle.c10
-rw-r--r--net/ipv4/netfilter/iptable_nat.c26
-rw-r--r--net/ipv4/netfilter/iptable_raw.c6
-rw-r--r--net/ipv4/netfilter/iptable_security.c7
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c12
-rw-r--r--net/ipv4/netfilter/nf_defrag_ipv4.c6
-rw-r--r--net/ipv6/netfilter/ip6t_SYNPROXY.c2
-rw-r--r--net/ipv6/netfilter/ip6table_filter.c5
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c10
-rw-r--r--net/ipv6/netfilter/ip6table_nat.c27
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c5
-rw-r--r--net/ipv6/netfilter/ip6table_security.c5
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c14
-rw-r--r--net/ipv6/netfilter/nf_defrag_ipv6_hooks.c6
-rw-r--r--net/netfilter/core.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c42
-rw-r--r--security/selinux/hooks.c10
26 files changed, 148 insertions, 122 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 61223c52414f..fef7e67f7101 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -42,7 +42,8 @@ int netfilter_init(void);
42 42
43struct sk_buff; 43struct sk_buff;
44 44
45typedef unsigned int nf_hookfn(unsigned int hooknum, 45struct nf_hook_ops;
46typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
46 struct sk_buff *skb, 47 struct sk_buff *skb,
47 const struct net_device *in, 48 const struct net_device *in,
48 const struct net_device *out, 49 const struct net_device *out,
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index f87736270eaa..878f008afefa 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -619,7 +619,7 @@ bad:
619 619
620/* Replicate the checks that IPv6 does on packet reception and pass the packet 620/* Replicate the checks that IPv6 does on packet reception and pass the packet
621 * to ip6tables, which doesn't support NAT, so things are fairly simple. */ 621 * to ip6tables, which doesn't support NAT, so things are fairly simple. */
622static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, 622static unsigned int br_nf_pre_routing_ipv6(const struct nf_hook_ops *ops,
623 struct sk_buff *skb, 623 struct sk_buff *skb,
624 const struct net_device *in, 624 const struct net_device *in,
625 const struct net_device *out, 625 const struct net_device *out,
@@ -669,7 +669,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
669 * receiving device) to make netfilter happy, the REDIRECT 669 * receiving device) to make netfilter happy, the REDIRECT
670 * target in particular. Save the original destination IP 670 * target in particular. Save the original destination IP
671 * address to be able to detect DNAT afterwards. */ 671 * address to be able to detect DNAT afterwards. */
672static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb, 672static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops,
673 struct sk_buff *skb,
673 const struct net_device *in, 674 const struct net_device *in,
674 const struct net_device *out, 675 const struct net_device *out,
675 int (*okfn)(struct sk_buff *)) 676 int (*okfn)(struct sk_buff *))
@@ -691,7 +692,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb,
691 return NF_ACCEPT; 692 return NF_ACCEPT;
692 693
693 nf_bridge_pull_encap_header_rcsum(skb); 694 nf_bridge_pull_encap_header_rcsum(skb);
694 return br_nf_pre_routing_ipv6(hook, skb, in, out, okfn); 695 return br_nf_pre_routing_ipv6(ops, skb, in, out, okfn);
695 } 696 }
696 697
697 if (!brnf_call_iptables && !br->nf_call_iptables) 698 if (!brnf_call_iptables && !br->nf_call_iptables)
@@ -727,7 +728,8 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb,
727 * took place when the packet entered the bridge), but we 728 * took place when the packet entered the bridge), but we
728 * register an IPv4 PRE_ROUTING 'sabotage' hook that will 729 * register an IPv4 PRE_ROUTING 'sabotage' hook that will
729 * prevent this from happening. */ 730 * prevent this from happening. */
730static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, 731static unsigned int br_nf_local_in(const struct nf_hook_ops *ops,
732 struct sk_buff *skb,
731 const struct net_device *in, 733 const struct net_device *in,
732 const struct net_device *out, 734 const struct net_device *out,
733 int (*okfn)(struct sk_buff *)) 735 int (*okfn)(struct sk_buff *))
@@ -765,7 +767,8 @@ static int br_nf_forward_finish(struct sk_buff *skb)
765 * but we are still able to filter on the 'real' indev/outdev 767 * but we are still able to filter on the 'real' indev/outdev
766 * because of the physdev module. For ARP, indev and outdev are the 768 * because of the physdev module. For ARP, indev and outdev are the
767 * bridge ports. */ 769 * bridge ports. */
768static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb, 770static unsigned int br_nf_forward_ip(const struct nf_hook_ops *ops,
771 struct sk_buff *skb,
769 const struct net_device *in, 772 const struct net_device *in,
770 const struct net_device *out, 773 const struct net_device *out,
771 int (*okfn)(struct sk_buff *)) 774 int (*okfn)(struct sk_buff *))
@@ -818,7 +821,8 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
818 return NF_STOLEN; 821 return NF_STOLEN;
819} 822}
820 823
821static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff *skb, 824static unsigned int br_nf_forward_arp(const struct nf_hook_ops *ops,
825 struct sk_buff *skb,
822 const struct net_device *in, 826 const struct net_device *in,
823 const struct net_device *out, 827 const struct net_device *out,
824 int (*okfn)(struct sk_buff *)) 828 int (*okfn)(struct sk_buff *))
@@ -878,7 +882,8 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb)
878#endif 882#endif
879 883
880/* PF_BRIDGE/POST_ROUTING ********************************************/ 884/* PF_BRIDGE/POST_ROUTING ********************************************/
881static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb, 885static unsigned int br_nf_post_routing(const struct nf_hook_ops *ops,
886 struct sk_buff *skb,
882 const struct net_device *in, 887 const struct net_device *in,
883 const struct net_device *out, 888 const struct net_device *out,
884 int (*okfn)(struct sk_buff *)) 889 int (*okfn)(struct sk_buff *))
@@ -923,7 +928,8 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb,
923/* IP/SABOTAGE *****************************************************/ 928/* IP/SABOTAGE *****************************************************/
924/* Don't hand locally destined packets to PF_INET(6)/PRE_ROUTING 929/* Don't hand locally destined packets to PF_INET(6)/PRE_ROUTING
925 * for the second time. */ 930 * for the second time. */
926static unsigned int ip_sabotage_in(unsigned int hook, struct sk_buff *skb, 931static unsigned int ip_sabotage_in(const struct nf_hook_ops *ops,
932 struct sk_buff *skb,
927 const struct net_device *in, 933 const struct net_device *in,
928 const struct net_device *out, 934 const struct net_device *out,
929 int (*okfn)(struct sk_buff *)) 935 int (*okfn)(struct sk_buff *))
diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c
index 94b2b700cff8..bb2da7b706e7 100644
--- a/net/bridge/netfilter/ebtable_filter.c
+++ b/net/bridge/netfilter/ebtable_filter.c
@@ -60,17 +60,21 @@ static const struct ebt_table frame_filter =
60}; 60};
61 61
62static unsigned int 62static unsigned int
63ebt_in_hook(unsigned int hook, struct sk_buff *skb, const struct net_device *in, 63ebt_in_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
64 const struct net_device *out, int (*okfn)(struct sk_buff *)) 64 const struct net_device *in, const struct net_device *out,
65 int (*okfn)(struct sk_buff *))
65{ 66{
66 return ebt_do_table(hook, skb, in, out, dev_net(in)->xt.frame_filter); 67 return ebt_do_table(ops->hooknum, skb, in, out,
68 dev_net(in)->xt.frame_filter);
67} 69}
68 70
69static unsigned int 71static unsigned int
70ebt_out_hook(unsigned int hook, struct sk_buff *skb, const struct net_device *in, 72ebt_out_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
71 const struct net_device *out, int (*okfn)(struct sk_buff *)) 73 const struct net_device *in, const struct net_device *out,
74 int (*okfn)(struct sk_buff *))
72{ 75{
73 return ebt_do_table(hook, skb, in, out, dev_net(out)->xt.frame_filter); 76 return ebt_do_table(ops->hooknum, skb, in, out,
77 dev_net(out)->xt.frame_filter);
74} 78}