aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2007-10-11 00:15:29 -0400
committerDavid S. Miller <davem@davemloft.net>2007-10-11 00:15:29 -0400
commitcd40b7d3983c708aabe3d3008ec64ffce56d33b0 (patch)
tree0d6fe9cfd2f03fdeee126e317d4bfb145afc458d /net/ipv6
parentaed815601f3f95281ab3a01f7e2cbe1bd54285a0 (diff)
[NET]: make netlink user -> kernel interface synchronious
This patch make processing netlink user -> kernel messages synchronious. This change was inspired by the talk with Alexey Kuznetsov about current netlink messages processing. He says that he was badly wrong when introduced asynchronious user -> kernel communication. The call netlink_unicast is the only path to send message to the kernel netlink socket. But, unfortunately, it is also used to send data to the user. Before this change the user message has been attached to the socket queue and sk->sk_data_ready was called. The process has been blocked until all pending messages were processed. The bad thing is that this processing may occur in the arbitrary process context. This patch changes nlk->data_ready callback to get 1 skb and force packet processing right in the netlink_unicast. Kernel -> user path in netlink_unicast remains untouched. EINTR processing for in netlink_run_queue was changed. It forces rtnl_lock drop, but the process remains in the cycle until the message will be fully processed. So, there is no need to use this kludges now. Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/netfilter/ip6_queue.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index c75f467a8f51..0473145ac534 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -464,7 +464,7 @@ ipq_dev_drop(int ifindex)
464#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0) 464#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0)
465 465
466static inline void 466static inline void
467ipq_rcv_skb(struct sk_buff *skb) 467__ipq_rcv_skb(struct sk_buff *skb)
468{ 468{
469 int status, type, pid, flags, nlmsglen, skblen; 469 int status, type, pid, flags, nlmsglen, skblen;
470 struct nlmsghdr *nlh; 470 struct nlmsghdr *nlh;
@@ -522,19 +522,10 @@ ipq_rcv_skb(struct sk_buff *skb)
522} 522}
523 523
524static void 524static void
525ipq_rcv_sk(struct sock *sk, int len) 525ipq_rcv_skb(struct sk_buff *skb)
526{ 526{
527 struct sk_buff *skb;
528 unsigned int qlen;
529
530 mutex_lock(&ipqnl_mutex); 527 mutex_lock(&ipqnl_mutex);
531 528 __ipq_rcv_skb(skb);
532 for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) {
533 skb = skb_dequeue(&sk->sk_receive_queue);
534 ipq_rcv_skb(skb);
535 kfree_skb(skb);
536 }
537
538 mutex_unlock(&ipqnl_mutex); 529 mutex_unlock(&ipqnl_mutex);
539} 530}
540 531
@@ -658,8 +649,8 @@ static int __init ip6_queue_init(void)
658 struct proc_dir_entry *proc; 649 struct proc_dir_entry *proc;
659 650
660 netlink_register_notifier(&ipq_nl_notifier); 651 netlink_register_notifier(&ipq_nl_notifier);
661 ipqnl = netlink_kernel_create(&init_net, NETLINK_IP6_FW, 0, ipq_rcv_sk, 652 ipqnl = netlink_kernel_create(&init_net, NETLINK_IP6_FW, 0,
662 NULL, THIS_MODULE); 653 ipq_rcv_skb, NULL, THIS_MODULE);
663 if (ipqnl == NULL) { 654 if (ipqnl == NULL) {
664 printk(KERN_ERR "ip6_queue: failed to create netlink socket\n"); 655 printk(KERN_ERR "ip6_queue: failed to create netlink socket\n");
665 goto cleanup_netlink_notifier; 656 goto cleanup_netlink_notifier;