mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-16 00:00:37 -04:00
socket-default: to bind to one dynamic port on OS X, create v4 socket before v6
It seems that the order of binding sockets of different address families to the same dynamic port must be v6-before-v4 on Linux, but v4-before-v6 on OS X.
This commit is contained in:
parent
a30727fe2b
commit
dc35d097b3
@ -692,9 +692,15 @@ socket_default_socket_t *socket_default_socket_create()
|
||||
}
|
||||
|
||||
/* we allocate IPv6 sockets first as that will reserve randomly allocated
|
||||
* ports also for IPv4 */
|
||||
* ports also for IPv4. On OS X, we have to do it the other way round
|
||||
* for the same effect. */
|
||||
#ifdef __APPLE__
|
||||
open_socketpair(this, AF_INET, &this->ipv4, &this->ipv4_natt, "IPv4");
|
||||
open_socketpair(this, AF_INET6, &this->ipv6, &this->ipv6_natt, "IPv6");
|
||||
#else /* !__APPLE__ */
|
||||
open_socketpair(this, AF_INET6, &this->ipv6, &this->ipv6_natt, "IPv6");
|
||||
open_socketpair(this, AF_INET, &this->ipv4, &this->ipv4_natt, "IPv4");
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
if (this->ipv4 == -1 && this->ipv6 == -1)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user