summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Schillstrom <hans.schillstrom@ericsson.com>2011-01-03 08:45:01 -0500
committerSimon Horman <horms@verge.net.au>2011-01-12 20:30:28 -0500
commit763f8d0ed4f1ce38b35cc0e05482b7799b82789b (patch)
treebc9938998b6af45a44bb35dba078851ccb21d95e
parentf2431e6e9255461eb1476340a89ad32ad4b38b03 (diff)
IPVS: netns, svc counters moved in ip_vs_ctl,c
Last two global vars to be moved, ip_vs_ftpsvc_counter and ip_vs_nullsvc_counter. [horms@verge.net.au: removed whitespace-change-only hunk] Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--include/net/netns/ip_vs.h3
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c21
2 files changed, 12 insertions, 12 deletions
diff --git a/include/net/netns/ip_vs.h b/include/net/netns/ip_vs.h
index 67ca1cf55af8..259ebac904bf 100644
--- a/include/net/netns/ip_vs.h
+++ b/include/net/netns/ip_vs.h
@@ -84,6 +84,9 @@ struct netns_ipvs {
84 struct lock_class_key ctl_key; /* ctl_mutex debuging */ 84 struct lock_class_key ctl_key; /* ctl_mutex debuging */
85 /* Trash for destinations */ 85 /* Trash for destinations */
86 struct list_head dest_trash; 86 struct list_head dest_trash;
87 /* Service counters */
88 atomic_t ftpsvc_counter;
89 atomic_t nullsvc_counter;
87 90
88 /* sys-ctl struct */ 91 /* sys-ctl struct */
89 struct ctl_table_header *sysctl_hdr; 92 struct ctl_table_header *sysctl_hdr;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 442edf4be644..65f5de405ad2 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -254,12 +254,6 @@ static struct list_head ip_vs_svc_table[IP_VS_SVC_TAB_SIZE];
254/* the service table hashed by fwmark */ 254/* the service table hashed by fwmark */
255static struct list_head ip_vs_svc_fwm_table[IP_VS_SVC_TAB_SIZE]; 255static struct list_head ip_vs_svc_fwm_table[IP_VS_SVC_TAB_SIZE];
256 256
257/*
258 * FTP & NULL virtual service counters
259 */
260static atomic_t ip_vs_ftpsvc_counter = ATOMIC_INIT(0);
261static atomic_t ip_vs_nullsvc_counter = ATOMIC_INIT(0);
262
263 257
264/* 258/*
265 * Returns hash value for virtual service 259 * Returns hash value for virtual service
@@ -409,6 +403,7 @@ ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
409 const union nf_inet_addr *vaddr, __be16 vport) 403 const union nf_inet_addr *vaddr, __be16 vport)
410{ 404{
411 struct ip_vs_service *svc; 405 struct ip_vs_service *svc;
406 struct netns_ipvs *ipvs = net_ipvs(net);
412 407
413 read_lock(&__ip_vs_svc_lock); 408 read_lock(&__ip_vs_svc_lock);
414 409
@@ -427,7 +422,7 @@ ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
427 422
428 if (svc == NULL 423 if (svc == NULL
429 && protocol == IPPROTO_TCP 424 && protocol == IPPROTO_TCP
430 && atomic_read(&ip_vs_ftpsvc_counter) 425 && atomic_read(&ipvs->ftpsvc_counter)
431 && (vport == FTPDATA || ntohs(vport) >= PROT_SOCK)) { 426 && (vport == FTPDATA || ntohs(vport) >= PROT_SOCK)) {
432 /* 427 /*
433 * Check if ftp service entry exists, the packet 428 * Check if ftp service entry exists, the packet
@@ -437,7 +432,7 @@ ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
437 } 432 }
438 433
439 if (svc == NULL 434 if (svc == NULL
440 && atomic_read(&ip_vs_nullsvc_counter)) { 435 && atomic_read(&ipvs->nullsvc_counter)) {
441 /* 436 /*
442 * Check if the catch-all port (port zero) exists 437 * Check if the catch-all port (port zero) exists
443 */ 438 */
@@ -1173,9 +1168,9 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
1173 1168
1174 /* Update the virtual service counters */ 1169 /* Update the virtual service counters */
1175 if (svc->port == FTPPORT) 1170 if (svc->port == FTPPORT)
1176 atomic_inc(&ip_vs_ftpsvc_counter); 1171 atomic_inc(&ipvs->ftpsvc_counter);
1177 else if (svc->port == 0) 1172 else if (svc->port == 0)
1178 atomic_inc(&ip_vs_nullsvc_counter); 1173 atomic_inc(&ipvs->nullsvc_counter);
1179 1174
1180 ip_vs_new_estimator(net, &svc->stats); 1175 ip_vs_new_estimator(net, &svc->stats);
1181 1176
@@ -1359,9 +1354,9 @@ static void __ip_vs_del_service(struct ip_vs_service *svc)
1359 * Update the virtual service counters 1354 * Update the virtual service counters
1360 */ 1355 */
1361 if (svc->port == FTPPORT) 1356 if (svc->port == FTPPORT)
1362 atomic_dec(&ip_vs_ftpsvc_counter); 1357 atomic_dec(&ipvs->ftpsvc_counter);
1363 else if (svc->port == 0) 1358 else if (svc->port == 0)
1364 atomic_dec(&ip_vs_nullsvc_counter); 1359 atomic_dec(&ipvs->nullsvc_counter);
1365 1360
1366 /* 1361 /*
1367 * Free the service if nobody refers to it 1362 * Free the service if nobody refers to it
@@ -3501,6 +3496,8 @@ int __net_init __ip_vs_control_init(struct net *net)
3501 INIT_LIST_HEAD(&ipvs->rs_table[idx]); 3496 INIT_LIST_HEAD(&ipvs->rs_table[idx]);
3502 3497
3503 INIT_LIST_HEAD(&ipvs->dest_trash); 3498 INIT_LIST_HEAD(&ipvs->dest_trash);
3499 atomic_set(&ipvs->ftpsvc_counter, 0);
3500 atomic_set(&ipvs->nullsvc_counter, 0);
3504 3501
3505 /* procfs stats */ 3502 /* procfs stats */
3506 ipvs->tot_stats = kzalloc(sizeof(struct ip_vs_stats), GFP_KERNEL); 3503 ipvs->tot_stats = kzalloc(sizeof(struct ip_vs_stats), GFP_KERNEL);