aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-09-12 07:05:38 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:09 -0400
commitb4b510290b056b86611757ce1175a230f1080f53 (patch)
tree7bd1d45855ac7457be6d50338c60751f19e436d9 /net/ipv4
parente9dc86534051b78e41e5b746cccc291b57a3a311 (diff)
[NET]: Support multiple network namespaces with netlink
Each netlink socket will live in exactly one network namespace, this includes the controlling kernel sockets. This patch updates all of the existing netlink protocols to only support the initial network namespace. Request by clients in other namespaces will get -ECONREFUSED. As they would if the kernel did not have the support for that netlink protocol compiled in. As each netlink protocol is updated to be multiple network namespace safe it can register multiple kernel sockets to acquire a presence in the rest of the network namespaces. The implementation in af_netlink is a simple filter implementation at hash table insertion and hash table look up time. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_frontend.c4
-rw-r--r--net/ipv4/inet_diag.c4
-rw-r--r--net/ipv4/netfilter/ip_queue.c6
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c3
4 files changed, 9 insertions, 8 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index cefb55ec3d62..140bf7a8d877 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -816,8 +816,8 @@ static void nl_fib_input(struct sock *sk, int len)
816 816
817static void nl_fib_lookup_init(void) 817static void nl_fib_lookup_init(void)
818{ 818{
819 netlink_kernel_create(NETLINK_FIB_LOOKUP, 0, nl_fib_input, NULL, 819 netlink_kernel_create(&init_net, NETLINK_FIB_LOOKUP, 0, nl_fib_input,
820 THIS_MODULE); 820 NULL, THIS_MODULE);
821} 821}
822 822
823static void fib_disable_ip(struct net_device *dev, int force) 823static void fib_disable_ip(struct net_device *dev, int force)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 686ddd62f71a..031cc4856b49 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -897,8 +897,8 @@ static int __init inet_diag_init(void)
897 if (!inet_diag_table) 897 if (!inet_diag_table)
898 goto out; 898 goto out;
899 899
900 idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, 0, inet_diag_rcv, 900 idiagnl = netlink_kernel_create(&init_net, NETLINK_INET_DIAG, 0,
901 NULL, THIS_MODULE); 901 inet_diag_rcv, NULL, THIS_MODULE);
902 if (idiagnl == NULL) 902 if (idiagnl == NULL)
903 goto out_free_table; 903 goto out_free_table;
904 err = 0; 904 err = 0;
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index d91856097f25..82fda92e6b97 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -579,7 +579,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
579 if (event == NETLINK_URELEASE && 579 if (event == NETLINK_URELEASE &&
580 n->protocol == NETLINK_FIREWALL && n->pid) { 580 n->protocol == NETLINK_FIREWALL && n->pid) {
581 write_lock_bh(&queue_lock); 581 write_lock_bh(&queue_lock);
582 if (n->pid == peer_pid) 582 if ((n->net == &init_net) && (n->pid == peer_pid))
583 __ipq_reset(); 583 __ipq_reset();
584 write_unlock_bh(&queue_lock); 584 write_unlock_bh(&queue_lock);
585 } 585 }
@@ -671,8 +671,8 @@ static int __init ip_queue_init(void)
671 struct proc_dir_entry *proc; 671 struct proc_dir_entry *proc;
672 672
673 netlink_register_notifier(&ipq_nl_notifier); 673 netlink_register_notifier(&ipq_nl_notifier);
674 ipqnl = netlink_kernel_create(NETLINK_FIREWALL, 0, ipq_rcv_sk, 674 ipqnl = netlink_kernel_create(&init_net, NETLINK_FIREWALL, 0,
675 NULL, THIS_MODULE); 675 ipq_rcv_sk, NULL, THIS_MODULE);
676 if (ipqnl == NULL) { 676 if (ipqnl == NULL) {
677 printk(KERN_ERR "ip_queue: failed to create netlink socket\n"); 677 printk(KERN_ERR "ip_queue: failed to create netlink socket\n");
678 goto cleanup_netlink_notifier; 678 goto cleanup_netlink_notifier;
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 6ca43e4ca7e3..c636d6d63574 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -409,7 +409,8 @@ static int __init ipt_ulog_init(void)
409 for (i = 0; i < ULOG_MAXNLGROUPS; i++) 409 for (i = 0; i < ULOG_MAXNLGROUPS; i++)
410 setup_timer(&ulog_buffers[i].timer, ulog_timer, i); 410 setup_timer(&ulog_buffers[i].timer, ulog_timer, i);
411 411
412 nflognl = netlink_kernel_create(NETLINK_NFLOG, ULOG_MAXNLGROUPS, NULL, 412 nflognl = netlink_kernel_create(&init_net,
413 NETLINK_NFLOG, ULOG_MAXNLGROUPS, NULL,
413 NULL, THIS_MODULE); 414 NULL, THIS_MODULE);
414 if (!nflognl) 415 if (!nflognl)
415 return -ENOMEM; 416 return -ENOMEM;