vici: Provide ports of local and remote IKE endpoints
authorTobias Brunner <tobias@strongswan.org>
Tue, 19 Jan 2016 12:34:11 +0000 (13:34 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 3 Mar 2016 16:13:35 +0000 (17:13 +0100)
src/libcharon/plugins/vici/README.md
src/libcharon/plugins/vici/vici_query.c

index b40fda9..773ef1a 100644 (file)
@@ -609,8 +609,10 @@ command.
                        version = <IKE version, 1 or 2>
                        state = <IKE_SA state name>
                        local-host = <local IKE endpoint address>
+                       local-port = <local IKE endpoint port>
                        local-id = <local IKE identity>
                        remote-host = <remote IKE endpoint address>
+                       remote-port = <remote IKE endpoint port>
                        remote-id = <remote IKE identity>
                        remote-xauth-id = <remote XAuth identity, if XAuth-authenticated>
                        remote-eap-id = <remote EAP identity, if EAP-authenticated>
index 512c2ba..cf909a9 100644 (file)
@@ -273,15 +273,20 @@ static void list_ike(private_vici_query_t *this, vici_builder_t *b,
        identification_t *eap;
        proposal_t *proposal;
        u_int16_t alg, ks;
+       host_t *host;
 
        b->add_kv(b, "uniqueid", "%u", ike_sa->get_unique_id(ike_sa));
        b->add_kv(b, "version", "%u", ike_sa->get_version(ike_sa));
        b->add_kv(b, "state", "%N", ike_sa_state_names, ike_sa->get_state(ike_sa));
 
-       b->add_kv(b, "local-host", "%H", ike_sa->get_my_host(ike_sa));
+       host = ike_sa->get_my_host(ike_sa);
+       b->add_kv(b, "local-host", "%H", host);
+       b->add_kv(b, "local-port", "%d", host->get_port(host));
        b->add_kv(b, "local-id", "%Y", ike_sa->get_my_id(ike_sa));
 
-       b->add_kv(b, "remote-host", "%H", ike_sa->get_other_host(ike_sa));
+       host = ike_sa->get_other_host(ike_sa);
+       b->add_kv(b, "remote-host", "%H", host);
+       b->add_kv(b, "remote-port", "%d", host->get_port(host));
        b->add_kv(b, "remote-id", "%Y", ike_sa->get_other_id(ike_sa));
 
        eap = ike_sa->get_other_eap_id(ike_sa);