Commit 795aa6ef authored by Patrick McHardy's avatar Patrick McHardy Committed by Pablo Neira Ayuso

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: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent ccdbb6e9
...@@ -42,7 +42,8 @@ int netfilter_init(void); ...@@ -42,7 +42,8 @@ int netfilter_init(void);
struct sk_buff; struct sk_buff;
typedef unsigned int nf_hookfn(unsigned int hooknum, struct nf_hook_ops;
typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
......
...@@ -619,7 +619,7 @@ static int check_hbh_len(struct sk_buff *skb) ...@@ -619,7 +619,7 @@ static int check_hbh_len(struct sk_buff *skb)
/* Replicate the checks that IPv6 does on packet reception and pass the packet /* Replicate the checks that IPv6 does on packet reception and pass the packet
* to ip6tables, which doesn't support NAT, so things are fairly simple. */ * to ip6tables, which doesn't support NAT, so things are fairly simple. */
static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, static unsigned int br_nf_pre_routing_ipv6(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -669,7 +669,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, ...@@ -669,7 +669,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
* receiving device) to make netfilter happy, the REDIRECT * receiving device) to make netfilter happy, the REDIRECT
* target in particular. Save the original destination IP * target in particular. Save the original destination IP
* address to be able to detect DNAT afterwards. */ * address to be able to detect DNAT afterwards. */
static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb, static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops,
struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
...@@ -691,7 +692,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb, ...@@ -691,7 +692,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb,
return NF_ACCEPT; return NF_ACCEPT;
nf_bridge_pull_encap_header_rcsum(skb); nf_bridge_pull_encap_header_rcsum(skb);
return br_nf_pre_routing_ipv6(hook, skb, in, out, okfn); return br_nf_pre_routing_ipv6(ops, skb, in, out, okfn);
} }
if (!brnf_call_iptables && !br->nf_call_iptables) 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,7 +728,8 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb,
* took place when the packet entered the bridge), but we * took place when the packet entered the bridge), but we
* register an IPv4 PRE_ROUTING 'sabotage' hook that will * register an IPv4 PRE_ROUTING 'sabotage' hook that will
* prevent this from happening. */ * prevent this from happening. */
static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, static unsigned int br_nf_local_in(const struct nf_hook_ops *ops,
struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
...@@ -765,7 +767,8 @@ static int br_nf_forward_finish(struct sk_buff *skb) ...@@ -765,7 +767,8 @@ static int br_nf_forward_finish(struct sk_buff *skb)
* but we are still able to filter on the 'real' indev/outdev * but we are still able to filter on the 'real' indev/outdev
* because of the physdev module. For ARP, indev and outdev are the * because of the physdev module. For ARP, indev and outdev are the
* bridge ports. */ * bridge ports. */
static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb, static unsigned int br_nf_forward_ip(const struct nf_hook_ops *ops,
struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
...@@ -818,7 +821,8 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb, ...@@ -818,7 +821,8 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
return NF_STOLEN; return NF_STOLEN;
} }
static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff *skb, static unsigned int br_nf_forward_arp(const struct nf_hook_ops *ops,
struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
...@@ -878,7 +882,8 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb) ...@@ -878,7 +882,8 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb)
#endif #endif
/* PF_BRIDGE/POST_ROUTING ********************************************/ /* PF_BRIDGE/POST_ROUTING ********************************************/
static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb, static unsigned int br_nf_post_routing(const struct nf_hook_ops *ops,
struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
...@@ -923,7 +928,8 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb, ...@@ -923,7 +928,8 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb,
/* IP/SABOTAGE *****************************************************/ /* IP/SABOTAGE *****************************************************/
/* Don't hand locally destined packets to PF_INET(6)/PRE_ROUTING /* Don't hand locally destined packets to PF_INET(6)/PRE_ROUTING
* for the second time. */ * for the second time. */
static unsigned int ip_sabotage_in(unsigned int hook, struct sk_buff *skb, static unsigned int ip_sabotage_in(const struct nf_hook_ops *ops,
struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
......
...@@ -60,17 +60,21 @@ static const struct ebt_table frame_filter = ...@@ -60,17 +60,21 @@ static const struct ebt_table frame_filter =
}; };
static unsigned int static unsigned int
ebt_in_hook(unsigned int hook, struct sk_buff *skb, const struct net_device *in, ebt_in_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *out, int (*okfn)(struct sk_buff *)) const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *))
{ {
return ebt_do_table(hook, skb, in, out, dev_net(in)->xt.frame_filter); return ebt_do_table(ops->hooknum, skb, in, out,
dev_net(in)->xt.frame_filter);
} }
static unsigned int static unsigned int
ebt_out_hook(unsigned int hook, struct sk_buff *skb, const struct net_device *in, ebt_out_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *out, int (*okfn)(struct sk_buff *)) const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *))
{ {
return ebt_do_table(hook, skb, in, out, dev_net(out)->xt.frame_filter); return ebt_do_table(ops->hooknum, skb, in, out,
dev_net(out)->xt.frame_filter);
} }
static struct nf_hook_ops ebt_ops_filter[] __read_mostly = { static struct nf_hook_ops ebt_ops_filter[] __read_mostly = {
......
...@@ -60,17 +60,21 @@ static struct ebt_table frame_nat = ...@@ -60,17 +60,21 @@ static struct ebt_table frame_nat =
}; };
static unsigned int static unsigned int
ebt_nat_in(unsigned int hook, struct sk_buff *skb, const struct net_device *in ebt_nat_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
, const struct net_device *out, int (*okfn)(struct sk_buff *)) const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *))
{ {
return ebt_do_table(hook, skb, in, out, dev_net(in)->xt.frame_nat); return ebt_do_table(ops->hooknum, skb, in, out,
dev_net(in)->xt.frame_nat);
} }
static unsigned int static unsigned int
ebt_nat_out(unsigned int hook, struct sk_buff *skb, const struct net_device *in ebt_nat_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
, const struct net_device *out, int (*okfn)(struct sk_buff *)) const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *))
{ {
return ebt_do_table(hook, skb, in, out, dev_net(out)->xt.frame_nat); return ebt_do_table(ops->hooknum, skb, in, out,
dev_net(out)->xt.frame_nat);
} }
static struct nf_hook_ops ebt_ops_nat[] __read_mostly = { static struct nf_hook_ops ebt_ops_nat[] __read_mostly = {
......
...@@ -87,7 +87,7 @@ static void dnrmg_send_peer(struct sk_buff *skb) ...@@ -87,7 +87,7 @@ static void dnrmg_send_peer(struct sk_buff *skb)
} }
static unsigned int dnrmg_hook(unsigned int hook, static unsigned int dnrmg_hook(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
......
...@@ -27,13 +27,14 @@ static const struct xt_table packet_filter = { ...@@ -27,13 +27,14 @@ static const struct xt_table packet_filter = {
/* The work comes in here from netfilter.c */ /* The work comes in here from netfilter.c */
static unsigned int static unsigned int
arptable_filter_hook(unsigned int hook, struct sk_buff *skb, arptable_filter_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
const struct net *net = dev_net((in != NULL) ? in : out); const struct net *net = dev_net((in != NULL) ? in : out);
return arpt_do_table(skb, hook, in, out, net->ipv4.arptable_filter); return arpt_do_table(skb, ops->hooknum, in, out,
net->ipv4.arptable_filter);
} }
static struct nf_hook_ops *arpfilter_ops __read_mostly; static struct nf_hook_ops *arpfilter_ops __read_mostly;
......
...@@ -483,7 +483,7 @@ static void arp_print(struct arp_payload *payload) ...@@ -483,7 +483,7 @@ static void arp_print(struct arp_payload *payload)
#endif #endif
static unsigned int static unsigned int
arp_mangle(unsigned int hook, arp_mangle(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
......
...@@ -297,7 +297,7 @@ synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -297,7 +297,7 @@ synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
return XT_CONTINUE; return XT_CONTINUE;
} }
static unsigned int ipv4_synproxy_hook(unsigned int hooknum, static unsigned int ipv4_synproxy_hook(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
......
...@@ -33,20 +33,21 @@ static const struct xt_table packet_filter = { ...@@ -33,20 +33,21 @@ static const struct xt_table packet_filter = {
}; };
static unsigned int static unsigned int
iptable_filter_hook(unsigned int hook, struct sk_buff *skb, iptable_filter_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
const struct net *net; const struct net *net;
if (hook == NF_INET_LOCAL_OUT && if (ops->hooknum == NF_INET_LOCAL_OUT &&
(skb->len < sizeof(struct iphdr) || (skb->len < sizeof(struct iphdr) ||
ip_hdrlen(skb) < sizeof(struct iphdr))) ip_hdrlen(skb) < sizeof(struct iphdr)))
/* root is playing with raw sockets. */ /* root is playing with raw sockets. */
return NF_ACCEPT; return NF_ACCEPT;
net = dev_net((in != NULL) ? in : out); net = dev_net((in != NULL) ? in : out);
return ipt_do_table(skb, hook, in, out, net->ipv4.iptable_filter); return ipt_do_table(skb, ops->hooknum, in, out,
net->ipv4.iptable_filter);
} }
static struct nf_hook_ops *filter_ops __read_mostly; static struct nf_hook_ops *filter_ops __read_mostly;
......
...@@ -79,19 +79,19 @@ ipt_mangle_out(struct sk_buff *skb, const struct net_device *out) ...@@ -79,19 +79,19 @@ ipt_mangle_out(struct sk_buff *skb, const struct net_device *out)
/* The work comes in here from netfilter.c. */ /* The work comes in here from netfilter.c. */
static unsigned int static unsigned int
iptable_mangle_hook(unsigned int hook, iptable_mangle_hook(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
if (hook == NF_INET_LOCAL_OUT) if (ops->hooknum == NF_INET_LOCAL_OUT)
return ipt_mangle_out(skb, out); return ipt_mangle_out(skb, out);
if (hook == NF_INET_POST_ROUTING) if (ops->hooknum == NF_INET_POST_ROUTING)
return ipt_do_table(skb, hook, in, out, return ipt_do_table(skb, ops->hooknum, in, out,
dev_net(out)->ipv4.iptable_mangle); dev_net(out)->ipv4.iptable_mangle);
/* PREROUTING/INPUT/FORWARD: */ /* PREROUTING/INPUT/FORWARD: */
return ipt_do_table(skb, hook, in, out, return ipt_do_table(skb, ops->hooknum, in, out,
dev_net(in)->ipv4.iptable_mangle); dev_net(in)->ipv4.iptable_mangle);
} }
......
...@@ -61,7 +61,7 @@ static unsigned int nf_nat_rule_find(struct sk_buff *skb, unsigned int hooknum, ...@@ -61,7 +61,7 @@ static unsigned int nf_nat_rule_find(struct sk_buff *skb, unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv4_fn(unsigned int hooknum, nf_nat_ipv4_fn(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -71,7 +71,7 @@ nf_nat_ipv4_fn(unsigned int hooknum, ...@@ -71,7 +71,7 @@ nf_nat_ipv4_fn(unsigned int hooknum,
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
struct nf_conn_nat *nat; struct nf_conn_nat *nat;
/* maniptype == SRC for postrouting. */ /* maniptype == SRC for postrouting. */
enum nf_nat_manip_type maniptype = HOOK2MANIP(hooknum); enum nf_nat_manip_type maniptype = HOOK2MANIP(ops->hooknum);
/* We never see fragments: conntrack defrags on pre-routing /* We never see fragments: conntrack defrags on pre-routing
* and local-out, and nf_nat_out protects post-routing. * and local-out, and nf_nat_out protects post-routing.
...@@ -108,7 +108,7 @@ nf_nat_ipv4_fn(unsigned int hooknum, ...@@ -108,7 +108,7 @@ nf_nat_ipv4_fn(unsigned int hooknum,
case IP_CT_RELATED_REPLY: case IP_CT_RELATED_REPLY:
if (ip_hdr(skb)->protocol == IPPROTO_ICMP) { if (ip_hdr(skb)->protocol == IPPROTO_ICMP) {
if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo, if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo,
hooknum)) ops->hooknum))
return NF_DROP; return NF_DROP;
else else
return NF_ACCEPT; return NF_ACCEPT;
...@@ -121,14 +121,14 @@ nf_nat_ipv4_fn(unsigned int hooknum, ...@@ -121,14 +121,14 @@ nf_nat_ipv4_fn(unsigned int hooknum,
if (!nf_nat_initialized(ct, maniptype)) { if (!nf_nat_initialized(ct, maniptype)) {
unsigned int ret; unsigned int ret;
ret = nf_nat_rule_find(skb, hooknum, in, out, ct); ret = nf_nat_rule_find(skb, ops->hooknum, in, out, ct);
if (ret != NF_ACCEPT) if (ret != NF_ACCEPT)
return ret; return ret;
} else { } else {
pr_debug("Already setup manip %s for ct %p\n", pr_debug("Already setup manip %s for ct %p\n",
maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST",
ct); ct);
if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) if (nf_nat_oif_changed(ops->hooknum, ctinfo, nat, out))
goto oif_changed; goto oif_changed;
} }
break; break;
...@@ -137,11 +137,11 @@ nf_nat_ipv4_fn(unsigned int hooknum, ...@@ -137,11 +137,11 @@ nf_nat_ipv4_fn(unsigned int hooknum,
/* ESTABLISHED */ /* ESTABLISHED */
NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
ctinfo == IP_CT_ESTABLISHED_REPLY); ctinfo == IP_CT_ESTABLISHED_REPLY);
if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) if (nf_nat_oif_changed(ops->hooknum, ctinfo, nat, out))
goto oif_changed; goto oif_changed;
} }
return nf_nat_packet(ct, ctinfo, hooknum, skb); return nf_nat_packet(ct, ctinfo, ops->hooknum, skb);
oif_changed: oif_changed:
nf_ct_kill_acct(ct, ctinfo, skb); nf_ct_kill_acct(ct, ctinfo, skb);
...@@ -149,7 +149,7 @@ nf_nat_ipv4_fn(unsigned int hooknum, ...@@ -149,7 +149,7 @@ nf_nat_ipv4_fn(unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv4_in(unsigned int hooknum, nf_nat_ipv4_in(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -158,7 +158,7 @@ nf_nat_ipv4_in(unsigned int hooknum, ...@@ -158,7 +158,7 @@ nf_nat_ipv4_in(unsigned int hooknum,
unsigned int ret; unsigned int ret;
__be32 daddr = ip_hdr(skb)->daddr; __be32 daddr = ip_hdr(skb)->daddr;
ret = nf_nat_ipv4_fn(hooknum, skb, in, out, okfn); ret = nf_nat_ipv4_fn(ops, skb, in, out, okfn);
if (ret != NF_DROP && ret != NF_STOLEN && if (ret != NF_DROP && ret != NF_STOLEN &&
daddr != ip_hdr(skb)->daddr) daddr != ip_hdr(skb)->daddr)
skb_dst_drop(skb); skb_dst_drop(skb);
...@@ -167,7 +167,7 @@ nf_nat_ipv4_in(unsigned int hooknum, ...@@ -167,7 +167,7 @@ nf_nat_ipv4_in(unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv4_out(unsigned int hooknum, nf_nat_ipv4_out(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -185,7 +185,7 @@ nf_nat_ipv4_out(unsigned int hooknum, ...@@ -185,7 +185,7 @@ nf_nat_ipv4_out(unsigned int hooknum,
ip_hdrlen(skb) < sizeof(struct iphdr)) ip_hdrlen(skb) < sizeof(struct iphdr))
return NF_ACCEPT; return NF_ACCEPT;
ret = nf_nat_ipv4_fn(hooknum, skb, in, out, okfn); ret = nf_nat_ipv4_fn(ops, skb, in, out, okfn);
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
if (ret != NF_DROP && ret != NF_STOLEN && if (ret != NF_DROP && ret != NF_STOLEN &&
!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && !(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
...@@ -207,7 +207,7 @@ nf_nat_ipv4_out(unsigned int hooknum, ...@@ -207,7 +207,7 @@ nf_nat_ipv4_out(unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv4_local_fn(unsigned int hooknum, nf_nat_ipv4_local_fn(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -223,7 +223,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum, ...@@ -223,7 +223,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum,
ip_hdrlen(skb) < sizeof(struct iphdr)) ip_hdrlen(skb) < sizeof(struct iphdr))
return NF_ACCEPT; return NF_ACCEPT;
ret = nf_nat_ipv4_fn(hooknum, skb, in, out, okfn); ret = nf_nat_ipv4_fn(ops, skb, in, out, okfn);
if (ret != NF_DROP && ret != NF_STOLEN && if (ret != NF_DROP && ret != NF_STOLEN &&
(ct = nf_ct_get(skb, &ctinfo)) != NULL) { (ct = nf_ct_get(skb, &ctinfo)) != NULL) {
enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
......
...@@ -20,20 +20,20 @@ static const struct xt_table packet_raw = { ...@@ -20,20 +20,20 @@ static const struct xt_table packet_raw = {
/* The work comes in here from netfilter.c. */ /* The work comes in here from netfilter.c. */
static unsigned int static unsigned int
iptable_raw_hook(unsigned int hook, struct sk_buff *skb, iptable_raw_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
const struct net *net; const struct net *net;
if (hook == NF_INET_LOCAL_OUT && if (ops->hooknum == NF_INET_LOCAL_OUT &&
(skb->len < sizeof(struct iphdr) || (skb->len < sizeof(struct iphdr) ||
ip_hdrlen(skb) < sizeof(struct iphdr))) ip_hdrlen(skb) < sizeof(struct iphdr)))
/* root is playing with raw sockets. */ /* root is playing with raw sockets. */
return NF_ACCEPT; return NF_ACCEPT;
net = dev_net((in != NULL) ? in : out); net = dev_net((in != NULL) ? in : out);
return ipt_do_table(skb, hook, in, out, net->ipv4.iptable_raw); return ipt_do_table(skb, ops->hooknum, in, out, net->ipv4.iptable_raw);
} }
static struct nf_hook_ops *rawtable_ops __read_mostly; static struct nf_hook_ops *rawtable_ops __read_mostly;
......
...@@ -37,21 +37,22 @@ static const struct xt_table security_table = { ...@@ -37,21 +37,22 @@ static const struct xt_table security_table = {
}; };
static unsigned int static unsigned int
iptable_security_hook(unsigned int hook, struct sk_buff *skb, iptable_security_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
const struct net *net; const struct net *net;
if (hook == NF_INET_LOCAL_OUT && if (ops->hooknum == NF_INET_LOCAL_OUT &&
(skb->len < sizeof(struct iphdr) || (skb->len < sizeof(struct iphdr) ||
ip_hdrlen(skb) < sizeof(struct iphdr))) ip_hdrlen(skb) < sizeof(struct iphdr)))
/* Somebody is playing with raw sockets. */ /* Somebody is playing with raw sockets. */
return NF_ACCEPT; return NF_ACCEPT;
net = dev_net((in != NULL) ? in : out); net = dev_net((in != NULL) ? in : out);
return ipt_do_table(skb, hook, in, out, net->ipv4.iptable_security); return ipt_do_table(skb, ops->hooknum, in, out,
net->ipv4.iptable_security);
} }
static struct nf_hook_ops *sectbl_ops __read_mostly; static struct nf_hook_ops *sectbl_ops __read_mostly;
......
...@@ -92,7 +92,7 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, ...@@ -92,7 +92,7 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
return NF_ACCEPT; return NF_ACCEPT;
} }
static unsigned int ipv4_helper(unsigned int hooknum, static unsigned int ipv4_helper(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -121,7 +121,7 @@ static unsigned int ipv4_helper(unsigned int hooknum, ...@@ -121,7 +121,7 @@ static unsigned int ipv4_helper(unsigned int hooknum,
ct, ctinfo); ct, ctinfo);
} }
static unsigned int ipv4_confirm(unsigned int hooknum, static unsigned int ipv4_confirm(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -147,16 +147,16 @@ static unsigned int ipv4_confirm(unsigned int hooknum, ...@@ -147,16 +147,16 @@ static unsigned int ipv4_confirm(unsigned int hooknum,
return nf_conntrack_confirm(skb); return nf_conntrack_confirm(skb);
} }
static unsigned int ipv4_conntrack_in(unsigned int hooknum, static unsigned int ipv4_conntrack_in(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return nf_conntrack_in(dev_net(in), PF_INET, hooknum, skb); return nf_conntrack_in(dev_net(in), PF_INET, ops->hooknum, skb);
} }
static unsigned int ipv4_conntrack_local(unsigned int hooknum, static unsigned int ipv4_conntrack_local(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -166,7 +166,7 @@ static unsigned int ipv4_conntrack_local(unsigned int hooknum, ...@@ -166,7 +166,7 @@ static unsigned int ipv4_conntrack_local(unsigned int hooknum,
if (skb->len < sizeof(struct iphdr) || if (skb->len < sizeof(struct iphdr) ||
ip_hdrlen(skb) < sizeof(struct iphdr)) ip_hdrlen(skb) < sizeof(struct iphdr))
return NF_ACCEPT; return NF_ACCEPT;
return nf_conntrack_in(dev_net(out), PF_INET, hooknum, skb); return nf_conntrack_in(dev_net(out), PF_INET, ops->hooknum, skb);
} }
/* Connection tracking may drop packets, but never alters them, so /* Connection tracking may drop packets, but never alters them, so
......
...@@ -60,7 +60,7 @@ static enum ip_defrag_users nf_ct_defrag_user(unsigned int hooknum, ...@@ -60,7 +60,7 @@ static enum ip_defrag_users nf_ct_defrag_user(unsigned int hooknum,
return IP_DEFRAG_CONNTRACK_OUT + zone; return IP_DEFRAG_CONNTRACK_OUT + zone;
} }
static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, static unsigned int ipv4_conntrack_defrag(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -83,7 +83,9 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, ...@@ -83,7 +83,9 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
#endif #endif
/* Gather fragments. */ /* Gather fragments. */
if (ip_is_fragment(ip_hdr(skb))) { if (ip_is_fragment(ip_hdr(skb))) {
enum ip_defrag_users user = nf_ct_defrag_user(hooknum, skb); enum ip_defrag_users user =
nf_ct_defrag_user(ops->hooknum, skb);
if (nf_ct_ipv4_gather_frags(skb, user)) if (nf_ct_ipv4_gather_frags(skb, user))
return NF_STOLEN; return NF_STOLEN;
} }
......
...@@ -312,7 +312,7 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -312,7 +312,7 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
return XT_CONTINUE; return XT_CONTINUE;
} }
static unsigned int ipv6_synproxy_hook(unsigned int hooknum, static unsigned int ipv6_synproxy_hook(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
......
...@@ -32,13 +32,14 @@ static const struct xt_table packet_filter = { ...@@ -32,13 +32,14 @@ static const struct xt_table packet_filter = {
/* The work comes in here from netfilter.c. */ /* The work comes in here from netfilter.c. */
static unsigned int static unsigned int
ip6table_filter_hook(unsigned int hook, struct sk_buff *skb, ip6table_filter_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
const struct net *net = dev_net((in != NULL) ? in : out); const struct net *net = dev_net((in != NULL) ? in : out);
return ip6t_do_table(skb, hook, in, out, net->ipv6.ip6table_filter); return ip6t_do_table(skb, ops->hooknum, in, out,
net->ipv6.ip6table_filter);
} }
static struct nf_hook_ops *filter_ops __read_mostly; static struct nf_hook_ops *filter_ops __read_mostly;
......
...@@ -76,17 +76,17 @@ ip6t_mangle_out(struct sk_buff *skb, const struct net_device *out) ...@@ -76,17 +76,17 @@ ip6t_mangle_out(struct sk_buff *skb, const struct net_device *out)
/* The work comes in here from netfilter.c. */ /* The work comes in here from netfilter.c. */
static unsigned int static unsigned int
ip6table_mangle_hook(unsigned int hook, struct sk_buff *skb, ip6table_mangle_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
if (hook == NF_INET_LOCAL_OUT) if (ops->hooknum == NF_INET_LOCAL_OUT)
return ip6t_mangle_out(skb, out); return ip6t_mangle_out(skb, out);
if (hook == NF_INET_POST_ROUTING) if (ops->hooknum == NF_INET_POST_ROUTING)
return ip6t_do_table(skb, hook, in, out, return ip6t_do_table(skb, ops->hooknum, in, out,
dev_net(out)->ipv6.ip6table_mangle); dev_net(out)->ipv6.ip6table_mangle);
/* INPUT/FORWARD */ /* INPUT/FORWARD */
return ip6t_do_table(skb, hook, in, out, return ip6t_do_table(skb, ops->hooknum, in, out,
dev_net(in)->ipv6.ip6table_mangle); dev_net(in)->ipv6.ip6table_mangle);
} }
......
...@@ -63,7 +63,7 @@ static unsigned int nf_nat_rule_find(struct sk_buff *skb, unsigned int hooknum, ...@@ -63,7 +63,7 @@ static unsigned int nf_nat_rule_find(struct sk_buff *skb, unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv6_fn(unsigned int hooknum, nf_nat_ipv6_fn(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -72,7 +72,7 @@ nf_nat_ipv6_fn(unsigned int hooknum, ...@@ -72,7 +72,7 @@ nf_nat_ipv6_fn(unsigned int hooknum,
struct nf_conn *ct; struct nf_conn *ct;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
struct nf_conn_nat *nat; struct nf_conn_nat *nat;
enum nf_nat_manip_type maniptype = HOOK2MANIP(hooknum); enum nf_nat_manip_type maniptype = HOOK2MANIP(ops->hooknum);
__be16 frag_off; __be16 frag_off;
int hdrlen; int hdrlen;
u8 nexthdr; u8 nexthdr;
...@@ -111,7 +111,8 @@ nf_nat_ipv6_fn(unsigned int hooknum, ...@@ -111,7 +111,8 @@ nf_nat_ipv6_fn(unsigned int hooknum,
if (hdrlen >= 0 && nexthdr == IPPROTO_ICMPV6) { if (hdrlen >= 0 && nexthdr == IPPROTO_ICMPV6) {
if (!nf_nat_icmpv6_reply_translation(skb, ct, ctinfo, if (!nf_nat_icmpv6_reply_translation(skb, ct, ctinfo,
hooknum, hdrlen)) ops->hooknum,
hdrlen))
return NF_DROP; return NF_DROP;
else else
return NF_ACCEPT; return NF_ACCEPT;
...@@ -124,14 +125,14 @@ nf_nat_ipv6_fn(unsigned int hooknum, ...@@ -124,14 +125,14 @@ nf_nat_ipv6_fn(unsigned int hooknum,
if (!nf_nat_initialized(ct, maniptype)) { if (!nf_nat_initialized(ct, maniptype)) {
unsigned int ret; unsigned int ret;
ret = nf_nat_rule_find(skb, hooknum, in, out, ct); ret = nf_nat_rule_find(skb, ops->hooknum, in, out, ct);
if (ret != NF_ACCEPT) if (ret != NF_ACCEPT)
return ret; return ret;
} else { } else {
pr_debug("Already setup manip %s for ct %p\n", pr_debug("Already setup manip %s for ct %p\n",
maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST",
ct); ct);
if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) if (nf_nat_oif_changed(ops->hooknum, ctinfo, nat, out))
goto oif_changed; goto oif_changed;
} }
break; break;
...@@ -140,11 +141,11 @@ nf_nat_ipv6_fn(unsigned int hooknum, ...@@ -140,11 +141,11 @@ nf_nat_ipv6_fn(unsigned int hooknum,
/* ESTABLISHED */ /* ESTABLISHED */
NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
ctinfo == IP_CT_ESTABLISHED_REPLY); ctinfo == IP_CT_ESTABLISHED_REPLY);
if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) if (nf_nat_oif_changed(ops->hooknum, ctinfo, nat, out))
goto oif_changed; goto oif_changed;
} }
return nf_nat_packet(ct, ctinfo, hooknum, skb); return nf_nat_packet(ct, ctinfo, ops->hooknum, skb);
oif_changed: oif_changed:
nf_ct_kill_acct(ct, ctinfo, skb); nf_ct_kill_acct(ct, ctinfo, skb);
...@@ -152,7 +153,7 @@ nf_nat_ipv6_fn(unsigned int hooknum, ...@@ -152,7 +153,7 @@ nf_nat_ipv6_fn(unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv6_in(unsigned int hooknum, nf_nat_ipv6_in(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -161,7 +162,7 @@ nf_nat_ipv6_in(unsigned int hooknum, ...@@ -161,7 +162,7 @@ nf_nat_ipv6_in(unsigned int hooknum,
unsigned int ret; unsigned int ret;
struct in6_addr daddr = ipv6_hdr(skb)->daddr; struct in6_addr daddr = ipv6_hdr(skb)->daddr;
ret = nf_nat_ipv6_fn(hooknum, skb, in, out, okfn); ret = nf_nat_ipv6_fn(ops, skb, in, out, okfn);
if (ret != NF_DROP && ret != NF_STOLEN && if (ret != NF_DROP && ret != NF_STOLEN &&
ipv6_addr_cmp(&daddr, &ipv6_hdr(skb)->daddr)) ipv6_addr_cmp(&daddr, &ipv6_hdr(skb)->daddr))
skb_dst_drop(skb); skb_dst_drop(skb);
...@@ -170,7 +171,7 @@ nf_nat_ipv6_in(unsigned int hooknum, ...@@ -170,7 +171,7 @@ nf_nat_ipv6_in(unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv6_out(unsigned int hooknum, nf_nat_ipv6_out(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -187,7 +188,7 @@ nf_nat_ipv6_out(unsigned int hooknum, ...@@ -187,7 +188,7 @@ nf_nat_ipv6_out(unsigned int hooknum,
if (skb->len < sizeof(struct ipv6hdr)) if (skb->len < sizeof(struct ipv6hdr))
return NF_ACCEPT; return NF_ACCEPT;
ret = nf_nat_ipv6_fn(hooknum, skb, in, out, okfn); ret = nf_nat_ipv6_fn(ops, skb, in, out, okfn);
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
if (ret != NF_DROP && ret != NF_STOLEN && if (ret != NF_DROP && ret != NF_STOLEN &&
!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && !(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
...@@ -209,7 +210,7 @@ nf_nat_ipv6_out(unsigned int hooknum, ...@@ -209,7 +210,7 @@ nf_nat_ipv6_out(unsigned int hooknum,
} }
static unsigned int static unsigned int
nf_nat_ipv6_local_fn(unsigned int hooknum, nf_nat_ipv6_local_fn(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -224,7 +225,7 @@ nf_nat_ipv6_local_fn(unsigned int hooknum, ...@@ -224,7 +225,7 @@ nf_nat_ipv6_local_fn(unsigned int hooknum,
if (skb->len < sizeof(struct ipv6hdr)) if (skb->len < sizeof(struct ipv6hdr))
return NF_ACCEPT; return NF_ACCEPT;
ret = nf_nat_ipv6_fn(hooknum, skb, in, out, okfn); ret = nf_nat_ipv6_fn(ops, skb, in, out, okfn);
if (ret != NF_DROP && ret != NF_STOLEN && if (ret != NF_DROP && ret != NF_STOLEN &&
(ct = nf_ct_get(skb, &ctinfo)) != NULL) { (ct = nf_ct_get(skb, &ctinfo)) != NULL) {
enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
......
...@@ -19,13 +19,14 @@ static const struct xt_table packet_raw = { ...@@ -19,13 +19,14 @@ static const struct xt_table packet_raw = {
/* The work comes in here from netfilter.c. */ /* The work comes in here from netfilter.c. */
static unsigned int static unsigned int
ip6table_raw_hook(unsigned int hook, struct sk_buff *skb, ip6table_raw_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
const struct net *net = dev_net((in != NULL) ? in : out); const struct net *net = dev_net((in != NULL) ? in : out);
return ip6t_do_table(skb, hook, in, out, net->ipv6.ip6table_raw); return ip6t_do_table(skb, ops->hooknum, in, out,
net->ipv6.ip6table_raw);
} }
static struct nf_hook_ops *rawtable_ops __read_mostly; static struct nf_hook_ops *rawtable_ops __read_mostly;
......
...@@ -36,14 +36,15 @@ static const struct xt_table security_table = { ...@@ -36,14 +36,15 @@ static const struct xt_table security_table = {
}; };
static unsigned int static unsigned int
ip6table_security_hook(unsigned int hook, struct sk_buff *skb, ip6table_security_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
const struct net *net = dev_net((in != NULL) ? in : out); const struct net *net = dev_net((in != NULL) ? in : out);
return ip6t_do_table(skb, hook, in, out, net->ipv6.ip6table_security); return ip6t_do_table(skb, ops->hooknum, in, out,
net->ipv6.ip6table_security);
} }
static struct nf_hook_ops *sectbl_ops __read_mostly; static struct nf_hook_ops *sectbl_ops __read_mostly;
......
...@@ -95,7 +95,7 @@ static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, ...@@ -95,7 +95,7 @@ static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
return NF_ACCEPT; return NF_ACCEPT;
} }
static unsigned int ipv6_helper(unsigned int hooknum, static unsigned int ipv6_helper(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -133,7 +133,7 @@ static unsigned int ipv6_helper(unsigned int hooknum, ...@@ -133,7 +133,7 @@ static unsigned int ipv6_helper(unsigned int hooknum,
return helper->help(skb, protoff, ct, ctinfo); return helper->help(skb, protoff, ct, ctinfo);
} }
static unsigned int ipv6_confirm(unsigned int hooknum, static unsigned int ipv6_confirm(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -219,16 +219,17 @@ static unsigned int __ipv6_conntrack_in(struct net *net, ...@@ -219,16 +219,17 @@ static unsigned int __ipv6_conntrack_in(struct net *net,
return nf_conntrack_in(net, PF_INET6, hooknum, skb); return nf_conntrack_in(net, PF_INET6, hooknum, skb);
} }
static unsigned int ipv6_conntrack_in(unsigned int hooknum, static unsigned int ipv6_conntrack_in(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return __ipv6_conntrack_in(dev_net(in), hooknum, skb, in, out, okfn); return __ipv6_conntrack_in(dev_net(in), ops->hooknum, skb, in, out,
okfn);
} }
static unsigned int ipv6_conntrack_local(unsigned int hooknum, static unsigned int ipv6_conntrack_local(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -239,7 +240,8 @@ static unsigned int ipv6_conntrack_local(unsigned int hooknum, ...@@ -239,7 +240,8 @@ static unsigned int ipv6_conntrack_local(unsigned int hooknum,
net_notice_ratelimited("ipv6_conntrack_local: packet too short\n"); net_notice_ratelimited("ipv6_conntrack_local: packet too short\n");
return NF_ACCEPT; return NF_ACCEPT;
} }
return __ipv6_conntrack_in(dev_net(out), hooknum, skb, in, out, okfn); return __ipv6_conntrack_in(dev_net(out), ops->hooknum, skb, in, out,
okfn);
} }
static struct nf_hook_ops ipv6_conntrack_ops[] __read_mostly = { static struct nf_hook_ops ipv6_conntrack_ops[] __read_mostly = {
......
...@@ -52,7 +52,7 @@ static enum ip6_defrag_users nf_ct6_defrag_user(unsigned int hooknum, ...@@ -52,7 +52,7 @@ static enum ip6_defrag_users nf_ct6_defrag_user(unsigned int hooknum,
} }
static unsigned int ipv6_defrag(unsigned int hooknum, static unsigned int ipv6_defrag(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -66,7 +66,7 @@ static unsigned int ipv6_defrag(unsigned int hooknum, ...@@ -66,7 +66,7 @@ static unsigned int ipv6_defrag(unsigned int hooknum,
return NF_ACCEPT; return NF_ACCEPT;
#endif #endif
reasm = nf_ct_frag6_gather(skb, nf_ct6_defrag_user(hooknum, skb)); reasm = nf_ct_frag6_gather(skb, nf_ct6_defrag_user(ops->hooknum, skb));
/* queued */ /* queued */
if (reasm == NULL) if (reasm == NULL)
return NF_STOLEN; return NF_STOLEN;
...@@ -75,7 +75,7 @@ static unsigned int ipv6_defrag(unsigned int hooknum, ...@@ -75,7 +75,7 @@ static unsigned int ipv6_defrag(unsigned int hooknum,
if (reasm == skb) if (reasm == skb)
return NF_ACCEPT; return NF_ACCEPT;
nf_ct_frag6_output(hooknum, reasm, (struct net_device *)in, nf_ct_frag6_output(ops->hooknum, reasm, (struct net_device *)in,
(struct net_device *)out, okfn); (struct net_device *)out, okfn);
return NF_STOLEN; return NF_STOLEN;
......
...@@ -146,7 +146,7 @@ unsigned int nf_iterate(struct list_head *head, ...@@ -146,7 +146,7 @@ unsigned int nf_iterate(struct list_head *head,
/* Optimization: we don't need to hold module /* Optimization: we don't need to hold module
reference here, since function can't sleep. --RR */ reference here, since function can't sleep. --RR */
repeat: repeat:
verdict = (*elemp)->hook(hook, skb, indev, outdev, okfn); verdict = (*elemp)->hook(*elemp, skb, indev, outdev, okfn);
if (verdict != NF_ACCEPT) { if (verdict != NF_ACCEPT) {
#ifdef CONFIG_NETFILTER_DEBUG #ifdef CONFIG_NETFILTER_DEBUG
if (unlikely((verdict & NF_VERDICT_MASK) if (unlikely((verdict & NF_VERDICT_MASK)
......
...@@ -1239,11 +1239,11 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af) ...@@ -1239,11 +1239,11 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
* Check if packet is reply for established ip_vs_conn. * Check if packet is reply for established ip_vs_conn.
*/ */
static unsigned int static unsigned int
ip_vs_reply4(unsigned int hooknum, struct sk_buff *skb, ip_vs_reply4(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_out(hooknum, skb, AF_INET); return ip_vs_out(ops->hooknum, skb, AF_INET);
} }
/* /*
...@@ -1251,11 +1251,11 @@ ip_vs_reply4(unsigned int hooknum, struct sk_buff *skb, ...@@ -1251,11 +1251,11 @@ ip_vs_reply4(unsigned int hooknum, struct sk_buff *skb,
* Check if packet is reply for established ip_vs_conn. * Check if packet is reply for established ip_vs_conn.
*/ */
static unsigned int static unsigned int
ip_vs_local_reply4(unsigned int hooknum, struct sk_buff *skb, ip_vs_local_reply4(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_out(hooknum, skb, AF_INET); return ip_vs_out(ops->hooknum, skb, AF_INET);
} }
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
...@@ -1266,11 +1266,11 @@ ip_vs_local_reply4(unsigned int hooknum, struct sk_buff *skb, ...@@ -1266,11 +1266,11 @@ ip_vs_local_reply4(unsigned int hooknum, struct sk_buff *skb,
* Check if packet is reply for established ip_vs_conn. * Check if packet is reply for established ip_vs_conn.
*/ */
static unsigned int static unsigned int
ip_vs_reply6(unsigned int hooknum, struct sk_buff *skb, ip_vs_reply6(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_out(hooknum, skb, AF_INET6); return ip_vs_out(ops->hooknum, skb, AF_INET6);
} }
/* /*
...@@ -1278,11 +1278,11 @@ ip_vs_reply6(unsigned int hooknum, struct sk_buff *skb, ...@@ -1278,11 +1278,11 @@ ip_vs_reply6(unsigned int hooknum, struct sk_buff *skb,
* Check if packet is reply for established ip_vs_conn. * Check if packet is reply for established ip_vs_conn.
*/ */
static unsigned int static unsigned int
ip_vs_local_reply6(unsigned int hooknum, struct sk_buff *skb, ip_vs_local_reply6(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_out(hooknum, skb, AF_INET6); return ip_vs_out(ops->hooknum, skb, AF_INET6);
} }
#endif #endif
...@@ -1733,12 +1733,12 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) ...@@ -1733,12 +1733,12 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
* Schedule and forward packets from remote clients * Schedule and forward packets from remote clients
*/ */
static unsigned int static unsigned int
ip_vs_remote_request4(unsigned int hooknum, struct sk_buff *skb, ip_vs_remote_request4(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_in(hooknum, skb, AF_INET); return ip_vs_in(ops->hooknum, skb, AF_INET);
} }
/* /*
...@@ -1746,11 +1746,11 @@ ip_vs_remote_request4(unsigned int hooknum, struct sk_buff *skb, ...@@ -1746,11 +1746,11 @@ ip_vs_remote_request4(unsigned int hooknum, struct sk_buff *skb,
* Schedule and forward packets from local clients * Schedule and forward packets from local clients
*/ */
static unsigned int static unsigned int
ip_vs_local_request4(unsigned int hooknum, struct sk_buff *skb, ip_vs_local_request4(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_in(hooknum, skb, AF_INET); return ip_vs_in(ops->hooknum, skb, AF_INET);
} }
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
...@@ -1760,7 +1760,7 @@ ip_vs_local_request4(unsigned int hooknum, struct sk_buff *skb, ...@@ -1760,7 +1760,7 @@ ip_vs_local_request4(unsigned int hooknum, struct sk_buff *skb,
* Copy info from first fragment, to the rest of them. * Copy info from first fragment, to the rest of them.
*/ */
static unsigned int static unsigned int
ip_vs_preroute_frag6(unsigned int hooknum, struct sk_buff *skb, ip_vs_preroute_frag6(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
...@@ -1792,12 +1792,12 @@ ip_vs_preroute_frag6(unsigned int hooknum, struct sk_buff *skb, ...@@ -1792,12 +1792,12 @@ ip_vs_preroute_frag6(unsigned int hooknum, struct sk_buff *skb,
* Schedule and forward packets from remote clients * Schedule and forward packets from remote clients
*/ */
static unsigned int static unsigned int
ip_vs_remote_request6(unsigned int hooknum, struct sk_buff *skb, ip_vs_remote_request6(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_in(hooknum, skb, AF_INET6); return ip_vs_in(ops->hooknum, skb, AF_INET6);
} }
/* /*
...@@ -1805,11 +1805,11 @@ ip_vs_remote_request6(unsigned int hooknum, struct sk_buff *skb, ...@@ -1805,11 +1805,11 @@ ip_vs_remote_request6(unsigned int hooknum, struct sk_buff *skb,
* Schedule and forward packets from local clients * Schedule and forward packets from local clients
*/ */
static unsigned int static unsigned int
ip_vs_local_request6(unsigned int hooknum, struct sk_buff *skb, ip_vs_local_request6(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
return ip_vs_in(hooknum, skb, AF_INET6); return ip_vs_in(ops->hooknum, skb, AF_INET6);
} }
#endif #endif
...@@ -1825,7 +1825,7 @@ ip_vs_local_request6(unsigned int hooknum, struct sk_buff *skb, ...@@ -1825,7 +1825,7 @@ ip_vs_local_request6(unsigned int hooknum, struct sk_buff *skb,
* and send them to ip_vs_in_icmp. * and send them to ip_vs_in_icmp.
*/ */
static unsigned int static unsigned int
ip_vs_forward_icmp(unsigned int hooknum, struct sk_buff *skb, ip_vs_forward_icmp(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
...@@ -1842,12 +1842,12 @@ ip_vs_forward_icmp(unsigned int hooknum, struct sk_buff *skb, ...@@ -1842,12 +1842,12 @@ ip_vs_forward_icmp(unsigned int hooknum, struct sk_buff *skb,
if (unlikely(sysctl_backup_only(ipvs) || !ipvs->enable)) if (unlikely(sysctl_backup_only(ipvs) || !ipvs->enable))
return NF_ACCEPT; return NF_ACCEPT;
return ip_vs_in_icmp(skb, &r, hooknum); return ip_vs_in_icmp(skb, &r, ops->hooknum);
} }
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
static unsigned int static unsigned int
ip_vs_forward_icmp_v6(unsigned int hooknum, struct sk_buff *skb, ip_vs_forward_icmp_v6(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out, const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
...@@ -1866,7 +1866,7 @@ ip_vs_forward_icmp_v6(unsigned int hooknum, struct sk_buff *skb, ...@@ -1866,7 +1866,7 @@ ip_vs_forward_icmp_v6(unsigned int hooknum, struct sk_buff *skb,
if (unlikely(sysctl_backup_only(ipvs) || !ipvs->enable)) if (unlikely(sysctl_backup_only(ipvs) || !ipvs->enable))
return NF_ACCEPT; return NF_ACCEPT;
return ip_vs_in_icmp_v6(skb, &r, hooknum, &iphdr); return ip_vs_in_icmp_v6(skb, &r, ops->hooknum, &iphdr);
} }
#endif #endif
......
...@@ -4668,7 +4668,7 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, int ifindex, ...@@ -4668,7 +4668,7 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, int ifindex,
return NF_ACCEPT; return NF_ACCEPT;
} }
static unsigned int selinux_ipv4_forward(unsigned int hooknum, static unsigned int selinux_ipv4_forward(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -4678,7 +4678,7 @@ static unsigned int selinux_ipv4_forward(unsigned int hooknum, ...@@ -4678,7 +4678,7 @@ static unsigned int selinux_ipv4_forward(unsigned int hooknum,
} }
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
static unsigned int selinux_ipv6_forward(unsigned int hooknum, static unsigned int selinux_ipv6_forward(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -4710,7 +4710,7 @@ static unsigned int selinux_ip_output(struct sk_buff *skb, ...@@ -4710,7 +4710,7 @@ static unsigned int selinux_ip_output(struct sk_buff *skb,
return NF_ACCEPT; return NF_ACCEPT;
} }
static unsigned int selinux_ipv4_output(unsigned int hooknum, static unsigned int selinux_ipv4_output(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -4837,7 +4837,7 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, ...@@ -4837,7 +4837,7 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex,
return NF_ACCEPT; return NF_ACCEPT;
} }
static unsigned int selinux_ipv4_postroute(unsigned int hooknum, static unsigned int selinux_ipv4_postroute(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
...@@ -4847,7 +4847,7 @@ static unsigned int selinux_ipv4_postroute(unsigned int hooknum, ...@@ -4847,7 +4847,7 @@ static unsigned int selinux_ipv4_postroute(unsigned int hooknum,
} }
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
static unsigned int selinux_ipv6_postroute(unsigned int hooknum, static unsigned int selinux_ipv6_postroute(const struct nf_hook_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment