diff options
author | Tobias Brunner <tobias@strongswan.org> | 2009-08-05 12:31:10 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2009-08-05 12:31:10 +0200 |
commit | 7da1f4a0ffebd22018b37a7d5533b1cfc2105d49 (patch) | |
tree | be910d9cfd96437c6d4aefaf6a1dc5b5d5fe9801 /src/charon/network/socket.c | |
parent | fcdf491a21b4e0822f2ee22f13e9169029666f70 (diff) | |
download | strongswan-7da1f4a0ffebd22018b37a7d5533b1cfc2105d49.tar.bz2 strongswan-7da1f4a0ffebd22018b37a7d5533b1cfc2105d49.tar.xz |
Enabling UDP encapsulation via setsockopt fails on Mac OS X (it is also not required as this is done using sysctl).
Diffstat (limited to 'src/charon/network/socket.c')
-rw-r--r-- | src/charon/network/socket.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/charon/network/socket.c b/src/charon/network/socket.c index 2ad695e13..fc1559251 100644 --- a/src/charon/network/socket.c +++ b/src/charon/network/socket.c @@ -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) { int on = TRUE; - int type = UDP_ENCAP_ESPINUDP; struct sockaddr_storage addr; socklen_t addrlen; u_int sol, pktinfo = 0; @@ -505,13 +504,18 @@ static int open_socket(private_socket_t *this, int family, u_int16_t port) return 0; } } - - /* enable UDP decapsulation globally, only for one socket needed */ - if (family == AF_INET && port == IKEV2_NATT_PORT && - setsockopt(skt, SOL_UDP, UDP_ENCAP, &type, sizeof(type)) < 0) + +#ifndef __APPLE__ { - DBG1(DBG_NET, "unable to set UDP_ENCAP: %s", strerror(errno)); + /* enable UDP decapsulation globally, only for one socket needed */ + int type = UDP_ENCAP_ESPINUDP; + if (family == AF_INET && port == IKEV2_NATT_PORT && + setsockopt(skt, SOL_UDP, UDP_ENCAP, &type, sizeof(type)) < 0) + { + DBG1(DBG_NET, "unable to set UDP_ENCAP: %s", strerror(errno)); + } } +#endif return skt; } |