[erlang-patches] [PATCH] Fix SCTP multihoming for IPv6
Tomas Abrahamsson
tomas.abrahamsson@REDACTED
Tue May 8 08:31:34 CEST 2012
On Mon, May 7, 2012 at 3:17 PM, Raimo Niskanen
<raimo+erlang-patches@REDACTED> wrote:
> On Sat, May 05, 2012 at 08:02:52PM +0200, Tomas Abrahamsson wrote:
>> On Tue, Apr 24, 2012 at 16:11, Raimo Niskanen
>> <raimo+erlang-patches@REDACTED> wrote:
>> > On Mon, Apr 23, 2012 at 11:21:08PM +0200, Tomas Abrahamsson wrote:
>> >> On Mon, Apr 23, 2012 at 16:16 +02:00, Raimo Niskanen wrote:
>> >> > Is it so that the sctp_bindx argument 2 declared as (struct sockaddr *)
>> >> > is in fact misused to be able to contain IPv6 addresses by packing
>> >> > them unaligned?
>> >> >
>> >> > If so, I would like this fact more visible in the code by defining 'addrs' as:
>> >> > char addrs[256 * sizeof(struct inet_address)]
>> >
>> > But before that the Linux man page says:
>> > If sd is an IPv4 socket, the addresses passed must be IPv4 addresses.
>> > If sd is an IPv6 socket, the addresses passed can be either IPv4 or
>> > IPv6 addresses.
>> >
>> > So it might be possible to mix them... And if that is allowed the only way
>> > I can see is packing them in a char array.
>> >
>> > If it is not allowed to pack them in a char array, the sctp_bindx call
>> > should be able to detect mixed addresses immediately on the first
>> > differing address.
>>
>> I've done some experimenting. It seems I was a bit too
>> early in claiming that multihoming works with the patch.
>> Should have tested other OSes. There are several issues.
>
> You got me worried, I thought I scared you off.
No problems, I found out I had to do some experimenting first,
but then I got interrupted and delayed.
I'll put together another patch, trying to address all
the issues discussed so far.
>> On Solaris, mixing ipv4 addresses and ipv6 adresses in the
>> call to sctp_bindx is not allowed according to the man page.
>> Specifying ipv4-mapped ipv6 addresses is allowed, though.
>> But it seems to half-work in practice: sctp_bindx does not
>> return an error when adding an ipv4 address to an ipv6 sctp
>> socket, but on the other hand, it does not seem to work to
>> connect to it over ipv4 and send sctp messages. The client
>> thinks it successfully connects, but the server does not see
>> anything. Same symptoms both when specifying an ipv4
>> address and an ipv4-mapped ipv6 address to sctp_bindx:
>> can't get ipv4 sctp communication to work.
>
> I would expect such problems on FreeBSD since you have to
> use a rc.conf setting: ipv6_ipv4mapping="YES" that sets
> a sysctl flag net.inet6.ip6.v6only: 0
> or the OS will not allow IPv6 sockets to handle IPv4 traffic.
> They claim there are too many security problems in that.
>
> So it would not surprise me if Solaris does something similar.
That's a good suggestion. Didn't know about it. Will dig into it
a bit to see if this could be a reason. The server side symptoms
were that poll didn't return, while the client saw a comm_up.
It might well fit with what you describe.
BRs
Tomas
More information about the erlang-patches
mailing list