Commit 5c96c965 authored by Rusty Russell's avatar Rusty Russell Committed by Patrick McHardy

[NETFILTER]: Fix build error with CONFIG_SYSCTL disabled.

ip_ct_log_invalid was added without testing that it compiles without
CONFIG_SYSCTL.  Since sysctl is the only way of turning it on, there
should be no references to it if \!CONFIG_SYSCTL.  Also, that turns off
CONFIG_PROC_FS, which elicits more warnings.  Squish them too.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 50e2daaa
......@@ -75,6 +75,7 @@ extern int ip_conntrack_protocol_tcp_init(void);
/* Log invalid packets */
extern unsigned int ip_ct_log_invalid;
#ifdef CONFIG_SYSCTL
#ifdef DEBUG_INVALID_PACKETS
#define LOG_INVALID(proto) \
(ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
......@@ -83,5 +84,8 @@ extern unsigned int ip_ct_log_invalid;
((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
&& net_ratelimit())
#endif
#else
#define LOG_INVALID(proto) 0
#endif /* CONFIG_SYSCTL */
#endif /*_IP_CONNTRACK_PROTOCOL_H*/
......@@ -623,8 +623,8 @@ int __init init(void)
return ret;
cleanup:
#ifdef CONFIG_SYSCTL
cleanup:
ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp);
#endif
out:
......
......@@ -54,6 +54,7 @@ static int kill_proto(const struct ip_conntrack *i, void *data)
*((u_int8_t *) data));
}
#ifdef CONFIG_PROC_FS
static unsigned int
print_tuple(char *buffer, const struct ip_conntrack_tuple *tuple,
struct ip_conntrack_protocol *proto)
......@@ -367,6 +368,7 @@ static struct file_operations ct_cpu_seq_fops = {
.llseek = seq_lseek,
.release = seq_release_private,
};
#endif
static unsigned int ip_confirm(unsigned int hooknum,
struct sk_buff **pskb,
......@@ -726,10 +728,15 @@ static ctl_table ip_ct_net_table[] = {
},
{ .ctl_name = 0 }
};
#endif
EXPORT_SYMBOL(ip_ct_log_invalid);
#endif /* CONFIG_SYSCTL */
static int init_or_cleanup(int init)
{
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc, *proc_exp, *proc_stat;
#endif
int ret = 0;
if (!init) goto cleanup;
......@@ -738,19 +745,20 @@ static int init_or_cleanup(int init)
if (ret < 0)
goto cleanup_nothing;
proc = proc_net_create("ip_conntrack", 0440, NULL);
#ifdef CONFIG_PROC_FS
proc = proc_net_fops_create("ip_conntrack", 0440, &ct_file_ops);
if (!proc) goto cleanup_init;
proc->proc_fops = &ct_file_ops;
proc_exp = proc_net_create("ip_conntrack_expect", 0440, NULL);
proc_exp = proc_net_fops_create("ip_conntrack_expect", 0440,
&exp_file_ops);
if (!proc_exp) goto cleanup_proc;
proc_exp->proc_fops = &exp_file_ops;
proc_stat = proc_net_fops_create("ip_conntrack_stat", S_IRUGO,
&ct_cpu_seq_fops);
if (!proc_stat)
goto cleanup_proc_exp;
proc_stat->owner = THIS_MODULE;
#endif
ret = nf_register_hook(&ip_conntrack_defrag_ops);
if (ret < 0) {
......@@ -814,12 +822,14 @@ static int init_or_cleanup(int init)
local_bh_enable();
nf_unregister_hook(&ip_conntrack_defrag_ops);
cleanup_proc_stat:
#ifdef CONFIG_PROC_FS
proc_net_remove("ip_conntrack_stat");
cleanup_proc_exp:
proc_net_remove("ip_conntrack_exp");
cleanup_proc:
proc_net_remove("ip_conntrack");
cleanup_init:
#endif /* CONFIG_PROC_FS */
ip_conntrack_cleanup();
cleanup_nothing:
return ret;
......@@ -912,4 +922,3 @@ EXPORT_SYMBOL(ip_conntrack_hash);
EXPORT_SYMBOL(ip_conntrack_untracked);
EXPORT_SYMBOL_GPL(ip_conntrack_find_get);
EXPORT_SYMBOL_GPL(ip_conntrack_put);
EXPORT_SYMBOL(ip_ct_log_invalid);
......@@ -619,6 +619,7 @@ static ctl_table ipq_root_table[] = {
{ .ctl_name = 0 }
};
#ifdef CONFIG_PROC_FS
static int
ipq_get_info(char *buffer, char **start, off_t offset, int length)
{
......@@ -648,6 +649,7 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length)
len = 0;
return len;
}
#endif /* CONFIG_PROC_FS */
static int
init_or_cleanup(int init)
......
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