ipvs: Pass ipvs into .conn_in_get and ip_vs_conn_in_get_proto
[deliverable/linux.git] / net / netfilter / ipvs / ip_vs_conn.c
index 72c47ee2f9f53efea8b67bfde43ea0415ff00b28..439d6fb8bc296da1ca48d61722281506a7b3fdc1 100644 (file)
@@ -148,7 +148,7 @@ static unsigned int ip_vs_conn_hashkey_conn(const struct ip_vs_conn *cp)
 {
        struct ip_vs_conn_param p;
 
-       ip_vs_conn_fill_param(cp->ipvs->net, cp->af, cp->protocol,
+       ip_vs_conn_fill_param(cp->ipvs, cp->af, cp->protocol,
                              &cp->caddr, cp->cport, NULL, 0, &p);
 
        if (cp->pe) {
@@ -314,33 +314,34 @@ struct ip_vs_conn *ip_vs_conn_in_get(const struct ip_vs_conn_param *p)
 }
 
 static int
-ip_vs_conn_fill_param_proto(int af, const struct sk_buff *skb,
+ip_vs_conn_fill_param_proto(struct netns_ipvs *ipvs,
+                           int af, const struct sk_buff *skb,
                            const struct ip_vs_iphdr *iph,
                            struct ip_vs_conn_param *p)
 {
        __be16 _ports[2], *pptr;
-       struct net *net = skb_net(skb);
 
        pptr = frag_safe_skb_hp(skb, iph->len, sizeof(_ports), _ports, iph);
        if (pptr == NULL)
                return 1;
 
        if (likely(!ip_vs_iph_inverse(iph)))
-               ip_vs_conn_fill_param(net, af, iph->protocol, &iph->saddr,
+               ip_vs_conn_fill_param(ipvs, af, iph->protocol, &iph->saddr,
                                      pptr[0], &iph->daddr, pptr[1], p);
        else
-               ip_vs_conn_fill_param(net, af, iph->protocol, &iph->daddr,
+               ip_vs_conn_fill_param(ipvs, af, iph->protocol, &iph->daddr,
                                      pptr[1], &iph->saddr, pptr[0], p);
        return 0;
 }
 
 struct ip_vs_conn *
-ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
+ip_vs_conn_in_get_proto(struct netns_ipvs *ipvs, int af,
+                       const struct sk_buff *skb,
                        const struct ip_vs_iphdr *iph)
 {
        struct ip_vs_conn_param p;
 
-       if (ip_vs_conn_fill_param_proto(af, skb, iph, &p))
+       if (ip_vs_conn_fill_param_proto(ipvs, af, skb, iph, &p))
                return NULL;
 
        return ip_vs_conn_in_get(&p);
@@ -442,9 +443,10 @@ struct ip_vs_conn *
 ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
                         const struct ip_vs_iphdr *iph)
 {
+       struct netns_ipvs *ipvs = net_ipvs(skb_net(skb));
        struct ip_vs_conn_param p;
 
-       if (ip_vs_conn_fill_param_proto(af, skb, iph, &p))
+       if (ip_vs_conn_fill_param_proto(ipvs, af, skb, iph, &p))
                return NULL;
 
        return ip_vs_conn_out_get(&p);
@@ -638,7 +640,7 @@ void ip_vs_try_bind_dest(struct ip_vs_conn *cp)
         * so we can make the assumption that the svc_af is the same as the
         * dest_af
         */
-       dest = ip_vs_find_dest(cp->ipvs->net, cp->af, cp->af, &cp->daddr,
+       dest = ip_vs_find_dest(cp->ipvs, cp->af, cp->af, &cp->daddr,
                               cp->dport, &cp->vaddr, cp->vport,
                               cp->protocol, cp->fwmark, cp->flags);
        if (dest) {
@@ -668,7 +670,7 @@ void ip_vs_try_bind_dest(struct ip_vs_conn *cp)
 #endif
                        ip_vs_bind_xmit(cp);
 
-               pd = ip_vs_proto_data_get(cp->ipvs->net, cp->protocol);
+               pd = ip_vs_proto_data_get(cp->ipvs, cp->protocol);
                if (pd && atomic_read(&pd->appcnt))
                        ip_vs_bind_app(cp, pd->pp);
        }
@@ -801,7 +803,6 @@ static void ip_vs_conn_expire(unsigned long data)
 {
        struct ip_vs_conn *cp = (struct ip_vs_conn *)data;
        struct netns_ipvs *ipvs = cp->ipvs;
-       struct net *net = ipvs->net;
 
        /*
         *      do I control anybody?
@@ -847,7 +848,7 @@ static void ip_vs_conn_expire(unsigned long data)
        cp->timeout = 60*HZ;
 
        if (ipvs->sync_state & IP_VS_STATE_MASTER)
-               ip_vs_sync_conn(net, cp, sysctl_sync_threshold(ipvs));
+               ip_vs_sync_conn(ipvs, cp, sysctl_sync_threshold(ipvs));
 
        ip_vs_conn_put(cp);
 }
@@ -876,7 +877,7 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p, int dest_af,
 {
        struct ip_vs_conn *cp;
        struct netns_ipvs *ipvs = p->ipvs;
-       struct ip_vs_proto_data *pd = ip_vs_proto_data_get(p->ipvs->net,
+       struct ip_vs_proto_data *pd = ip_vs_proto_data_get(p->ipvs,
                                                           p->protocol);
 
        cp = kmem_cache_alloc(ip_vs_conn_cachep, GFP_ATOMIC);
@@ -1240,7 +1241,7 @@ static inline int todrop_entry(struct ip_vs_conn *cp)
 }
 
 /* Called from keventd and must protect itself from softirqs */
-void ip_vs_random_dropentry(struct net *net)
+void ip_vs_random_dropentry(struct netns_ipvs *ipvs)
 {
        int idx;
        struct ip_vs_conn *cp, *cp_c;
@@ -1256,7 +1257,7 @@ void ip_vs_random_dropentry(struct net *net)
                        if (cp->flags & IP_VS_CONN_F_TEMPLATE)
                                /* connection template */
                                continue;
-                       if (!net_eq(cp->ipvs->net, net))
+                       if (cp->ipvs != ipvs)
                                continue;
                        if (cp->protocol == IPPROTO_TCP) {
                                switch(cp->state) {
This page took 0.026428 seconds and 5 git commands to generate.