vici: Fallback to socket listening port if no explicit local port specified
authorMartin Willi <martin@revosec.ch>
Tue, 6 May 2014 13:38:30 +0000 (15:38 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 7 May 2014 12:13:39 +0000 (14:13 +0200)
src/libcharon/plugins/vici/vici_config.c

index 34a0f46..c180b0e 100644 (file)
@@ -1709,7 +1709,6 @@ CALLBACK(config_sn, bool,
                .pull = TRUE,
                .send_cert = CERT_SEND_IF_ASKED,
                .version = IKE_ANY,
-               .local_port = IKEV2_UDP_PORT,
                .remote_port = IKEV2_UDP_PORT,
                .fragmentation = FRAGMENTATION_NO,
                .unique = UNIQUE_NO,
@@ -1759,6 +1758,10 @@ CALLBACK(config_sn, bool,
        {
                peer.remote_addrs = strdup("%any");
        }
+       if (!peer.local_port)
+       {
+               peer.local_port = charon->socket->get_port(charon->socket, FALSE);
+       }
 
        if (peer.over_time == LFT_UNDEFINED)
        {