netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Wei <lw@cn.fujitsu.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: Is there any necessary to add multicast route for a loopback device?
Date: Thu, 01 Dec 2011 14:01:27 +0800	[thread overview]
Message-ID: <4ED71837.6010309@cn.fujitsu.com> (raw)
In-Reply-To: <1322714206.2577.13.camel@edumazet-laptop>

Eric Dumazet wrote:
> Le jeudi 01 décembre 2011 à 12:31 +0800, Li Wei a écrit :
>>> From: Li Wei <lw@cn.fujitsu.com>
>>> Date: Thu, 01 Dec 2011 10:30:00 +0800
>>>
>>>> what's your opinion?
>>> I have many higher priority tasks than this issue, so it is a poor
>>> idea to try and force me to look into this.
>>>
>>> If no other developer cares to answer, maybe it isn't all that
>>> important.
>>>
>>>
>> My apologize :(
> 
> It would help us if you provide a test program an setup script, because
> we have litle time to figure out what exact problem you hit.
> 
> 
> 
> 
> 

Thanks Eric!

The following is the test code:
================================= cut ====================================
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>

#define MADDR	"ff00::00"

int main(int argc, char **argv) {
	struct ipv6_mreq mreq;
	struct in6_addr addr;
	unsigned int mcast_if;
	int sk;

	if((sk = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) {
		printf("socket\n");
		exit(1);
	}

	inet_pton(AF_INET6, MADDR, &addr);
	mreq.ipv6mr_multiaddr = addr;

	printf("== join a multicast group with the interface index is specified as 0 ==\n");
	mreq.ipv6mr_interface = 0;
	if (setsockopt(sk, IPPROTO_IPV6, IPV6_JOIN_GROUP,
		       (char *) &mreq, sizeof(mreq)) == -1) {
		perror("setsockopt IPV6_JOIN_GROUP");
		exit(1);
	}

	close(sk);

	printf("OK\n");
	return 0;
}
================================= cut ====================================

My aim is to join a multicast group without the interface index specified, as the RFC 3493
(5.2 Sending and Receiving Multicast Packets) said "If the interface index is specified as 0,
the kernel chooses the local interface.".

When this test run on Fedora 15(ipv6 enabled), it failed and return error ENODEV.

This problem can be reproduced by the following steps:
1. enable ipv6 if you haven't
# modprobe ipv6
2. make all network interfaces down
# ip link set lo down; ip link set eth0 down; ...
3. set a ipv6 address for lo
# ip addr add ::1/128 dev lo
4. make all interfaces up
# ip link set lo up; ip link set eth0 up; ...

run test and it will return ENODEV

      reply	other threads:[~2011-12-01  6:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30  7:38 Is there any necessary to add multicast route for a loopback device? Li Wei
2011-12-01  2:30 ` Li Wei
2011-12-01  3:35   ` David Miller
2011-12-01  4:31     ` Li Wei
2011-12-01  4:36       ` Eric Dumazet
2011-12-01  6:01         ` Li Wei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ED71837.6010309@cn.fujitsu.com \
    --to=lw@cn.fujitsu.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).