aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2011-02-04 04:33:02 -0500
committerSimon Horman <horms@verge.net.au>2011-03-14 20:37:01 -0400
commitfb1de432c1c7c26afb2e86d166fc37888b6a4423 (patch)
tree3921c02f51e84e0b770b3d946629b38fd1fd8b6a /net
parenta7a86b8616bc1595c4f5f109b7c39d4eb5d55e32 (diff)
IPVS: Conditionally define and use ip_vs_lblc{r}_table
ip_vs_lblc_table and ip_vs_lblcr_table, and code that uses them are unnecessary when CONFIG_SYSCTL is undefined. Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/ipvs/ip_vs_lblc.c15
-rw-r--r--net/netfilter/ipvs/ip_vs_lblcr.c14
2 files changed, 20 insertions, 9 deletions
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index 51a27f58030d..f276df9896b3 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -114,7 +114,7 @@ struct ip_vs_lblc_table {
114/* 114/*
115 * IPVS LBLC sysctl table 115 * IPVS LBLC sysctl table
116 */ 116 */
117 117#ifdef CONFIG_SYSCTL
118static ctl_table vs_vars_table[] = { 118static ctl_table vs_vars_table[] = {
119 { 119 {
120 .procname = "lblc_expiration", 120 .procname = "lblc_expiration",
@@ -125,6 +125,7 @@ static ctl_table vs_vars_table[] = {
125 }, 125 },
126 { } 126 { }
127}; 127};
128#endif
128 129
129static inline void ip_vs_lblc_free(struct ip_vs_lblc_entry *en) 130static inline void ip_vs_lblc_free(struct ip_vs_lblc_entry *en)
130{ 131{
@@ -548,6 +549,7 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler =
548/* 549/*
549 * per netns init. 550 * per netns init.
550 */ 551 */
552#ifdef CONFIG_SYSCTL
551static int __net_init __ip_vs_lblc_init(struct net *net) 553static int __net_init __ip_vs_lblc_init(struct net *net)
552{ 554{
553 struct netns_ipvs *ipvs = net_ipvs(net); 555 struct netns_ipvs *ipvs = net_ipvs(net);
@@ -563,7 +565,6 @@ static int __net_init __ip_vs_lblc_init(struct net *net)
563 ipvs->sysctl_lblc_expiration = DEFAULT_EXPIRATION; 565 ipvs->sysctl_lblc_expiration = DEFAULT_EXPIRATION;
564 ipvs->lblc_ctl_table[0].data = &ipvs->sysctl_lblc_expiration; 566 ipvs->lblc_ctl_table[0].data = &ipvs->sysctl_lblc_expiration;
565 567
566#ifdef CONFIG_SYSCTL
567 ipvs->lblc_ctl_header = 568 ipvs->lblc_ctl_header =
568 register_net_sysctl_table(net, net_vs_ctl_path, 569 register_net_sysctl_table(net, net_vs_ctl_path,
569 ipvs->lblc_ctl_table); 570 ipvs->lblc_ctl_table);
@@ -572,7 +573,6 @@ static int __net_init __ip_vs_lblc_init(struct net *net)
572 kfree(ipvs->lblc_ctl_table); 573 kfree(ipvs->lblc_ctl_table);
573 return -ENOMEM; 574 return -ENOMEM;
574 } 575 }
575#endif
576 576
577 return 0; 577 return 0;
578} 578}
@@ -581,14 +581,19 @@ static void __net_exit __ip_vs_lblc_exit(struct net *net)
581{ 581{
582 struct netns_ipvs *ipvs = net_ipvs(net); 582 struct netns_ipvs *ipvs = net_ipvs(net);
583 583
584#ifdef CONFIG_SYSCTL
585 unregister_net_sysctl_table(ipvs->lblc_ctl_header); 584 unregister_net_sysctl_table(ipvs->lblc_ctl_header);
586#endif
587 585
588 if (!net_eq(net, &init_net)) 586 if (!net_eq(net, &init_net))
589 kfree(ipvs->lblc_ctl_table); 587 kfree(ipvs->lblc_ctl_table);
590} 588}
591 589
590#else
591
592static int __net_init __ip_vs_lblc_init(struct net *net) { return 0; }
593static void __net_exit __ip_vs_lblc_exit(struct net *net) { }
594
595#endif
596
592static struct pernet_operations ip_vs_lblc_ops = { 597static struct pernet_operations ip_vs_lblc_ops = {
593 .init = __ip_vs_lblc_init, 598 .init = __ip_vs_lblc_init,
594 .exit = __ip_vs_lblc_exit, 599 .exit = __ip_vs_lblc_exit,
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index 7fb919061296..cb1c9913d38b 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -285,6 +285,7 @@ struct ip_vs_lblcr_table {
285}; 285};
286 286
287 287
288#ifdef CONFIG_SYSCTL
288/* 289/*
289 * IPVS LBLCR sysctl table 290 * IPVS LBLCR sysctl table
290 */ 291 */
@@ -299,6 +300,7 @@ static ctl_table vs_vars_table[] = {
299 }, 300 },
300 { } 301 { }
301}; 302};
303#endif
302 304
303static inline void ip_vs_lblcr_free(struct ip_vs_lblcr_entry *en) 305static inline void ip_vs_lblcr_free(struct ip_vs_lblcr_entry *en)
304{ 306{
@@ -743,6 +745,7 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =
743/* 745/*
744 * per netns init. 746 * per netns init.
745 */ 747 */
748#ifdef CONFIG_SYSCTL
746static int __net_init __ip_vs_lblcr_init(struct net *net) 749static int __net_init __ip_vs_lblcr_init(struct net *net)
747{ 750{
748 struct netns_ipvs *ipvs = net_ipvs(net); 751 struct netns_ipvs *ipvs = net_ipvs(net);
@@ -758,7 +761,6 @@ static int __net_init __ip_vs_lblcr_init(struct net *net)
758 ipvs->sysctl_lblcr_expiration = DEFAULT_EXPIRATION; 761 ipvs->sysctl_lblcr_expiration = DEFAULT_EXPIRATION;
759 ipvs->lblcr_ctl_table[0].data = &ipvs->sysctl_lblcr_expiration; 762 ipvs->lblcr_ctl_table[0].data = &ipvs->sysctl_lblcr_expiration;
760 763
761#ifdef CONFIG_SYSCTL
762 ipvs->lblcr_ctl_header = 764 ipvs->lblcr_ctl_header =
763 register_net_sysctl_table(net, net_vs_ctl_path, 765 register_net_sysctl_table(net, net_vs_ctl_path,
764 ipvs->lblcr_ctl_table); 766 ipvs->lblcr_ctl_table);
@@ -767,7 +769,6 @@ static int __net_init __ip_vs_lblcr_init(struct net *net)
767 kfree(ipvs->lblcr_ctl_table); 769 kfree(ipvs->lblcr_ctl_table);
768 return -ENOMEM; 770 return -ENOMEM;
769 } 771 }
770#endif
771 772
772 return 0; 773 return 0;
773} 774}
@@ -776,14 +777,19 @@ static void __net_exit __ip_vs_lblcr_exit(struct net *net)
776{ 777{
777 struct netns_ipvs *ipvs = net_ipvs(net); 778 struct netns_ipvs *ipvs = net_ipvs(net);
778 779
779#ifdef CONFIG_SYSCTL
780 unregister_net_sysctl_table(ipvs->lblcr_ctl_header); 780 unregister_net_sysctl_table(ipvs->lblcr_ctl_header);
781#endif
782 781
783 if (!net_eq(net, &init_net)) 782 if (!net_eq(net, &init_net))
784 kfree(ipvs->lblcr_ctl_table); 783 kfree(ipvs->lblcr_ctl_table);
785} 784}
786 785
786#else
787
788static int __net_init __ip_vs_lblcr_init(struct net *net) { return 0; }
789static void __net_exit __ip_vs_lblcr_exit(struct net *net) { }
790
791#endif
792
787static struct pernet_operations ip_vs_lblcr_ops = { 793static struct pernet_operations ip_vs_lblcr_ops = {
788 .init = __ip_vs_lblcr_init, 794 .init = __ip_vs_lblcr_init,
789 .exit = __ip_vs_lblcr_exit, 795 .exit = __ip_vs_lblcr_exit,