diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-31 07:54:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 22:28:14 -0500 |
commit | c392a7401807de25a9c7e0234dddbdf40b10c594 (patch) | |
tree | 57940df8f7c31574d1988f2a682fa6755b8e10a4 /net | |
parent | 32948588ac4ec54300bae1037e839277fd4536e2 (diff) |
[NETFILTER]: {ip,ip6}_queue: fix build error
Reported by Ingo Molnar:
net/built-in.o: In function `ip_queue_init':
ip_queue.c:(.init.text+0x322c): undefined reference to `net_ipv4_ctl_path'
Fix the build error and also handle CONFIG_PROC_FS=n properly.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/ip_queue.c | 18 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_queue.c | 18 |
2 files changed, 28 insertions, 8 deletions
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 5109839da222..6bda1102851b 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -512,6 +512,7 @@ static struct notifier_block ipq_nl_notifier = { | |||
512 | .notifier_call = ipq_rcv_nl_event, | 512 | .notifier_call = ipq_rcv_nl_event, |
513 | }; | 513 | }; |
514 | 514 | ||
515 | #ifdef CONFIG_SYSCTL | ||
515 | static struct ctl_table_header *ipq_sysctl_header; | 516 | static struct ctl_table_header *ipq_sysctl_header; |
516 | 517 | ||
517 | static ctl_table ipq_table[] = { | 518 | static ctl_table ipq_table[] = { |
@@ -525,7 +526,9 @@ static ctl_table ipq_table[] = { | |||
525 | }, | 526 | }, |
526 | { .ctl_name = 0 } | 527 | { .ctl_name = 0 } |
527 | }; | 528 | }; |
529 | #endif | ||
528 | 530 | ||
531 | #ifdef CONFIG_PROC_FS | ||
529 | static int ip_queue_show(struct seq_file *m, void *v) | 532 | static int ip_queue_show(struct seq_file *m, void *v) |
530 | { | 533 | { |
531 | read_lock_bh(&queue_lock); | 534 | read_lock_bh(&queue_lock); |
@@ -562,6 +565,7 @@ static const struct file_operations ip_queue_proc_fops = { | |||
562 | .release = single_release, | 565 | .release = single_release, |
563 | .owner = THIS_MODULE, | 566 | .owner = THIS_MODULE, |
564 | }; | 567 | }; |
568 | #endif | ||
565 | 569 | ||
566 | static const struct nf_queue_handler nfqh = { | 570 | static const struct nf_queue_handler nfqh = { |
567 | .name = "ip_queue", | 571 | .name = "ip_queue", |
@@ -571,7 +575,7 @@ static const struct nf_queue_handler nfqh = { | |||
571 | static int __init ip_queue_init(void) | 575 | static int __init ip_queue_init(void) |
572 | { | 576 | { |
573 | int status = -ENOMEM; | 577 | int status = -ENOMEM; |
574 | struct proc_dir_entry *proc; | 578 | struct proc_dir_entry *proc __maybe_unused; |
575 | 579 | ||
576 | netlink_register_notifier(&ipq_nl_notifier); | 580 | netlink_register_notifier(&ipq_nl_notifier); |
577 | ipqnl = netlink_kernel_create(&init_net, NETLINK_FIREWALL, 0, | 581 | ipqnl = netlink_kernel_create(&init_net, NETLINK_FIREWALL, 0, |
@@ -581,6 +585,7 @@ static int __init ip_queue_init(void) | |||
581 | goto cleanup_netlink_notifier; | 585 | goto cleanup_netlink_notifier; |
582 | } | 586 | } |
583 | 587 | ||
588 | #ifdef CONFIG_PROC_FS | ||
584 | proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); | 589 | proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); |
585 | if (proc) { | 590 | if (proc) { |
586 | proc->owner = THIS_MODULE; | 591 | proc->owner = THIS_MODULE; |
@@ -589,10 +594,11 @@ static int __init ip_queue_init(void) | |||
589 | printk(KERN_ERR "ip_queue: failed to create proc entry\n"); | 594 | printk(KERN_ERR "ip_queue: failed to create proc entry\n"); |
590 | goto cleanup_ipqnl; | 595 | goto cleanup_ipqnl; |
591 | } | 596 | } |
592 | 597 | #endif | |
593 | register_netdevice_notifier(&ipq_dev_notifier); | 598 | register_netdevice_notifier(&ipq_dev_notifier); |
599 | #ifdef CONFIG_SYSCTL | ||
594 | ipq_sysctl_header = register_sysctl_paths(net_ipv4_ctl_path, ipq_table); | 600 | ipq_sysctl_header = register_sysctl_paths(net_ipv4_ctl_path, ipq_table); |
595 | 601 | #endif | |
596 | status = nf_register_queue_handler(PF_INET, &nfqh); | 602 | status = nf_register_queue_handler(PF_INET, &nfqh); |
597 | if (status < 0) { | 603 | if (status < 0) { |
598 | printk(KERN_ERR "ip_queue: failed to register queue handler\n"); | 604 | printk(KERN_ERR "ip_queue: failed to register queue handler\n"); |
@@ -601,10 +607,12 @@ static int __init ip_queue_init(void) | |||
601 | return status; | 607 | return status; |
602 | 608 | ||
603 | cleanup_sysctl: | 609 | cleanup_sysctl: |
610 | #ifdef CONFIG_SYSCTL | ||
604 | unregister_sysctl_table(ipq_sysctl_header); | 611 | unregister_sysctl_table(ipq_sysctl_header); |
612 | #endif | ||
605 | unregister_netdevice_notifier(&ipq_dev_notifier); | 613 | unregister_netdevice_notifier(&ipq_dev_notifier); |
606 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); | 614 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); |
607 | cleanup_ipqnl: | 615 | cleanup_ipqnl: __maybe_unused |
608 | netlink_kernel_release(ipqnl); | 616 | netlink_kernel_release(ipqnl); |
609 | mutex_lock(&ipqnl_mutex); | 617 | mutex_lock(&ipqnl_mutex); |
610 | mutex_unlock(&ipqnl_mutex); | 618 | mutex_unlock(&ipqnl_mutex); |
@@ -620,7 +628,9 @@ static void __exit ip_queue_fini(void) | |||
620 | synchronize_net(); | 628 | synchronize_net(); |
621 | ipq_flush(NULL, 0); | 629 | ipq_flush(NULL, 0); |
622 | 630 | ||
631 | #ifdef CONFIG_SYSCTL | ||
623 | unregister_sysctl_table(ipq_sysctl_header); | 632 | unregister_sysctl_table(ipq_sysctl_header); |
633 | #endif | ||
624 | unregister_netdevice_notifier(&ipq_dev_notifier); | 634 | unregister_netdevice_notifier(&ipq_dev_notifier); |
625 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); | 635 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); |
626 | 636 | ||
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 56b4ea6d29ed..e869916b05f1 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -515,6 +515,7 @@ static struct notifier_block ipq_nl_notifier = { | |||
515 | .notifier_call = ipq_rcv_nl_event, | 515 | .notifier_call = ipq_rcv_nl_event, |
516 | }; | 516 | }; |
517 | 517 | ||
518 | #ifdef CONFIG_SYSCTL | ||
518 | static struct ctl_table_header *ipq_sysctl_header; | 519 | static struct ctl_table_header *ipq_sysctl_header; |
519 | 520 | ||
520 | static ctl_table ipq_table[] = { | 521 | static ctl_table ipq_table[] = { |
@@ -528,7 +529,9 @@ static ctl_table ipq_table[] = { | |||
528 | }, | 529 | }, |
529 | { .ctl_name = 0 } | 530 | { .ctl_name = 0 } |
530 | }; | 531 | }; |
532 | #endif | ||
531 | 533 | ||
534 | #ifdef CONFIG_PROC_FS | ||
532 | static int ip6_queue_show(struct seq_file *m, void *v) | 535 | static int ip6_queue_show(struct seq_file *m, void *v) |
533 | { | 536 | { |
534 | read_lock_bh(&queue_lock); | 537 | read_lock_bh(&queue_lock); |
@@ -565,6 +568,7 @@ static const struct file_operations ip6_queue_proc_fops = { | |||
565 | .release = single_release, | 568 | .release = single_release, |
566 | .owner = THIS_MODULE, | 569 | .owner = THIS_MODULE, |
567 | }; | 570 | }; |
571 | #endif | ||
568 | 572 | ||
569 | static const struct nf_queue_handler nfqh = { | 573 | static const struct nf_queue_handler nfqh = { |
570 | .name = "ip6_queue", | 574 | .name = "ip6_queue", |
@@ -574,7 +578,7 @@ static const struct nf_queue_handler nfqh = { | |||
574 | static int __init ip6_queue_init(void) | 578 | static int __init ip6_queue_init(void) |
575 | { | 579 | { |
576 | int status = -ENOMEM; | 580 | int status = -ENOMEM; |
577 | struct proc_dir_entry *proc; | 581 | struct proc_dir_entry *proc __maybe_unused; |
578 | 582 | ||
579 | netlink_register_notifier(&ipq_nl_notifier); | 583 | netlink_register_notifier(&ipq_nl_notifier); |
580 | ipqnl = netlink_kernel_create(&init_net, NETLINK_IP6_FW, 0, | 584 | ipqnl = netlink_kernel_create(&init_net, NETLINK_IP6_FW, 0, |
@@ -584,6 +588,7 @@ static int __init ip6_queue_init(void) | |||
584 | goto cleanup_netlink_notifier; | 588 | goto cleanup_netlink_notifier; |
585 | } | 589 | } |
586 | 590 | ||
591 | #ifdef CONFIG_PROC_FS | ||
587 | proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); | 592 | proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); |
588 | if (proc) { | 593 | if (proc) { |
589 | proc->owner = THIS_MODULE; | 594 | proc->owner = THIS_MODULE; |
@@ -592,10 +597,11 @@ static int __init ip6_queue_init(void) | |||
592 | printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); | 597 | printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); |
593 | goto cleanup_ipqnl; | 598 | goto cleanup_ipqnl; |
594 | } | 599 | } |
595 | 600 | #endif | |
596 | register_netdevice_notifier(&ipq_dev_notifier); | 601 | register_netdevice_notifier(&ipq_dev_notifier); |
602 | #ifdef CONFIG_SYSCTL | ||
597 | ipq_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, ipq_table); | 603 | ipq_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, ipq_table); |
598 | 604 | #endif | |
599 | status = nf_register_queue_handler(PF_INET6, &nfqh); | 605 | status = nf_register_queue_handler(PF_INET6, &nfqh); |
600 | if (status < 0) { | 606 | if (status < 0) { |
601 | printk(KERN_ERR "ip6_queue: failed to register queue handler\n"); | 607 | printk(KERN_ERR "ip6_queue: failed to register queue handler\n"); |
@@ -604,11 +610,13 @@ static int __init ip6_queue_init(void) | |||
604 | return status; | 610 | return status; |
605 | 611 | ||
606 | cleanup_sysctl: | 612 | cleanup_sysctl: |
613 | #ifdef CONFIG_SYSCTL | ||
607 | unregister_sysctl_table(ipq_sysctl_header); | 614 | unregister_sysctl_table(ipq_sysctl_header); |
615 | #endif | ||
608 | unregister_netdevice_notifier(&ipq_dev_notifier); | 616 | unregister_netdevice_notifier(&ipq_dev_notifier); |
609 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); | 617 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); |
610 | 618 | ||
611 | cleanup_ipqnl: | 619 | cleanup_ipqnl: __maybe_unused |
612 | netlink_kernel_release(ipqnl); | 620 | netlink_kernel_release(ipqnl); |
613 | mutex_lock(&ipqnl_mutex); | 621 | mutex_lock(&ipqnl_mutex); |
614 | mutex_unlock(&ipqnl_mutex); | 622 | mutex_unlock(&ipqnl_mutex); |
@@ -624,7 +632,9 @@ static void __exit ip6_queue_fini(void) | |||
624 | synchronize_net(); | 632 | synchronize_net(); |
625 | ipq_flush(NULL, 0); | 633 | ipq_flush(NULL, 0); |
626 | 634 | ||
635 | #ifdef CONFIG_SYSCTL | ||
627 | unregister_sysctl_table(ipq_sysctl_header); | 636 | unregister_sysctl_table(ipq_sysctl_header); |
637 | #endif | ||
628 | unregister_netdevice_notifier(&ipq_dev_notifier); | 638 | unregister_netdevice_notifier(&ipq_dev_notifier); |
629 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); | 639 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); |
630 | 640 | ||