Commit 3109d2f2 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Simon Horman

ipvs: Store ipvs not net in struct ip_vs_service

In practice struct netns_ipvs is as meaningful as struct net and more
useful as it holds the ipvs specific data.  So store a pointer to
struct netns_ipvs.

Update the accesses of param->net to access param->ipvs->net instead.

In functions where we are searching for an svc and filtering by net
filter by ipvs instead.
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 19913dec
...@@ -678,7 +678,7 @@ struct ip_vs_service { ...@@ -678,7 +678,7 @@ struct ip_vs_service {
unsigned int flags; /* service status flags */ unsigned int flags; /* service status flags */
unsigned int timeout; /* persistent timeout in ticks */ unsigned int timeout; /* persistent timeout in ticks */
__be32 netmask; /* grouping granularity, mask/plen */ __be32 netmask; /* grouping granularity, mask/plen */
struct net *net; struct netns_ipvs *ipvs;
struct list_head destinations; /* real server d-linked list */ struct list_head destinations; /* real server d-linked list */
__u32 num_dests; /* number of servers */ __u32 num_dests; /* number of servers */
......
...@@ -179,7 +179,7 @@ ip_vs_out_stats(struct ip_vs_conn *cp, struct sk_buff *skb) ...@@ -179,7 +179,7 @@ ip_vs_out_stats(struct ip_vs_conn *cp, struct sk_buff *skb)
static inline void static inline void
ip_vs_conn_stats(struct ip_vs_conn *cp, struct ip_vs_service *svc) ip_vs_conn_stats(struct ip_vs_conn *cp, struct ip_vs_service *svc)
{ {
struct netns_ipvs *ipvs = net_ipvs(svc->net); struct netns_ipvs *ipvs = svc->ipvs;
struct ip_vs_cpu_stats *s; struct ip_vs_cpu_stats *s;
s = this_cpu_ptr(cp->dest->stats.cpustats); s = this_cpu_ptr(cp->dest->stats.cpustats);
...@@ -215,7 +215,7 @@ ip_vs_conn_fill_param_persist(const struct ip_vs_service *svc, ...@@ -215,7 +215,7 @@ ip_vs_conn_fill_param_persist(const struct ip_vs_service *svc,
const union nf_inet_addr *vaddr, __be16 vport, const union nf_inet_addr *vaddr, __be16 vport,
struct ip_vs_conn_param *p) struct ip_vs_conn_param *p)
{ {
ip_vs_conn_fill_param(net_ipvs(svc->net), svc->af, protocol, caddr, cport, vaddr, ip_vs_conn_fill_param(svc->ipvs, svc->af, protocol, caddr, cport, vaddr,
vport, p); vport, p);
p->pe = rcu_dereference(svc->pe); p->pe = rcu_dereference(svc->pe);
if (p->pe && p->pe->fill_param) if (p->pe && p->pe->fill_param)
...@@ -376,7 +376,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc, ...@@ -376,7 +376,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
/* /*
* Create a new connection according to the template * Create a new connection according to the template
*/ */
ip_vs_conn_fill_param(net_ipvs(svc->net), svc->af, iph->protocol, src_addr, ip_vs_conn_fill_param(svc->ipvs, svc->af, iph->protocol, src_addr,
src_port, dst_addr, dst_port, &param); src_port, dst_addr, dst_port, &param);
cp = ip_vs_conn_new(&param, dest->af, &dest->addr, dport, flags, dest, cp = ip_vs_conn_new(&param, dest->af, &dest->addr, dport, flags, dest,
...@@ -524,7 +524,7 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, ...@@ -524,7 +524,7 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
{ {
struct ip_vs_conn_param p; struct ip_vs_conn_param p;
ip_vs_conn_fill_param(net_ipvs(svc->net), svc->af, iph->protocol, ip_vs_conn_fill_param(svc->ipvs, svc->af, iph->protocol,
caddr, cport, vaddr, vport, &p); caddr, cport, vaddr, vport, &p);
cp = ip_vs_conn_new(&p, dest->af, &dest->addr, cp = ip_vs_conn_new(&p, dest->af, &dest->addr,
dest->port ? dest->port : vport, dest->port ? dest->port : vport,
...@@ -600,7 +600,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, ...@@ -600,7 +600,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
IP_VS_DBG(6, "%s(): create a cache_bypass entry\n", __func__); IP_VS_DBG(6, "%s(): create a cache_bypass entry\n", __func__);
{ {
struct ip_vs_conn_param p; struct ip_vs_conn_param p;
ip_vs_conn_fill_param(net_ipvs(svc->net), svc->af, iph->protocol, ip_vs_conn_fill_param(svc->ipvs, svc->af, iph->protocol,
&iph->saddr, pptr[0], &iph->saddr, pptr[0],
&iph->daddr, pptr[1], &p); &iph->daddr, pptr[1], &p);
cp = ip_vs_conn_new(&p, svc->af, &daddr, 0, cp = ip_vs_conn_new(&p, svc->af, &daddr, 0,
......
This diff is collapsed.
...@@ -250,8 +250,7 @@ static void ip_vs_lblc_flush(struct ip_vs_service *svc) ...@@ -250,8 +250,7 @@ static void ip_vs_lblc_flush(struct ip_vs_service *svc)
static int sysctl_lblc_expiration(struct ip_vs_service *svc) static int sysctl_lblc_expiration(struct ip_vs_service *svc)
{ {
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
struct netns_ipvs *ipvs = net_ipvs(svc->net); return svc->ipvs->sysctl_lblc_expiration;
return ipvs->sysctl_lblc_expiration;
#else #else
return DEFAULT_EXPIRATION; return DEFAULT_EXPIRATION;
#endif #endif
......
...@@ -415,8 +415,7 @@ static void ip_vs_lblcr_flush(struct ip_vs_service *svc) ...@@ -415,8 +415,7 @@ static void ip_vs_lblcr_flush(struct ip_vs_service *svc)
static int sysctl_lblcr_expiration(struct ip_vs_service *svc) static int sysctl_lblcr_expiration(struct ip_vs_service *svc)
{ {
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
struct netns_ipvs *ipvs = net_ipvs(svc->net); return svc->ipvs->sysctl_lblcr_expiration;
return ipvs->sysctl_lblcr_expiration;
#else #else
return DEFAULT_EXPIRATION; return DEFAULT_EXPIRATION;
#endif #endif
......
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