[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1305267894-3314-1-git-send-email-xiaosuo@gmail.com>
Date: Fri, 13 May 2011 14:24:54 +0800
From: Changli Gao <xiaosuo@...il.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org, Changli Gao <xiaosuo@...il.com>
Subject: [PATCH] net: netlink: don't try unicast when dst_pid is zero for NETLINK_USERSOCK
For NETLINK_USERSOCK, no one listens on PID 0, so sending a message only to
to a multicast group should not return -ECONNREFUSED.
Signed-off-by: Changli Gao <xiaosuo@...il.com>
---
net/netlink/af_netlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c8f35b5..ba89304 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1379,6 +1379,8 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
if (dst_group) {
atomic_inc(&skb->users);
netlink_broadcast(sk, skb, dst_pid, dst_group, GFP_KERNEL);
+ if (dst_pid == 0 && sk->sk_protocol == NETLINK_USERSOCK)
+ return len;
}
err = netlink_unicast(sk, skb, dst_pid, msg->msg_flags&MSG_DONTWAIT);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists