aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/socket_default
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-02-06 13:12:51 +0100
committerMartin Willi <martin@revosec.ch>2013-02-06 15:20:32 +0100
commit6e82269ee69bde777d915d75b5534958d2217a62 (patch)
tree2e57880dc1c61029622d9941528ddd16ef0fa57d /src/libcharon/plugins/socket_default
parent1116689944422a0080043e8dc06110c7e702c0cd (diff)
downloadstrongswan-6e82269ee69bde777d915d75b5534958d2217a62.tar.bz2
strongswan-6e82269ee69bde777d915d75b5534958d2217a62.tar.xz
Don't send a packet in default socket if family is not IPv4 nor IPv6
Diffstat (limited to 'src/libcharon/plugins/socket_default')
-rw-r--r--src/libcharon/plugins/socket_default/socket_default_socket.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/libcharon/plugins/socket_default/socket_default_socket.c b/src/libcharon/plugins/socket_default/socket_default_socket.c
index 2cf32b0c0..942dafc2e 100644
--- a/src/libcharon/plugins/socket_default/socket_default_socket.c
+++ b/src/libcharon/plugins/socket_default/socket_default_socket.c
@@ -322,24 +322,30 @@ METHOD(socket_t, sender, status_t,
family = dst->get_family(dst);
if (sport == 0 || sport == this->port)
{
- if (family == AF_INET)
- {
- skt = this->ipv4;
- }
- else
+ switch (family)
{
- skt = this->ipv6;
+ case AF_INET:
+ skt = this->ipv4;
+ break;
+ case AF_INET6:
+ skt = this->ipv6;
+ break;
+ default:
+ return FAILED;
}
}
else if (sport == this->natt)
{
- if (family == AF_INET)
- {
- skt = this->ipv4_natt;
- }
- else
+ switch (family)
{
- skt = this->ipv6_natt;
+ case AF_INET:
+ skt = this->ipv4_natt;
+ break;
+ case AF_INET6:
+ skt = this->ipv6_natt;
+ break;
+ default:
+ return FAILED;
}
}
else