* wrong family for IP addresses given by sctp library
@ 2014-12-03 10:50 Boiteux Frederic
2014-12-03 11:03 ` Ivan Skytte Jørgensen
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Boiteux Frederic @ 2014-12-03 10:50 UTC (permalink / raw)
To: linux-sctp
Hello,
I'm trying to use SCTP on Linux machines with 'old' kernels (Debian 5, 2.6.26 kernel and Debian 7, 3.2 kernel). I've setup a program which can handles IPv4 and IPv6 addresses, and for that, I use a socket with AF_INET6 family, then I bind it to IPv4 or v6 addresses with sctp_bindx() (its manual page says this call can handle both v4 and v6 adresses if the socket is an IPv6 one).
It seems to work well, but I have a strange behavior : on a test platform with only IPv4 addresses, when I get messages or notifications (using sctp_recvmsg()), the addresses given in it (IP address of the sender, or confirmation/fail of some peer addresses) are always from the IPv6 family !
For example, for received messages, the « from » socket address returned by sctp_recvmsg() has always a sa_family field to AF_INET6, even if the address is in fact an IPv4 address ! Using getnameinfo() with NI_NUMERICHOST option, I can get the ascii representation of the address, a 4 dotted address, and then I have to fix the address to use it with its real family (as I expected to receive).
It seems to be directly related to the AF_INET6 family of the socket, but I don't know if it' s a known problem, possibly fixed since then in latest linux-sctip library, or probably a programmatic error from me.
Have you ever heard for such problem ? What is your feeling about ?
With regards,
Fred.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wrong family for IP addresses given by sctp library
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
@ 2014-12-03 11:03 ` Ivan Skytte Jørgensen
2014-12-03 11:25 ` Michael Tuexen
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ivan Skytte Jørgensen @ 2014-12-03 11:03 UTC (permalink / raw)
To: linux-sctp
On Wednesday 03 December 2014 11:50:31 Boiteux Frederic wrote:
>
> I'm trying to use SCTP on Linux machines with 'old' kernels (Debian 5, 2.6.26 kernel and Debian 7, 3.2 kernel). I've setup a program which can handles IPv4 and IPv6 addresses, and for that, I use a socket with AF_INET6 family, then I bind it to IPv4 or v6 addresses with sctp_bindx() (its manual page says this call can handle both v4 and v6 adresses if the socket is an IPv6 one).
> It seems to work well, but I have a strange behavior : on a test platform with only IPv4 addresses, when I get messages or notifications (using sctp_recvmsg()), the addresses given in it (IP address of the sender, or confirmation/fail of some peer addresses) are always from the IPv6 family !
Isn't the returned address simply a IPv6-mapped IPv4 address (::ffff:1.2.3.4) ? You can test it with IN6_IS_ADDR_V4MAPPED.
/isj
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wrong family for IP addresses given by sctp library
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
2014-12-03 11:03 ` Ivan Skytte Jørgensen
@ 2014-12-03 11:25 ` Michael Tuexen
2014-12-03 11:30 ` Daniel Borkmann
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Michael Tuexen @ 2014-12-03 11:25 UTC (permalink / raw)
To: linux-sctp
On 03 Dec 2014, at 11:50, Boiteux Frederic <fboiteux@prosodie.com> wrote:
> Hello,
>
> I'm trying to use SCTP on Linux machines with 'old' kernels (Debian 5, 2.6.26 kernel and Debian 7, 3.2 kernel). I've setup a program which can handles IPv4 and IPv6 addresses, and for that, I use a socket with AF_INET6 family, then I bind it to IPv4 or v6 addresses with sctp_bindx() (its manual page says this call can handle both v4 and v6 adresses if the socket is an IPv6 one).
> It seems to work well, but I have a strange behavior : on a test platform with only IPv4 addresses, when I get messages or notifications (using sctp_recvmsg()), the addresses given in it (IP address of the sender, or confirmation/fail of some peer addresses) are always from the IPv6 family !
Is it possible that the address are mapped V4 addresses?
Best regards
Michael
> For example, for received messages, the « from » socket address returned by sctp_recvmsg() has always a sa_family field to AF_INET6, even if the address is in fact an IPv4 address ! Using getnameinfo() with NI_NUMERICHOST option, I can get the ascii representation of the address, a 4 dotted address, and then I have to fix the address to use it with its real family (as I expected to receive).
> It seems to be directly related to the AF_INET6 family of the socket, but I don't know if it' s a known problem, possibly fixed since then in latest linux-sctip library, or probably a programmatic error from me.
>
> Have you ever heard for such problem ? What is your feeling about ?
>
> With regards,
> Fred.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wrong family for IP addresses given by sctp library
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
2014-12-03 11:03 ` Ivan Skytte Jørgensen
2014-12-03 11:25 ` Michael Tuexen
@ 2014-12-03 11:30 ` Daniel Borkmann
2014-12-03 13:27 ` Boiteux Frederic
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Daniel Borkmann @ 2014-12-03 11:30 UTC (permalink / raw)
To: linux-sctp
On 12/03/2014 12:25 PM, Michael Tuexen wrote:
> On 03 Dec 2014, at 11:50, Boiteux Frederic <fboiteux@prosodie.com> wrote:
>
>> Hello,
>>
>> I'm trying to use SCTP on Linux machines with 'old' kernels (Debian 5, 2.6.26 kernel and Debian 7, 3.2 kernel). I've setup a program which can handles IPv4 and IPv6 addresses, and for that, I use a socket with AF_INET6 family, then I bind it to IPv4 or v6 addresses with sctp_bindx() (its manual page says this call can handle both v4 and v6 adresses if the socket is an IPv6 one).
>> It seems to work well, but I have a strange behavior : on a test platform with only IPv4 addresses, when I get messages or notifications (using sctp_recvmsg()), the addresses given in it (IP address of the sender, or confirmation/fail of some peer addresses) are always from the IPv6 family !
> Is it possible that the address are mapped V4 addresses?
Hmm, Frederic, could you try with a current kernel? We've had fixes
in the past such as ...
commit 299ee123e19889d511092347f5fc14db0f10e3a6
Author: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date: Wed Jul 30 12:40:53 2014 -0600
sctp: Fixup v4mapped behaviour to comply with Sock API
> Best regards
> Michael
>> For example, for received messages, the « from » socket address returned by sctp_recvmsg() has always a sa_family field to AF_INET6, even if the address is in fact an IPv4 address ! Using getnameinfo() with NI_NUMERICHOST option, I can get the ascii representation of the address, a 4 dotted address, and then I have to fix the address to use it with its real family (as I expected to receive).
>> It seems to be directly related to the AF_INET6 family of the socket, but I don't know if it' s a known problem, possibly fixed since then in latest linux-sctip library, or probably a programmatic error from me.
>>
>> Have you ever heard for such problem ? What is your feeling about ?
>>
>> With regards,
>> Fred.
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: wrong family for IP addresses given by sctp library
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
` (2 preceding siblings ...)
2014-12-03 11:30 ` Daniel Borkmann
@ 2014-12-03 13:27 ` Boiteux Frederic
2014-12-03 15:30 ` Michael Tuexen
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Boiteux Frederic @ 2014-12-03 13:27 UTC (permalink / raw)
To: linux-sctp
Hello Ivan, Michael, Daniel,
> Isn't the returned address simply a IPv6-mapped IPv4 address (::ffff:1.2.3.4) ? You can test it with IN6_IS_ADDR_V4MAPPED.
Yes, it is (I've verified with the provided macro) ! I'll use this macro to detect and update provided addresses, thanks !
Daniel, I'll try to test it on a recent kernel, but it will take some time to set up... thanks for the commit's reference !
Regards,
Fred.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wrong family for IP addresses given by sctp library
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
` (3 preceding siblings ...)
2014-12-03 13:27 ` Boiteux Frederic
@ 2014-12-03 15:30 ` Michael Tuexen
2014-12-03 15:36 ` Vlad Yasevich
2014-12-03 15:41 ` Boiteux Frederic
6 siblings, 0 replies; 8+ messages in thread
From: Michael Tuexen @ 2014-12-03 15:30 UTC (permalink / raw)
To: linux-sctp
On 03 Dec 2014, at 14:27, Boiteux Frederic <fboiteux@prosodie.com> wrote:
> Hello Ivan, Michael, Daniel,
>
>> Isn't the returned address simply a IPv6-mapped IPv4 address (::ffff:1.2.3.4) ? You can test it with IN6_IS_ADDR_V4MAPPED.
>
> Yes, it is (I've verified with the provided macro) ! I'll use this macro to detect and update provided addresses, thanks !
Not sure if LKSCTP supports it, but you can use
https://tools.ietf.org/html/rfc6458#section-8.1.15
to control if the addresses should be provided as IPv4 addresses or mapped IPv6 ones.
Best regards
Michael
>
>
> Daniel, I'll try to test it on a recent kernel, but it will take some time to set up... thanks for the commit's reference !
>
> Regards,
> Fred.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wrong family for IP addresses given by sctp library
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
` (4 preceding siblings ...)
2014-12-03 15:30 ` Michael Tuexen
@ 2014-12-03 15:36 ` Vlad Yasevich
2014-12-03 15:41 ` Boiteux Frederic
6 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2014-12-03 15:36 UTC (permalink / raw)
To: linux-sctp
On 12/03/2014 10:30 AM, Michael Tuexen wrote:
> On 03 Dec 2014, at 14:27, Boiteux Frederic <fboiteux@prosodie.com> wrote:
>
>> Hello Ivan, Michael, Daniel,
>>
>>> Isn't the returned address simply a IPv6-mapped IPv4 address (::ffff:1.2.3.4) ? You can test it with IN6_IS_ADDR_V4MAPPED.
>>
>> Yes, it is (I've verified with the provided macro) ! I'll use this macro to detect and update provided addresses, thanks !
> Not sure if LKSCTP supports it, but you can use
> https://tools.ietf.org/html/rfc6458#section-8.1.15
> to control if the addresses should be provided as IPv4 addresses or mapped IPv6 ones.
Yes it's supported, but there was an issue that was recently fixed.
-vlad
>
> Best regards
> Michael
>>
>>
>> Daniel, I'll try to test it on a recent kernel, but it will take some time to set up... thanks for the commit's reference !
>>
>> Regards,
>> Fred.
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: wrong family for IP addresses given by sctp library
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
` (5 preceding siblings ...)
2014-12-03 15:36 ` Vlad Yasevich
@ 2014-12-03 15:41 ` Boiteux Frederic
6 siblings, 0 replies; 8+ messages in thread
From: Boiteux Frederic @ 2014-12-03 15:41 UTC (permalink / raw)
To: linux-sctp
>> Isn't the returned address simply a IPv6-mapped IPv4 address (::ffff:1.2.3.4) ? You can test it with IN6_IS_ADDR_V4MAPPED.
> Yes, it is (I've verified with the provided macro) ! I'll use this macro to detect and update provided addresses, thanks !
Testing more carefully, no it actually seems NOT to be IPv4-mapped addresses !
I test it like this :
static struct sockaddr *fix_adr(struct sockaddr *addr)
{
if (addr->sa_family != AF_INET6) {
log_info("not an IPv6 address, nothing to do\n");
return addr;
}
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *) &addr;
if (! IN6_IS_ADDR_V4MAPPED(&(addr6->sin6_addr))) {
log_warn("@IP v6 '%s' is NOT an IPv4-mapped address !",
addr_ntoa(addr));
}
// convert it to ipv4 addr...
...
}
I get messages like :
@IP v6 '10.7.11.132' is NOT an IPv4-mapped address!
(the addr_ntoa() function uses getnameinfo(..., NI_NUMERICHOST) to retrieve ascii notation from given sockaddr address).
I'm not fluent with IPv6 addressing, so I don't know what to check...
Fred.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-12-03 15:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-03 10:50 wrong family for IP addresses given by sctp library Boiteux Frederic
2014-12-03 11:03 ` Ivan Skytte Jørgensen
2014-12-03 11:25 ` Michael Tuexen
2014-12-03 11:30 ` Daniel Borkmann
2014-12-03 13:27 ` Boiteux Frederic
2014-12-03 15:30 ` Michael Tuexen
2014-12-03 15:36 ` Vlad Yasevich
2014-12-03 15:41 ` Boiteux Frederic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.