aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2011-02-04 04:33:01 -0500
committerSimon Horman <horms@verge.net.au>2011-03-14 20:36:57 -0400
commit59e0350eada0516a810cb780db37746165f1d516 (patch)
treee97d575d951909aea0e47598c3c830850b79e033 /net
parent0cfa558e2c21644a0dd6c21cfadd8bbeaf9fe1a0 (diff)
IPVS: Add {sysctl_sync_threshold,period}()
In preparation for not including sysctl_sync_threshold in struct netns_ipvs when CONFIG_SYCTL is not defined. Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c10
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c4
-rw-r--r--net/netfilter/ipvs/ip_vs_sync.c4
3 files changed, 9 insertions, 9 deletions
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index c9b83728f3ce..6a0053d91741 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1613,15 +1613,15 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
1613 */ 1613 */
1614 1614
1615 if (cp->flags & IP_VS_CONN_F_ONE_PACKET) 1615 if (cp->flags & IP_VS_CONN_F_ONE_PACKET)
1616 pkts = ipvs->sysctl_sync_threshold[0]; 1616 pkts = sysctl_sync_threshold(ipvs);
1617 else 1617 else
1618 pkts = atomic_add_return(1, &cp->in_pkts); 1618 pkts = atomic_add_return(1, &cp->in_pkts);
1619 1619
1620 if ((ipvs->sync_state & IP_VS_STATE_MASTER) && 1620 if ((ipvs->sync_state & IP_VS_STATE_MASTER) &&
1621 cp->protocol == IPPROTO_SCTP) { 1621 cp->protocol == IPPROTO_SCTP) {
1622 if ((cp->state == IP_VS_SCTP_S_ESTABLISHED && 1622 if ((cp->state == IP_VS_SCTP_S_ESTABLISHED &&
1623 (pkts % ipvs->sysctl_sync_threshold[1] 1623 (pkts % sysctl_sync_period(ipvs)
1624 == ipvs->sysctl_sync_threshold[0])) || 1624 == sysctl_sync_threshold(ipvs))) ||
1625 (cp->old_state != cp->state && 1625 (cp->old_state != cp->state &&
1626 ((cp->state == IP_VS_SCTP_S_CLOSED) || 1626 ((cp->state == IP_VS_SCTP_S_CLOSED) ||
1627 (cp->state == IP_VS_SCTP_S_SHUT_ACK_CLI) || 1627 (cp->state == IP_VS_SCTP_S_SHUT_ACK_CLI) ||
@@ -1635,8 +1635,8 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
1635 else if ((ipvs->sync_state & IP_VS_STATE_MASTER) && 1635 else if ((ipvs->sync_state & IP_VS_STATE_MASTER) &&
1636 (((cp->protocol != IPPROTO_TCP || 1636 (((cp->protocol != IPPROTO_TCP ||
1637 cp->state == IP_VS_TCP_S_ESTABLISHED) && 1637 cp->state == IP_VS_TCP_S_ESTABLISHED) &&
1638 (pkts % ipvs->sysctl_sync_threshold[1] 1638 (pkts % sysctl_sync_period(ipvs)
1639 == ipvs->sysctl_sync_threshold[0])) || 1639 == sysctl_sync_threshold(ipvs))) ||
1640 ((cp->protocol == IPPROTO_TCP) && (cp->old_state != cp->state) && 1640 ((cp->protocol == IPPROTO_TCP) && (cp->old_state != cp->state) &&
1641 ((cp->state == IP_VS_TCP_S_FIN_WAIT) || 1641 ((cp->state == IP_VS_TCP_S_FIN_WAIT) ||
1642 (cp->state == IP_VS_TCP_S_CLOSE) || 1642 (cp->state == IP_VS_TCP_S_CLOSE) ||
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index c5b1234b630e..364520f66b7a 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3569,8 +3569,8 @@ int __net_init __ip_vs_control_init(struct net *net)
3569 tbl[idx++].data = &ipvs->sysctl_cache_bypass; 3569 tbl[idx++].data = &ipvs->sysctl_cache_bypass;
3570 tbl[idx++].data = &ipvs->sysctl_expire_nodest_conn; 3570 tbl[idx++].data = &ipvs->sysctl_expire_nodest_conn;
3571 tbl[idx++].data = &ipvs->sysctl_expire_quiescent_template; 3571 tbl[idx++].data = &ipvs->sysctl_expire_quiescent_template;
3572 ipvs->sysctl_sync_threshold[0] = 3; 3572 ipvs->sysctl_sync_threshold[0] = DEFAULT_SYNC_THRESHOLD;
3573 ipvs->sysctl_sync_threshold[1] = 50; 3573 ipvs->sysctl_sync_threshold[1] = DEFAULT_SYNC_PERIOD;
3574 tbl[idx].data = &ipvs->sysctl_sync_threshold; 3574 tbl[idx].data = &ipvs->sysctl_sync_threshold;
3575 tbl[idx++].maxlen = sizeof(ipvs->sysctl_sync_threshold); 3575 tbl[idx++].maxlen = sizeof(ipvs->sysctl_sync_threshold);
3576 tbl[idx++].data = &ipvs->sysctl_nat_icmp_send; 3576 tbl[idx++].data = &ipvs->sysctl_nat_icmp_send;
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index c5d13b05275a..e84987fa1bf8 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -650,7 +650,7 @@ control:
650 if (cp->flags & IP_VS_CONN_F_TEMPLATE) { 650 if (cp->flags & IP_VS_CONN_F_TEMPLATE) {
651 int pkts = atomic_add_return(1, &cp->in_pkts); 651 int pkts = atomic_add_return(1, &cp->in_pkts);
652 652
653 if (pkts % ipvs->sysctl_sync_threshold[1] != 1) 653 if (pkts % sysctl_sync_period(ipvs) != 1)
654 return; 654 return;
655 } 655 }
656 goto sloop; 656 goto sloop;
@@ -794,7 +794,7 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param,
794 794
795 if (opt) 795 if (opt)
796 memcpy(&cp->in_seq, opt, sizeof(*opt)); 796 memcpy(&cp->in_seq, opt, sizeof(*opt));
797 atomic_set(&cp->in_pkts, ipvs->sysctl_sync_threshold[0]); 797 atomic_set(&cp->in_pkts, sysctl_sync_threshold(ipvs));
798 cp->state = state; 798 cp->state = state;
799 cp->old_state = cp->state; 799 cp->old_state = cp->state;
800 /* 800 /*