From patchwork Fri May 13 06:24:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changli Gao X-Patchwork-Id: 95437 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 60952B6EEB for ; Fri, 13 May 2011 16:26:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753061Ab1EMGZ6 (ORCPT ); Fri, 13 May 2011 02:25:58 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:46028 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148Ab1EMGZ5 (ORCPT ); Fri, 13 May 2011 02:25:57 -0400 Received: by pzk9 with SMTP id 9so1040070pzk.19 for ; Thu, 12 May 2011 23:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=+B5h0oJy7WQeVXYxmY0bAUmM0FUhOZxHQGOGvH3jVBo=; b=k867Rd52N/zhXBLTdMWcXpN9YKJE7EVm/v9Da3DsPpcVGj1uzXEqEnjlra1xQv1o+L nUBO8bZgLggwZ0nIPjwRaM8b/3abA3MPO3w9wkTUhyAdDrxA60DL/NQZmLz1cQuDbuh7 Y5zFULhRWbnd62yoeyedmlXJHqP8cxOp695fc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=ewLsdW2jf/tZnHDEv5fGbX2JFy1hNpC1uq4EVLloPzSw/M5NfBkTP2rScIYfj3+wGs 7sWrcI4TwCFS2SEXmpiatCAgQ6d0StGcbZ2DGhBWCdB9FzQrKbUd4Cp54pBg9KvB4BJH iqB9zi4T0VO/o7IDBP1fk3821kdLGiDLkPnT4= Received: by 10.68.51.98 with SMTP id j2mr1627623pbo.288.1305267956982; Thu, 12 May 2011 23:25:56 -0700 (PDT) Received: from localhost.localdomain ([221.239.34.230]) by mx.google.com with ESMTPS id f1sm1159660pbm.93.2011.05.12.23.25.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 May 2011 23:25:55 -0700 (PDT) From: Changli Gao To: "David S. Miller" Cc: netdev@vger.kernel.org, Changli Gao Subject: [PATCH] net: netlink: don't try unicast when dst_pid is zero for NETLINK_USERSOCK Date: Fri, 13 May 2011 14:24:54 +0800 Message-Id: <1305267894-3314-1-git-send-email-xiaosuo@gmail.com> X-Mailer: git-send-email 1.7.3.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- net/netlink/af_netlink.c | 2 ++ 1 file changed, 2 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);