aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2021-10-12 19:29:56 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2021-10-14 23:06:53 +0200
commit9dd43a5f4b11b161c9dfcce9391e843e65d6a4cc (patch)
treec4b62f54fad809b4ab212a81b6fde7a91f2d09ca /net/netfilter
parentnetfilter: ebtables: allow use of ebt_do_table as hookfn (diff)
downloadlinux-dev-9dd43a5f4b11b161c9dfcce9391e843e65d6a4cc.tar.xz
linux-dev-9dd43a5f4b11b161c9dfcce9391e843e65d6a4cc.zip
netfilter: ipvs: prepare for hook function reduction
ipvs has multiple one-line wrappers for hooks, compact them. To avoid a large patch make the two most common helpers use the same function signature as hooks. Next patches can then remove the oneline wrappers. Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 128690c512df..5a5deee3425c 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1330,12 +1330,15 @@ drop:
* Check if outgoing packet belongs to the established ip_vs_conn.
*/
static unsigned int
-ip_vs_out(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int af)
+ip_vs_out_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *state)
{
+ struct netns_ipvs *ipvs = net_ipvs(state->net);
+ unsigned int hooknum = state->hook;
struct ip_vs_iphdr iph;
struct ip_vs_protocol *pp;
struct ip_vs_proto_data *pd;
struct ip_vs_conn *cp;
+ int af = state->pf;
struct sock *sk;
EnterFunction(11);
@@ -1477,7 +1480,7 @@ static unsigned int
ip_vs_reply4(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_out(net_ipvs(state->net), state->hook, skb, AF_INET);
+ return ip_vs_out_hook(priv, skb, state);
}
/*
@@ -1488,7 +1491,7 @@ static unsigned int
ip_vs_local_reply4(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_out(net_ipvs(state->net), state->hook, skb, AF_INET);
+ return ip_vs_out_hook(priv, skb, state);
}
#ifdef CONFIG_IP_VS_IPV6
@@ -1502,7 +1505,7 @@ static unsigned int
ip_vs_reply6(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_out(net_ipvs(state->net), state->hook, skb, AF_INET6);
+ return ip_vs_out_hook(priv, skb, state);
}
/*
@@ -1513,7 +1516,7 @@ static unsigned int
ip_vs_local_reply6(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_out(net_ipvs(state->net), state->hook, skb, AF_INET6);
+ return ip_vs_out_hook(priv, skb, state);
}
#endif
@@ -1957,8 +1960,10 @@ out:
* and send it on its way...
*/
static unsigned int
-ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int af)
+ip_vs_in_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *state)
{
+ struct netns_ipvs *ipvs = net_ipvs(state->net);
+ unsigned int hooknum = state->hook;
struct ip_vs_iphdr iph;
struct ip_vs_protocol *pp;
struct ip_vs_proto_data *pd;
@@ -1966,6 +1971,7 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int
int ret, pkts;
int conn_reuse_mode;
struct sock *sk;
+ int af = state->pf;
/* Already marked as IPVS request or reply? */
if (skb->ipvs_property)
@@ -2145,7 +2151,7 @@ static unsigned int
ip_vs_remote_request4(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_in(net_ipvs(state->net), state->hook, skb, AF_INET);
+ return ip_vs_in_hook(priv, skb, state);
}
/*
@@ -2156,7 +2162,7 @@ static unsigned int
ip_vs_local_request4(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_in(net_ipvs(state->net), state->hook, skb, AF_INET);
+ return ip_vs_in_hook(priv, skb, state);
}
#ifdef CONFIG_IP_VS_IPV6
@@ -2169,7 +2175,7 @@ static unsigned int
ip_vs_remote_request6(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_in(net_ipvs(state->net), state->hook, skb, AF_INET6);
+ return ip_vs_in_hook(priv, skb, state);
}
/*
@@ -2180,7 +2186,7 @@ static unsigned int
ip_vs_local_request6(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state)
{
- return ip_vs_in(net_ipvs(state->net), state->hook, skb, AF_INET6);
+ return ip_vs_in_hook(priv, skb, state);
}
#endif