ipvs: Pass ipvs into conn_out_get
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 21 Sep 2015 18:02:39 +0000 (13:02 -0500)
committerSimon Horman <horms@verge.net.au>
Thu, 24 Sep 2015 00:34:41 +0000 (09:34 +0900)
Move the hack of relying on "net_ipvs(skb_net(skb))" to derive the
ipvs up a layer.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
include/net/ip_vs.h
net/netfilter/ipvs/ip_vs_conn.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/ipvs/ip_vs_proto_ah_esp.c
net/netfilter/xt_ipvs.c

index 5c26383542e39b95c5560617314551af01b494ce..0ca436ef7dad46f9d7b3e53573ff912d4a1204e0 100644 (file)
@@ -499,7 +499,8 @@ struct ip_vs_protocol {
                       const struct ip_vs_iphdr *iph);
 
        struct ip_vs_conn *
-       (*conn_out_get)(int af,
+       (*conn_out_get)(struct netns_ipvs *ipvs,
+                       int af,
                        const struct sk_buff *skb,
                        const struct ip_vs_iphdr *iph);
 
@@ -1229,7 +1230,8 @@ struct ip_vs_conn * ip_vs_conn_in_get_proto(struct netns_ipvs *ipvs, int af,
 
 struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
 
-struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
+struct ip_vs_conn * ip_vs_conn_out_get_proto(struct netns_ipvs *ipvs, int af,
+                                            const struct sk_buff *skb,
                                             const struct ip_vs_iphdr *iph);
 
 /* Get reference to gain full access to conn.
index 439d6fb8bc296da1ca48d61722281506a7b3fdc1..7a4d1d8e8f0c27f996d353fb3a3971fa1b72e2b3 100644 (file)
@@ -440,10 +440,10 @@ struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p)
 }
 
 struct ip_vs_conn *
-ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
+ip_vs_conn_out_get_proto(struct netns_ipvs *ipvs, 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(ipvs, af, skb, iph, &p))
index 9b5c2af7b63adf535cffeecfc36b70c9d47cb3e6..f0369e7602a073e526861f82699f03ea5cfb27dc 100644 (file)
@@ -912,6 +912,7 @@ out:
 static int ip_vs_out_icmp(struct sk_buff *skb, int *related,
                          unsigned int hooknum)
 {
+       struct netns_ipvs *ipvs = net_ipvs(skb_net(skb));
        struct iphdr *iph;
        struct icmphdr  _icmph, *ic;
        struct iphdr    _ciph, *cih;    /* The ip header contained within the ICMP */
@@ -974,7 +975,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related,
        ip_vs_fill_iph_skb_icmp(AF_INET, skb, offset, true, &ciph);
 
        /* The embedded headers contain source and dest in reverse order */
-       cp = pp->conn_out_get(AF_INET, skb, &ciph);
+       cp = pp->conn_out_get(ipvs, AF_INET, skb, &ciph);
        if (!cp)
                return NF_ACCEPT;
 
@@ -987,6 +988,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related,
 static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related,
                             unsigned int hooknum, struct ip_vs_iphdr *ipvsh)
 {
+       struct netns_ipvs *ipvs = net_ipvs(skb_net(skb));
        struct icmp6hdr _icmph, *ic;
        struct ip_vs_iphdr ciph = {.flags = 0, .fragoffs = 0};/*Contained IP */
        struct ip_vs_conn *cp;
@@ -1029,7 +1031,7 @@ static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related,
                return NF_ACCEPT;
 
        /* The embedded headers contain source and dest in reverse order */
-       cp = pp->conn_out_get(AF_INET6, skb, &ciph);
+       cp = pp->conn_out_get(ipvs, AF_INET6, skb, &ciph);
        if (!cp)
                return NF_ACCEPT;
 
@@ -1257,7 +1259,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
        /*
         * Check if the packet belongs to an existing entry
         */
-       cp = pp->conn_out_get(af, skb, &iph);
+       cp = pp->conn_out_get(ipvs, af, skb, &iph);
 
        if (likely(cp))
                return handle_response(af, skb, pd, cp, &iph, hooknum);
index a96d93d11807bf131322c632b92562f2bb549ec2..e924455de5c0ae654f4344b9459f866e101ceb4c 100644 (file)
@@ -82,12 +82,11 @@ ah_esp_conn_in_get(struct netns_ipvs *ipvs, int af, const struct sk_buff *skb,
 
 
 static struct ip_vs_conn *
-ah_esp_conn_out_get(int af, const struct sk_buff *skb,
+ah_esp_conn_out_get(struct netns_ipvs *ipvs, int af, const struct sk_buff *skb,
                    const struct ip_vs_iphdr *iph)
 {
        struct ip_vs_conn *cp;
        struct ip_vs_conn_param p;
-       struct netns_ipvs *ipvs = net_ipvs(skb_net(skb));
 
        ah_esp_conn_fill_param_proto(ipvs, af, iph, &p);
        cp = ip_vs_conn_out_get(&p);
index 452ba2a3e7ae544c19d9f3b04348917f0a8ad46b..71a9d95e0a81bbdd17d94f37c15cf612c1781dd4 100644 (file)
@@ -48,6 +48,7 @@ static bool
 ipvs_mt(const struct sk_buff *skb, struct xt_action_param *par)
 {
        const struct xt_ipvs_mtinfo *data = par->matchinfo;
+       struct netns_ipvs *ipvs = net_ipvs(par->net);
        /* ipvs_mt_check ensures that family is only NFPROTO_IPV[46]. */
        const u_int8_t family = par->family;
        struct ip_vs_iphdr iph;
@@ -85,7 +86,7 @@ ipvs_mt(const struct sk_buff *skb, struct xt_action_param *par)
        /*
         * Check if the packet belongs to an existing entry
         */
-       cp = pp->conn_out_get(family, skb, &iph);
+       cp = pp->conn_out_get(ipvs, family, skb, &iph);
        if (unlikely(cp == NULL)) {
                match = false;
                goto out;
This page took 0.034071 seconds and 5 git commands to generate.