aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 5d43a63e5656..098365062234 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -167,7 +167,6 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
167 struct net_device *dev) 167 struct net_device *dev)
168{ 168{
169 struct clusterip_config *c; 169 struct clusterip_config *c;
170 char buffer[16];
171 170
172 c = kzalloc(sizeof(*c), GFP_ATOMIC); 171 c = kzalloc(sizeof(*c), GFP_ATOMIC);
173 if (!c) 172 if (!c)
@@ -184,12 +183,17 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
184 atomic_set(&c->entries, 1); 183 atomic_set(&c->entries, 1);
185 184
186#ifdef CONFIG_PROC_FS 185#ifdef CONFIG_PROC_FS
187 /* create proc dir entry */ 186 {
188 sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); 187 char buffer[16];
189 c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR, clusterip_procdir); 188
190 if (!c->pde) { 189 /* create proc dir entry */
191 kfree(c); 190 sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
192 return NULL; 191 c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR,
192 clusterip_procdir);
193 if (!c->pde) {
194 kfree(c);
195 return NULL;
196 }
193 } 197 }
194 c->pde->proc_fops = &clusterip_proc_fops; 198 c->pde->proc_fops = &clusterip_proc_fops;
195 c->pde->data = c; 199 c->pde->data = c;
@@ -202,6 +206,7 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
202 return c; 206 return c;
203} 207}
204 208
209#ifdef CONFIG_PROC_FS
205static int 210static int
206clusterip_add_node(struct clusterip_config *c, u_int16_t nodenum) 211clusterip_add_node(struct clusterip_config *c, u_int16_t nodenum)
207{ 212{
@@ -229,6 +234,7 @@ clusterip_del_node(struct clusterip_config *c, u_int16_t nodenum)
229 234
230 return 1; 235 return 1;
231} 236}
237#endif
232 238
233static inline u_int32_t 239static inline u_int32_t
234clusterip_hashfn(struct sk_buff *skb, struct clusterip_config *config) 240clusterip_hashfn(struct sk_buff *skb, struct clusterip_config *config)
@@ -734,8 +740,10 @@ static int __init ipt_clusterip_init(void)
734 CLUSTERIP_VERSION); 740 CLUSTERIP_VERSION);
735 return 0; 741 return 0;
736 742
743#ifdef CONFIG_PROC_FS
737cleanup_hook: 744cleanup_hook:
738 nf_unregister_hook(&cip_arp_ops); 745 nf_unregister_hook(&cip_arp_ops);
746#endif /* CONFIG_PROC_FS */
739cleanup_target: 747cleanup_target:
740 ipt_unregister_target(&clusterip_tgt); 748 ipt_unregister_target(&clusterip_tgt);
741 return ret; 749 return ret;