From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Naujoks Subject: Re: [PATCH 1/1] ipv6: Add sockopt IPV6_MULTICAST_ALL analogue to IP_MULTICAST_ALL Date: Mon, 10 Sep 2018 11:30:21 +0200 Message-ID: <5532db3d-5387-8347-e017-6443d0096d08@gmail.com> References: <20180910082715.11506-1-nautsch2@gmail.com> <20180910082715.11506-2-nautsch2@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Linux NetDev , Kernel hackers , "David S. Miller" , kuznet@ms2.inr.ac.ru, Hideaki YOSHIFUJI , Greg Kroah-Hartman , Erik Kline , Thomas Gleixner , Shaohua Li , Kate Stewart , Philippe Ombredanne To: =?UTF-8?Q?Maciej_=c5=bbenczykowski?= Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 9/10/18 11:07 AM, Maciej Żenczykowski wrote: > Any reason not to use the same bit that is used by ipv4? > (as in add the setsockopt/getsockopt but just toggle the v4 bit) > I wanted to keep the current behavior for an ipv6 socket as is. I think user space api/behavioral changes are frowned upon!? Currently the bit is settable for an ipv6 socket and changes the handling for ipv4 multicasts for that socket. If I had just added the socket option and set the v4 bit, you would get maybe unexpected behavior from that, if you used it for ipv4 multicasts. Another approach I tried, was to just honor the v4 bit in v6 context, like this: diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 4ae54aaca373..af1659327d46 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -636,7 +636,7 @@ bool inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr, } if (!mc) { rcu_read_unlock(); - return true; + return inet_sk(sk)->mc_all; } read_lock(&mc->sflock); psl = mc->sflist; But that has the same problem of changing current behavior in a possibly unexpected way. Regards Andre