android: Apply configured server port
authorTobias Brunner <tobias@strongswan.org>
Tue, 16 Jun 2015 14:44:29 +0000 (16:44 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 28 Jul 2015 11:27:33 +0000 (13:27 +0200)
src/frontends/android/jni/libandroidbridge/backend/android_service.c
src/frontends/android/src/org/strongswan/android/logic/CharonVpnService.java

index 34fe4da..7ef3913 100644 (file)
@@ -681,11 +681,14 @@ static job_requeue_t initiate(private_android_service_t *this)
                }
        };
        char *type, *server;
+       int port;
 
        server = this->settings->get_str(this->settings, "connection.server", NULL);
+       port = this->settings->get_int(this->settings, "connection.port",
+                                                                  IKEV2_UDP_PORT);
        ike_cfg = ike_cfg_create(IKEV2, TRUE, TRUE, "0.0.0.0",
                                                         charon->socket->get_port(charon->socket, FALSE),
-                                                        server, IKEV2_UDP_PORT, FRAGMENTATION_YES, 0);
+                                                        server, port, FRAGMENTATION_YES, 0);
        ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
        ike_cfg->add_proposal(ike_cfg, proposal_create_default_aead(PROTO_IKE));
 
index ffe1449..236e759 100644 (file)
@@ -222,6 +222,7 @@ public class CharonVpnService extends VpnService implements Runnable
                                                        writer.setValue("global.mtu", mCurrentProfile.getMTU());
                                                        writer.setValue("connection.type", mCurrentProfile.getVpnType().getIdentifier());
                                                        writer.setValue("connection.server", mCurrentProfile.getGateway());
+                                                       writer.setValue("connection.port", mCurrentProfile.getPort());
                                                        writer.setValue("connection.username", mCurrentProfile.getUsername());
                                                        writer.setValue("connection.password", mCurrentProfile.getPassword());
                                                        initiate(writer.serialize());