[PATCH next 07/84] ipvs: Store ipvs not net in struct ip_vs_service

2015-09-21 Thread Eric W. Biederman
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: "Eric W. Biederman" 
---
 include/net/ip_vs.h  |  2 +-
 net/netfilter/ipvs/ip_vs_core.c  | 10 +++
 net/netfilter/ipvs/ip_vs_ctl.c   | 64 ++--
 net/netfilter/ipvs/ip_vs_lblc.c  |  3 +-
 net/netfilter/ipvs/ip_vs_lblcr.c |  3 +-
 5 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 83e2aea63db2..2c22380b9ad7 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -678,7 +678,7 @@ struct ip_vs_service {
unsigned intflags;/* service status flags */
unsigned inttimeout;  /* persistent timeout in ticks */
__be32  netmask;  /* grouping granularity, mask/plen */
-   struct net  *net;
+   struct netns_ipvs   *ipvs;
 
struct list_headdestinations;  /* real server d-linked list */
__u32   num_dests; /* number of servers */
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index fd02aec0a11a..583199c2bcdc 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -179,7 +179,7 @@ ip_vs_out_stats(struct ip_vs_conn *cp, struct sk_buff *skb)
 static inline void
 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;
 
s = this_cpu_ptr(cp->dest->stats.cpustats);
@@ -215,7 +215,7 @@ ip_vs_conn_fill_param_persist(const struct ip_vs_service 
*svc,
  const union nf_inet_addr *vaddr, __be16 vport,
  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);
p->pe = rcu_dereference(svc->pe);
if (p->pe && p->pe->fill_param)
@@ -376,7 +376,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
/*
 *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, );
 
cp = ip_vs_conn_new(, dest->af, >addr, dport, flags, dest,
@@ -524,7 +524,7 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff 
*skb,
{
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, );
cp = ip_vs_conn_new(, dest->af, >addr,
dest->port ? dest->port : vport,
@@ -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__);
{
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,
  >saddr, pptr[0],
  >daddr, pptr[1], );
cp = ip_vs_conn_new(, svc->af, , 0,
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 6162ae56e47a..7132e83617b6 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -309,14 +309,14 @@ static int ip_vs_svc_hash(struct ip_vs_service *svc)
/*
 *  Hash it by  in ip_vs_svc_table
 */
-   hash = ip_vs_svc_hashkey(svc->net, svc->af, svc->protocol,
+   hash = ip_vs_svc_hashkey(svc->ipvs->net, svc->af, svc->protocol,
 >addr, svc->port);
hlist_add_head_rcu(>s_list, _vs_svc_table[hash]);
} else {
/*
 *  Hash it by fwmark in svc_fwm_table
 */
-   hash = ip_vs_svc_fwm_hashkey(svc->net, svc->fwmark);
+   hash = ip_vs_svc_fwm_hashkey(svc->ipvs->net, svc->fwmark);
hlist_add_head_rcu(>f_list, _vs_svc_fwm_table[hash]);
}
 
@@ -360,6 +360,7 @@ static inline struct ip_vs_service *
 

[PATCH next 07/84] ipvs: Store ipvs not net in struct ip_vs_service

2015-09-20 Thread Eric W. Biederman
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: "Eric W. Biederman" 
---
 include/net/ip_vs.h  |  2 +-
 net/netfilter/ipvs/ip_vs_core.c  | 10 +++
 net/netfilter/ipvs/ip_vs_ctl.c   | 64 ++--
 net/netfilter/ipvs/ip_vs_lblc.c  |  3 +-
 net/netfilter/ipvs/ip_vs_lblcr.c |  3 +-
 5 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 83e2aea63db2..2c22380b9ad7 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -678,7 +678,7 @@ struct ip_vs_service {
unsigned intflags;/* service status flags */
unsigned inttimeout;  /* persistent timeout in ticks */
__be32  netmask;  /* grouping granularity, mask/plen */
-   struct net  *net;
+   struct netns_ipvs   *ipvs;
 
struct list_headdestinations;  /* real server d-linked list */
__u32   num_dests; /* number of servers */
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index fd02aec0a11a..583199c2bcdc 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -179,7 +179,7 @@ ip_vs_out_stats(struct ip_vs_conn *cp, struct sk_buff *skb)
 static inline void
 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;
 
s = this_cpu_ptr(cp->dest->stats.cpustats);
@@ -215,7 +215,7 @@ ip_vs_conn_fill_param_persist(const struct ip_vs_service 
*svc,
  const union nf_inet_addr *vaddr, __be16 vport,
  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);
p->pe = rcu_dereference(svc->pe);
if (p->pe && p->pe->fill_param)
@@ -376,7 +376,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
/*
 *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, );
 
cp = ip_vs_conn_new(, dest->af, >addr, dport, flags, dest,
@@ -524,7 +524,7 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff 
*skb,
{
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, );
cp = ip_vs_conn_new(, dest->af, >addr,
dest->port ? dest->port : vport,
@@ -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__);
{
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,
  >saddr, pptr[0],
  >daddr, pptr[1], );
cp = ip_vs_conn_new(, svc->af, , 0,
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index b88a1daeb78e..2277da6b8e9f 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -309,14 +309,14 @@ static int ip_vs_svc_hash(struct ip_vs_service *svc)
/*
 *  Hash it by  in ip_vs_svc_table
 */
-   hash = ip_vs_svc_hashkey(svc->net, svc->af, svc->protocol,
+   hash = ip_vs_svc_hashkey(svc->ipvs->net, svc->af, svc->protocol,
 >addr, svc->port);
hlist_add_head_rcu(>s_list, _vs_svc_table[hash]);
} else {
/*
 *  Hash it by fwmark in svc_fwm_table
 */
-   hash = ip_vs_svc_fwm_hashkey(svc->net, svc->fwmark);
+   hash = ip_vs_svc_fwm_hashkey(svc->ipvs->net, svc->fwmark);
hlist_add_head_rcu(>f_list, _vs_svc_fwm_table[hash]);
}
 
@@ -360,6 +360,7 @@ static inline struct ip_vs_service *