Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1025714ybe; Wed, 4 Sep 2019 11:20:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqykT5Is7y4ksmGIE/ZfDTNka2U4AyL7ak4e3lNvYIX5+2/xYD7j64jd/1886qztJ0atveHY X-Received: by 2002:a17:902:d717:: with SMTP id w23mr42741645ply.321.1567621215401; Wed, 04 Sep 2019 11:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621215; cv=none; d=google.com; s=arc-20160816; b=hFuzH5NLQrriLi5INYhAfuPCkzk/SBh1JZrPrKjNnN6zZbEKu8BGgkPVZmN7AqsaRx a7cCsetlSmErJ6JXdPNcpKkcyg6pREjiRdu/RUQq/KYKoBQpYpvp4me7YIuK44K7gIx9 V6ssF/c0gG0W4FIcb6pGsmoey4aPCUygWeozwqBwCwW3HujRk40dU/y3nlSB/pw8lCM2 Bcv1+GmGaMrM7avy3bwtEWzAIut8B7dUvqh1ixiJQq5O+FjsmmBC8vh9CuUW4dfLzOVj 4AYsk8synS4i4aymd3BfDLb8W2Ky6+oqMoV3NmiGwNLi7YWEEV4TaN2+U7hbuIJ/Wdn+ km6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+v2OonpjacbP8vOWa5P/A0UaN+bu+V2DmbcwD2CarQM=; b=VAp2JawW+NvlHK5SfMfJQ7V5ElWhP2DfGRYDEzJMwmCDcQqeRmSD7NFG+KA228g2Zy 0XTGkXCdPu7ePalMOpOK1tzhav3FQG4rWm33lslgXqjPlDosu/YFBU4WW46/Awe/mhhz 6OcbHc9WliM09Ka4U4aMxO7m3F3k//TGlwtJ1KIwWY2l9o05roR7TM+fK89Zmf484dr/ itQQ4FMHSWZEtpwPG6cc56S1fM9osx0BDD8GbWLiU3JXS9SWW/AYej71fuX8hBVUdidc nDsspV/O0Ku9HQICpbp/LCdpl37w2Ps+ZV51Zz3U0S08Jt2frQEggIb/s8fgL/ZGIt4U jJ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J51wImAS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91si14249349pld.3.2019.09.04.11.19.59; Wed, 04 Sep 2019 11:20:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J51wImAS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390233AbfIDSLM (ORCPT + 99 others); Wed, 4 Sep 2019 14:11:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:55040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390218AbfIDSLI (ORCPT ); Wed, 4 Sep 2019 14:11:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4849922CEA; Wed, 4 Sep 2019 18:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620667; bh=56xJezm7lAXrT8d3Ze0+Y4GyCi8LcSm62OVfEg/l9BY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J51wImASU42SVUzhdu4lCVUEQ7lKhr3ttJE4cLklKHJtNgJx+KDaBXn6jBZQhm+QJ +ZgUbKLKJ854LG8PL1QnStLUea3lRYAkDT/aqxXsHjKjF7nEezcuGGI8TCQTd7cadv mrvHOiQD3J+560rkon535VS1AO7UDxXMCvaF+mWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianlin Shi , Hangbin Liu , "David S. Miller" Subject: [PATCH 5.2 049/143] ipv6/addrconf: allow adding multicast addr if IFA_F_MCAUTOJOIN is set Date: Wed, 4 Sep 2019 19:53:12 +0200 Message-Id: <20190904175315.989326532@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hangbin Liu [ Upstream commit f17f7648a49aa6728649ddf79bdbcac4f1970ce4 ] In commit 93a714d6b53d ("multicast: Extend ip address command to enable multicast group join/leave on") we added a new flag IFA_F_MCAUTOJOIN to make user able to add multicast address on ethernet interface. This works for IPv4, but not for IPv6. See the inet6_addr_add code. static int inet6_addr_add() { ... if (cfg->ifa_flags & IFA_F_MCAUTOJOIN) { ipv6_mc_config(net->ipv6.mc_autojoin_sk, true...) } ifp = ipv6_add_addr(idev, cfg, true, extack); <- always fail with maddr if (!IS_ERR(ifp)) { ... } else if (cfg->ifa_flags & IFA_F_MCAUTOJOIN) { ipv6_mc_config(net->ipv6.mc_autojoin_sk, false...) } } But in ipv6_add_addr() it will check the address type and reject multicast address directly. So this feature is never worked for IPv6. We should not remove the multicast address check totally in ipv6_add_addr(), but could accept multicast address only when IFA_F_MCAUTOJOIN flag supplied. v2: update commit description Fixes: 93a714d6b53d ("multicast: Extend ip address command to enable multicast group join/leave on") Reported-by: Jianlin Shi Signed-off-by: Hangbin Liu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/addrconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1045,7 +1045,8 @@ ipv6_add_addr(struct inet6_dev *idev, st int err = 0; if (addr_type == IPV6_ADDR_ANY || - addr_type & IPV6_ADDR_MULTICAST || + (addr_type & IPV6_ADDR_MULTICAST && + !(cfg->ifa_flags & IFA_F_MCAUTOJOIN)) || (!(idev->dev->flags & IFF_LOOPBACK) && !netif_is_l3_master(idev->dev) && addr_type & IPV6_ADDR_LOOPBACK))