mirror of
https://github.com/strongswan/strongswan.git
synced 2025-11-08 00:02:19 -05:00
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.
This commit is contained in:
parent
87888f9926
commit
3065081c3e
@ -2720,10 +2720,12 @@ static bool add_port_bypass(private_kernel_netlink_ipsec_t *this,
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#ifdef SO_PROTOCOL /* since 2.6.32 */
|
||||||
len = sizeof(bypass.proto);
|
len = sizeof(bypass.proto);
|
||||||
if (getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &bypass.proto, &len) != 0)
|
if (getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &bypass.proto, &len) != 0)
|
||||||
{
|
#endif
|
||||||
return FALSE;
|
{ /* assume UDP if SO_PROTOCOL not supported */
|
||||||
|
bypass.proto = IPPROTO_UDP;
|
||||||
}
|
}
|
||||||
switch (family)
|
switch (family)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user