From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: IP_ADD_MEMBERSHIP with imr_ifindex!=0 for multiple processes with different interfaces Date: Mon, 23 Apr 2018 06:29:52 -0700 Message-ID: <361cdca0-679a-cc16-6de1-b35479fbbb83@gmail.com> References: <9208AF0D0E6F444F80E90796B4E51CA07C163C10@EXCHANGE01.muppets.local> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit To: "Klebsch, Mario" , "netdev@vger.kernel.org" Return-path: Received: from mail-pf0-f177.google.com ([209.85.192.177]:43750 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753282AbeDWN3z (ORCPT ); Mon, 23 Apr 2018 09:29:55 -0400 Received: by mail-pf0-f177.google.com with SMTP id j11so9304068pff.10 for ; Mon, 23 Apr 2018 06:29:55 -0700 (PDT) In-Reply-To: <9208AF0D0E6F444F80E90796B4E51CA07C163C10@EXCHANGE01.muppets.local> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 04/23/2018 06:22 AM, Klebsch, Mario wrote: > Hi, > > I have a problem with multicast reception in the linux kernel and I hope, this is the right place to ask for help or to report a bug. > > I need to receive multicasts on a single interface. I have written a small program, which executes IP_ADD_MEMBERSHIP with imr.imr_ifindex set to the interface index. The program works well, as long as only a single instance of this program is running. If I start a second instance on a different network interface, both programs receive multicast frames from both interfaces.  > > When called without argument, the test program list the network interfaces. When called with an interface name as argument, if starts receiving multicasts on that interface. > > I am running vanilla Linux kernel 4.12.0. > > # uname -a > Linux c627 4.12.0 #1 SMP Mon Apr 23 14:08:24 CEST 2018 i686 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz GenuineIntel GNU/Linux > # > > P.S. The program runs fine on MacOSX. > It looks like your program needs to use SO_BINDTODEVICE if it really wants this device filtering ?