aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-09-29 17:11:53 +0200
committerMartin Willi <martin@revosec.ch>2014-11-21 10:55:45 +0100
commit3065081c3e9d1505e37a6b4aef8d9f4955bce61a (patch)
tree9c758c68684855a8a5ffa225e98b4585133d8100 /src
parent87888f99265b8617fd430f2adc6c6c5e59a47979 (diff)
downloadstrongswan-3065081c3e9d1505e37a6b4aef8d9f4955bce61a.tar.bz2
strongswan-3065081c3e9d1505e37a6b4aef8d9f4955bce61a.tar.xz
kernel-netlink: Fallback to UDP if detecting socket protocol fails
getsockopt(SO_PROTOCOL) is not supported before 2.6.32. Default to UDP if either the SO_PROTOCOL define is missing or the syscall fails.
Diffstat (limited to 'src')
-rw-r--r--src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
index f0ada41d5..0f88b649e 100644
--- a/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
+++ b/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
@@ -2720,10 +2720,12 @@ static bool add_port_bypass(private_kernel_netlink_ipsec_t *this,
{
return FALSE;
}
+#ifdef SO_PROTOCOL /* since 2.6.32 */
len = sizeof(bypass.proto);
if (getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &bypass.proto, &len) != 0)
- {
- return FALSE;
+#endif
+ { /* assume UDP if SO_PROTOCOL not supported */
+ bypass.proto = IPPROTO_UDP;
}
switch (family)
{