Commit a0840e2e authored by Hans Schillstrom's avatar Hans Schillstrom Committed by Simon Horman

IPVS: netns, ip_vs_ctl local vars moved to ipvs struct.

Moving global vars to ipvs struct, except for svc table lock.
Next patch for ctl will be drop-rate handling.

*v3
__ip_vs_mutex remains global
 ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
Signed-off-by: default avatarHans Schillstrom <hans.schillstrom@ericsson.com>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 6e67e586
...@@ -41,7 +41,7 @@ static inline struct netns_ipvs *net_ipvs(struct net* net) ...@@ -41,7 +41,7 @@ static inline struct netns_ipvs *net_ipvs(struct net* net)
* Get net ptr from skb in traffic cases * Get net ptr from skb in traffic cases
* use skb_sknet when call is from userland (ioctl or netlink) * use skb_sknet when call is from userland (ioctl or netlink)
*/ */
static inline struct net *skb_net(struct sk_buff *skb) static inline struct net *skb_net(const struct sk_buff *skb)
{ {
#ifdef CONFIG_NET_NS #ifdef CONFIG_NET_NS
#ifdef CONFIG_IP_VS_DEBUG #ifdef CONFIG_IP_VS_DEBUG
...@@ -69,7 +69,7 @@ static inline struct net *skb_net(struct sk_buff *skb) ...@@ -69,7 +69,7 @@ static inline struct net *skb_net(struct sk_buff *skb)
#endif #endif
} }
static inline struct net *skb_sknet(struct sk_buff *skb) static inline struct net *skb_sknet(const struct sk_buff *skb)
{ {
#ifdef CONFIG_NET_NS #ifdef CONFIG_NET_NS
#ifdef CONFIG_IP_VS_DEBUG #ifdef CONFIG_IP_VS_DEBUG
...@@ -1023,13 +1023,6 @@ extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, ...@@ -1023,13 +1023,6 @@ extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
/* /*
* IPVS control data and functions (from ip_vs_ctl.c) * IPVS control data and functions (from ip_vs_ctl.c)
*/ */
extern int sysctl_ip_vs_cache_bypass;
extern int sysctl_ip_vs_expire_nodest_conn;
extern int sysctl_ip_vs_expire_quiescent_template;
extern int sysctl_ip_vs_sync_threshold[2];
extern int sysctl_ip_vs_nat_icmp_send;
extern int sysctl_ip_vs_conntrack;
extern int sysctl_ip_vs_snat_reroute;
extern struct ip_vs_stats ip_vs_stats; extern struct ip_vs_stats ip_vs_stats;
extern const struct ctl_path net_vs_ctl_path[]; extern const struct ctl_path net_vs_ctl_path[];
extern int sysctl_ip_vs_sync_ver; extern int sysctl_ip_vs_sync_ver;
...@@ -1119,11 +1112,13 @@ extern int ip_vs_icmp_xmit_v6 ...@@ -1119,11 +1112,13 @@ extern int ip_vs_icmp_xmit_v6
extern int ip_vs_drop_rate; extern int ip_vs_drop_rate;
extern int ip_vs_drop_counter; extern int ip_vs_drop_counter;
static __inline__ int ip_vs_todrop(void) static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
{ {
if (!ip_vs_drop_rate) return 0; if (!ipvs->drop_rate)
if (--ip_vs_drop_counter > 0) return 0; return 0;
ip_vs_drop_counter = ip_vs_drop_rate; if (--ipvs->drop_counter > 0)
return 0;
ipvs->drop_counter = ipvs->drop_rate;
return 1; return 1;
} }
...@@ -1211,9 +1206,9 @@ static inline void ip_vs_notrack(struct sk_buff *skb) ...@@ -1211,9 +1206,9 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
* Netfilter connection tracking * Netfilter connection tracking
* (from ip_vs_nfct.c) * (from ip_vs_nfct.c)
*/ */
static inline int ip_vs_conntrack_enabled(void) static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
{ {
return sysctl_ip_vs_conntrack; return ipvs->sysctl_conntrack;
} }
extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
...@@ -1226,7 +1221,7 @@ extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); ...@@ -1226,7 +1221,7 @@ extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
#else #else
static inline int ip_vs_conntrack_enabled(void) static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
{ {
return 0; return 0;
} }
......
...@@ -61,13 +61,46 @@ struct netns_ipvs { ...@@ -61,13 +61,46 @@ struct netns_ipvs {
struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
spinlock_t sctp_app_lock; spinlock_t sctp_app_lock;
#endif #endif
/* ip_vs_conn */
atomic_t conn_count; /* connection counter */
/* ip_vs_ctl */ /* ip_vs_ctl */
struct ip_vs_stats *tot_stats; /* Statistics & est. */ struct ip_vs_stats *tot_stats; /* Statistics & est. */
struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */ struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
seqcount_t *ustats_seq; /* u64 read retry */ seqcount_t *ustats_seq; /* u64 read retry */
/* ip_vs_conn */ int num_services; /* no of virtual services */
atomic_t conn_count; /* connection counter */ /* 1/rate drop and drop-entry variables */
int drop_rate;
int drop_counter;
atomic_t dropentry;
/* locks in ctl.c */
spinlock_t dropentry_lock; /* drop entry handling */
spinlock_t droppacket_lock; /* drop packet handling */
spinlock_t securetcp_lock; /* state and timeout tables */
rwlock_t rs_lock; /* real services table */
/* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
struct lock_class_key ctl_key; /* ctl_mutex debuging */
/* sys-ctl struct */
struct ctl_table_header *sysctl_hdr;
struct ctl_table *sysctl_tbl;
/* sysctl variables */
int sysctl_amemthresh;
int sysctl_am_droprate;
int sysctl_drop_entry;
int sysctl_drop_packet;
int sysctl_secure_tcp;
#ifdef CONFIG_IP_VS_NFCT
int sysctl_conntrack;
#endif
int sysctl_snat_reroute;
int sysctl_sync_ver;
int sysctl_cache_bypass;
int sysctl_expire_nodest_conn;
int sysctl_expire_quiescent_template;
int sysctl_sync_threshold[2];
int sysctl_nat_icmp_send;
/* ip_vs_lblc */ /* ip_vs_lblc */
int sysctl_lblc_expiration; int sysctl_lblc_expiration;
struct ctl_table_header *lblc_ctl_header; struct ctl_table_header *lblc_ctl_header;
......
...@@ -686,13 +686,14 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp) ...@@ -686,13 +686,14 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp)
int ip_vs_check_template(struct ip_vs_conn *ct) int ip_vs_check_template(struct ip_vs_conn *ct)
{ {
struct ip_vs_dest *dest = ct->dest; struct ip_vs_dest *dest = ct->dest;
struct netns_ipvs *ipvs = net_ipvs(ip_vs_conn_net(ct));
/* /*
* Checking the dest server status. * Checking the dest server status.
*/ */
if ((dest == NULL) || if ((dest == NULL) ||
!(dest->flags & IP_VS_DEST_F_AVAILABLE) || !(dest->flags & IP_VS_DEST_F_AVAILABLE) ||
(sysctl_ip_vs_expire_quiescent_template && (ipvs->sysctl_expire_quiescent_template &&
(atomic_read(&dest->weight) == 0))) { (atomic_read(&dest->weight) == 0))) {
IP_VS_DBG_BUF(9, "check_template: dest not available for " IP_VS_DBG_BUF(9, "check_template: dest not available for "
"protocol %s s:%s:%d v:%s:%d " "protocol %s s:%s:%d v:%s:%d "
...@@ -879,7 +880,7 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p, ...@@ -879,7 +880,7 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p,
* IP_VS_CONN_F_ONE_PACKET too. * IP_VS_CONN_F_ONE_PACKET too.
*/ */
if (ip_vs_conntrack_enabled()) if (ip_vs_conntrack_enabled(ipvs))
cp->flags |= IP_VS_CONN_F_NFCT; cp->flags |= IP_VS_CONN_F_NFCT;
/* Hash it in the ip_vs_conn_tab finally */ /* Hash it in the ip_vs_conn_tab finally */
...@@ -1198,7 +1199,7 @@ static void ip_vs_conn_flush(struct net *net) ...@@ -1198,7 +1199,7 @@ static void ip_vs_conn_flush(struct net *net)
struct ip_vs_conn *cp; struct ip_vs_conn *cp;
struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net);
flush_again: flush_again:
for (idx = 0; idx < ip_vs_conn_tab_size; idx++) { for (idx = 0; idx < ip_vs_conn_tab_size; idx++) {
/* /*
* Lock is actually needed in this loop. * Lock is actually needed in this loop.
......
...@@ -499,6 +499,7 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, ...@@ -499,6 +499,7 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
struct ip_vs_proto_data *pd) struct ip_vs_proto_data *pd)
{ {
struct netns_ipvs *ipvs;
__be16 _ports[2], *pptr; __be16 _ports[2], *pptr;
struct ip_vs_iphdr iph; struct ip_vs_iphdr iph;
int unicast; int unicast;
...@@ -521,7 +522,8 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, ...@@ -521,7 +522,8 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
/* if it is fwmark-based service, the cache_bypass sysctl is up /* if it is fwmark-based service, the cache_bypass sysctl is up
and the destination is a non-local unicast, then create and the destination is a non-local unicast, then create
a cache_bypass connection entry */ a cache_bypass connection entry */
if (sysctl_ip_vs_cache_bypass && svc->fwmark && unicast) { ipvs = net_ipvs(skb_net(skb));
if (ipvs->sysctl_cache_bypass && svc->fwmark && unicast) {
int ret, cs; int ret, cs;
struct ip_vs_conn *cp; struct ip_vs_conn *cp;
unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET && unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET &&
...@@ -733,6 +735,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb, ...@@ -733,6 +735,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
struct ip_vs_protocol *pp, struct ip_vs_protocol *pp,
unsigned int offset, unsigned int ihl) unsigned int offset, unsigned int ihl)
{ {
struct netns_ipvs *ipvs;
unsigned int verdict = NF_DROP; unsigned int verdict = NF_DROP;
if (IP_VS_FWD_METHOD(cp) != 0) { if (IP_VS_FWD_METHOD(cp) != 0) {
...@@ -754,6 +757,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb, ...@@ -754,6 +757,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
if (!skb_make_writable(skb, offset)) if (!skb_make_writable(skb, offset))
goto out; goto out;
ipvs = net_ipvs(skb_net(skb));
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
if (af == AF_INET6) if (af == AF_INET6)
ip_vs_nat_icmp_v6(skb, pp, cp, 1); ip_vs_nat_icmp_v6(skb, pp, cp, 1);
...@@ -763,11 +768,11 @@ static int handle_response_icmp(int af, struct sk_buff *skb, ...@@ -763,11 +768,11 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
if (af == AF_INET6) { if (af == AF_INET6) {
if (sysctl_ip_vs_snat_reroute && ip6_route_me_harder(skb) != 0) if (ipvs->sysctl_snat_reroute && ip6_route_me_harder(skb) != 0)
goto out; goto out;
} else } else
#endif #endif
if ((sysctl_ip_vs_snat_reroute || if ((ipvs->sysctl_snat_reroute ||
skb_rtable(skb)->rt_flags & RTCF_LOCAL) && skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
ip_route_me_harder(skb, RTN_LOCAL) != 0) ip_route_me_harder(skb, RTN_LOCAL) != 0)
goto out; goto out;
...@@ -979,6 +984,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, ...@@ -979,6 +984,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
struct ip_vs_conn *cp, int ihl) struct ip_vs_conn *cp, int ihl)
{ {
struct ip_vs_protocol *pp = pd->pp; struct ip_vs_protocol *pp = pd->pp;
struct netns_ipvs *ipvs;
IP_VS_DBG_PKT(11, af, pp, skb, 0, "Outgoing packet"); IP_VS_DBG_PKT(11, af, pp, skb, 0, "Outgoing packet");
...@@ -1014,13 +1020,15 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, ...@@ -1014,13 +1020,15 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
* if it came from this machine itself. So re-compute * if it came from this machine itself. So re-compute
* the routing information. * the routing information.
*/ */
ipvs = net_ipvs(skb_net(skb));
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
if (af == AF_INET6) { if (af == AF_INET6) {
if (sysctl_ip_vs_snat_reroute && ip6_route_me_harder(skb) != 0) if (ipvs->sysctl_snat_reroute && ip6_route_me_harder(skb) != 0)
goto drop; goto drop;
} else } else
#endif #endif
if ((sysctl_ip_vs_snat_reroute || if ((ipvs->sysctl_snat_reroute ||
skb_rtable(skb)->rt_flags & RTCF_LOCAL) && skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
ip_route_me_harder(skb, RTN_LOCAL) != 0) ip_route_me_harder(skb, RTN_LOCAL) != 0)
goto drop; goto drop;
...@@ -1057,6 +1065,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af) ...@@ -1057,6 +1065,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
struct ip_vs_protocol *pp; struct ip_vs_protocol *pp;
struct ip_vs_proto_data *pd; struct ip_vs_proto_data *pd;
struct ip_vs_conn *cp; struct ip_vs_conn *cp;
struct netns_ipvs *ipvs;
EnterFunction(11); EnterFunction(11);
...@@ -1131,10 +1140,11 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af) ...@@ -1131,10 +1140,11 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
* Check if the packet belongs to an existing entry * Check if the packet belongs to an existing entry
*/ */
cp = pp->conn_out_get(af, skb, &iph, iph.len, 0); cp = pp->conn_out_get(af, skb, &iph, iph.len, 0);
ipvs = net_ipvs(net);
if (likely(cp)) if (likely(cp))
return handle_response(af, skb, pd, cp, iph.len); return handle_response(af, skb, pd, cp, iph.len);
if (sysctl_ip_vs_nat_icmp_send && if (ipvs->sysctl_nat_icmp_send &&
(pp->protocol == IPPROTO_TCP || (pp->protocol == IPPROTO_TCP ||
pp->protocol == IPPROTO_UDP || pp->protocol == IPPROTO_UDP ||
pp->protocol == IPPROTO_SCTP)) { pp->protocol == IPPROTO_SCTP)) {
...@@ -1580,7 +1590,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) ...@@ -1580,7 +1590,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) { if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) {
/* the destination server is not available */ /* the destination server is not available */
if (sysctl_ip_vs_expire_nodest_conn) { if (ipvs->sysctl_expire_nodest_conn) {
/* try to expire the connection immediately */ /* try to expire the connection immediately */
ip_vs_conn_expire_now(cp); ip_vs_conn_expire_now(cp);
} }
...@@ -1610,15 +1620,15 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) ...@@ -1610,15 +1620,15 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
*/ */
if (cp->flags & IP_VS_CONN_F_ONE_PACKET) if (cp->flags & IP_VS_CONN_F_ONE_PACKET)
pkts = sysctl_ip_vs_sync_threshold[0]; pkts = ipvs->sysctl_sync_threshold[0];
else else
pkts = atomic_add_return(1, &cp->in_pkts); pkts = atomic_add_return(1, &cp->in_pkts);
if ((ipvs->sync_state & IP_VS_STATE_MASTER) && if ((ipvs->sync_state & IP_VS_STATE_MASTER) &&
cp->protocol == IPPROTO_SCTP) { cp->protocol == IPPROTO_SCTP) {
if ((cp->state == IP_VS_SCTP_S_ESTABLISHED && if ((cp->state == IP_VS_SCTP_S_ESTABLISHED &&
(pkts % sysctl_ip_vs_sync_threshold[1] (pkts % ipvs->sysctl_sync_threshold[1]
== sysctl_ip_vs_sync_threshold[0])) || == ipvs->sysctl_sync_threshold[0])) ||
(cp->old_state != cp->state && (cp->old_state != cp->state &&
((cp->state == IP_VS_SCTP_S_CLOSED) || ((cp->state == IP_VS_SCTP_S_CLOSED) ||
(cp->state == IP_VS_SCTP_S_SHUT_ACK_CLI) || (cp->state == IP_VS_SCTP_S_SHUT_ACK_CLI) ||
...@@ -1632,8 +1642,8 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) ...@@ -1632,8 +1642,8 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
else if ((ipvs->sync_state & IP_VS_STATE_MASTER) && else if ((ipvs->sync_state & IP_VS_STATE_MASTER) &&
(((cp->protocol != IPPROTO_TCP || (((cp->protocol != IPPROTO_TCP ||
cp->state == IP_VS_TCP_S_ESTABLISHED) && cp->state == IP_VS_TCP_S_ESTABLISHED) &&
(pkts % sysctl_ip_vs_sync_threshold[1] (pkts % ipvs->sysctl_sync_threshold[1]
== sysctl_ip_vs_sync_threshold[0])) || == ipvs->sysctl_sync_threshold[0])) ||
((cp->protocol == IPPROTO_TCP) && (cp->old_state != cp->state) && ((cp->protocol == IPPROTO_TCP) && (cp->old_state != cp->state) &&
((cp->state == IP_VS_TCP_S_FIN_WAIT) || ((cp->state == IP_VS_TCP_S_FIN_WAIT) ||
(cp->state == IP_VS_TCP_S_CLOSE) || (cp->state == IP_VS_TCP_S_CLOSE) ||
......
This diff is collapsed.
...@@ -34,7 +34,7 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, ...@@ -34,7 +34,7 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
&iph.daddr, sh->dest))) { &iph.daddr, sh->dest))) {
int ignored; int ignored;
if (ip_vs_todrop()) { if (ip_vs_todrop(net_ipvs(net))) {
/* /*
* It seems that we are very loaded. * It seems that we are very loaded.
* We have to drop this packet :( * We have to drop this packet :(
......
...@@ -54,7 +54,7 @@ tcp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, ...@@ -54,7 +54,7 @@ tcp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
&iph.daddr, th->dest))) { &iph.daddr, th->dest))) {
int ignored; int ignored;
if (ip_vs_todrop()) { if (ip_vs_todrop(net_ipvs(net))) {
/* /*
* It seems that we are very loaded. * It seems that we are very loaded.
* We have to drop this packet :( * We have to drop this packet :(
......
...@@ -50,7 +50,7 @@ udp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, ...@@ -50,7 +50,7 @@ udp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
if (svc) { if (svc) {
int ignored; int ignored;
if (ip_vs_todrop()) { if (ip_vs_todrop(net_ipvs(net))) {
/* /*
* It seems that we are very loaded. * It seems that we are very loaded.
* We have to drop this packet :( * We have to drop this packet :(
......
...@@ -394,7 +394,7 @@ void ip_vs_sync_switch_mode(struct net *net, int mode) ...@@ -394,7 +394,7 @@ void ip_vs_sync_switch_mode(struct net *net, int mode)
if (!ipvs->sync_state & IP_VS_STATE_MASTER) if (!ipvs->sync_state & IP_VS_STATE_MASTER)
return; return;
if (mode == sysctl_ip_vs_sync_ver || !ipvs->sync_buff) if (mode == ipvs->sysctl_sync_ver || !ipvs->sync_buff)
return; return;
spin_lock_bh(&ipvs->sync_buff_lock); spin_lock_bh(&ipvs->sync_buff_lock);
...@@ -521,7 +521,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp) ...@@ -521,7 +521,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp)
unsigned int len, pe_name_len, pad; unsigned int len, pe_name_len, pad;
/* Handle old version of the protocol */ /* Handle old version of the protocol */
if (sysctl_ip_vs_sync_ver == 0) { if (ipvs->sysctl_sync_ver == 0) {
ip_vs_sync_conn_v0(net, cp); ip_vs_sync_conn_v0(net, cp);
return; return;
} }
...@@ -650,7 +650,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp) ...@@ -650,7 +650,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp)
if (cp->flags & IP_VS_CONN_F_TEMPLATE) { if (cp->flags & IP_VS_CONN_F_TEMPLATE) {
int pkts = atomic_add_return(1, &cp->in_pkts); int pkts = atomic_add_return(1, &cp->in_pkts);
if (pkts % sysctl_ip_vs_sync_threshold[1] != 1) if (pkts % ipvs->sysctl_sync_threshold[1] != 1)
return; return;
} }
goto sloop; goto sloop;
...@@ -724,6 +724,7 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param, ...@@ -724,6 +724,7 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param,
{ {
struct ip_vs_dest *dest; struct ip_vs_dest *dest;
struct ip_vs_conn *cp; struct ip_vs_conn *cp;
struct netns_ipvs *ipvs = net_ipvs(net);
if (!(flags & IP_VS_CONN_F_TEMPLATE)) if (!(flags & IP_VS_CONN_F_TEMPLATE))
cp = ip_vs_conn_in_get(param); cp = ip_vs_conn_in_get(param);
...@@ -794,7 +795,7 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param, ...@@ -794,7 +795,7 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param,
if (opt) if (opt)
memcpy(&cp->in_seq, opt, sizeof(*opt)); memcpy(&cp->in_seq, opt, sizeof(*opt));
atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); atomic_set(&cp->in_pkts, ipvs->sysctl_sync_threshold[0]);
cp->state = state; cp->state = state;
cp->old_state = cp->state; cp->old_state = cp->state;
/* /*
......
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