Enabling UDP encapsulation via setsockopt fails on Mac OS X (it is also not required as this is done using sysctl).
This commit is contained in:
@@ -434,7 +434,6 @@ status_t sender(private_socket_t *this, packet_t *packet)
|
|||||||
static int open_socket(private_socket_t *this, int family, u_int16_t port)
|
static int open_socket(private_socket_t *this, int family, u_int16_t port)
|
||||||
{
|
{
|
||||||
int on = TRUE;
|
int on = TRUE;
|
||||||
int type = UDP_ENCAP_ESPINUDP;
|
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
u_int sol, pktinfo = 0;
|
u_int sol, pktinfo = 0;
|
||||||
@@ -506,12 +505,17 @@ static int open_socket(private_socket_t *this, int family, u_int16_t port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __APPLE__
|
||||||
|
{
|
||||||
/* enable UDP decapsulation globally, only for one socket needed */
|
/* enable UDP decapsulation globally, only for one socket needed */
|
||||||
|
int type = UDP_ENCAP_ESPINUDP;
|
||||||
if (family == AF_INET && port == IKEV2_NATT_PORT &&
|
if (family == AF_INET && port == IKEV2_NATT_PORT &&
|
||||||
setsockopt(skt, SOL_UDP, UDP_ENCAP, &type, sizeof(type)) < 0)
|
setsockopt(skt, SOL_UDP, UDP_ENCAP, &type, sizeof(type)) < 0)
|
||||||
{
|
{
|
||||||
DBG1(DBG_NET, "unable to set UDP_ENCAP: %s", strerror(errno));
|
DBG1(DBG_NET, "unable to set UDP_ENCAP: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return skt;
|
return skt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user