Commit a43d1a6b97433f7774436307708516ee06592c54

Authored by Eric W. Biederman
Committed by Simon Horman
1 parent 7b5f689a2c

ipvs: Pass ipvs through ip_vs_route_me_harder into sysctl_snat_reroute

This removes the need to use the hack skb_net.

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>

Showing 1 changed file with 7 additions and 8 deletions Side-by-side Diff

net/netfilter/ipvs/ip_vs_core.c
... ... @@ -651,9 +651,8 @@
651 651  
652 652 #ifdef CONFIG_SYSCTL
653 653  
654   -static int sysctl_snat_reroute(struct sk_buff *skb)
  654 +static int sysctl_snat_reroute(struct netns_ipvs *ipvs)
655 655 {
656   - struct netns_ipvs *ipvs = net_ipvs(skb_net(skb));
657 656 return ipvs->sysctl_snat_reroute;
658 657 }
659 658  
... ... @@ -669,7 +668,7 @@
669 668  
670 669 #else
671 670  
672   -static int sysctl_snat_reroute(struct sk_buff *skb) { return 0; }
  671 +static int sysctl_snat_reroute(struct netns_ipvs *ipvs) { return 0; }
673 672 static int sysctl_nat_icmp_send(struct netns_ipvs *ipvs) { return 0; }
674 673 static int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs) { return 0; }
675 674  
676 675  
... ... @@ -702,10 +701,10 @@
702 701 return err;
703 702 }
704 703  
705   -static int ip_vs_route_me_harder(int af, struct sk_buff *skb,
706   - unsigned int hooknum)
  704 +static int ip_vs_route_me_harder(struct netns_ipvs *ipvs, int af,
  705 + struct sk_buff *skb, unsigned int hooknum)
707 706 {
708   - if (!sysctl_snat_reroute(skb))
  707 + if (!sysctl_snat_reroute(ipvs))
709 708 return 0;
710 709 /* Reroute replies only to remote clients (FORWARD and LOCAL_OUT) */
711 710 if (NF_INET_LOCAL_IN == hooknum)
... ... @@ -873,7 +872,7 @@
873 872 #endif
874 873 ip_vs_nat_icmp(skb, pp, cp, 1);
875 874  
876   - if (ip_vs_route_me_harder(af, skb, hooknum))
  875 + if (ip_vs_route_me_harder(cp->ipvs, af, skb, hooknum))
877 876 goto out;
878 877  
879 878 /* do the statistics and put it back */
... ... @@ -1144,7 +1143,7 @@
1144 1143 * if it came from this machine itself. So re-compute
1145 1144 * the routing information.
1146 1145 */
1147   - if (ip_vs_route_me_harder(af, skb, hooknum))
  1146 + if (ip_vs_route_me_harder(cp->ipvs, af, skb, hooknum))
1148 1147 goto drop;
1149 1148  
1150 1149 IP_VS_DBG_PKT(10, af, pp, skb, iph->off, "After SNAT");