* linux-2.4.21 and IPv6
@ 2003-08-17 2:09 w.szukalski
2003-08-17 14:34 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 2+ messages in thread
From: w.szukalski @ 2003-08-17 2:09 UTC (permalink / raw)
To: netdev
I have written a small program to test IPv6 multicasting
with linux-2.4.21. A LAN connects three linux boxes.
I have found, that IPv6 sometimes fails.
With IPv6 group 'ff02::1':
struct sockaddr_in6 read6, write6;
struct ipv6_mreq mreq6;
inet_pton(AF_INET6, group, &mreq6.ipv6mr_multiaddr);
read6.sin6_family = AF_INET6;
read6.sin6_port = htons(readport);
read6.sin6_flowinfo = 0;
read6.sin6_scope_id = 0;
// ALTERNATIVE 1:
memset(&read6.sin6_addr, 0, sizeof(struct in6_addr));
// ALTERNATIVE 2:
inet_pton(AF_INET6, host, &read6.sin6_addr);
// ALTERNATIVE 3:
read6.sin6_addr = mreq6.ipv6mr_multiaddr;
bind(reader, (struct sockaddr *)&read6, sizeof(read6) );
bind() fails for alternative 3 with 'Invalid argument'.
connect(writer, (struct sockaddr*)&write6,
sizeof(struct sockaddr_in6));
connect() always fails with 'Invalid argument'.
With IPv4 group '224.0.0.1':
struct sockaddr_in read4, write4;
struct ip_mreq mreq4;
inet_pton(AF_INET, group, &mreq4.imr_multiaddr);
read4.sin_family = AF_INET;
read4.sin_port = htons(readport);
// ALTERNATIVE 1:
read4.sin_addr.s_addr = 0;
// ALTERNATIVE 2:
inet_pton(AF_INET, host, &read4.sin_addr);
// ALTERNATIVE 3:
read4.sin_addr = mreq4.imr_multiaddr;
bind(reader, (struct sockaddr *)&read4, sizeof(read4) );
bind() never fails.
connect(writer, (struct sockaddr*)&write4,
sizeof(struct sockaddr_in));
connect() never fails.
Why does IPv6 sometimes fail?
winfried
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: linux-2.4.21 and IPv6
2003-08-17 2:09 linux-2.4.21 and IPv6 w.szukalski
@ 2003-08-17 14:34 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 0 replies; 2+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-08-17 14:34 UTC (permalink / raw)
To: szukw000; +Cc: netdev
In article <20030817020925.A875@keun> (at Sun, 17 Aug 2003 02:09:25 GMT), "w.szukalski" <szukw000@students.uni-mainz.de> says:
> read6.sin6_scope_id = 0;
:
> // ALTERNATIVE 2:
> inet_pton(AF_INET6, host, &read6.sin6_addr);
>
> // ALTERNATIVE 3:
> read6.sin6_addr = mreq6.ipv6mr_multiaddr;
What is host?
> bind(reader, (struct sockaddr *)&read6, sizeof(read6) );
>
> bind() fails for alternative 3 with 'Invalid argument'.
bind(2) should fail with ALT.2 for some "host."
Anyway, the reason seems that you forgot to set scope-id for
link-local scope addresses.
--yoshfuji
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-08-17 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-17 2:09 linux-2.4.21 and IPv6 w.szukalski
2003-08-17 14:34 ` YOSHIFUJI Hideaki / 吉藤英明
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).