aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-02-22 18:49:55 +0100
committerTobias Brunner <tobias@strongswan.org>2013-03-19 16:25:26 +0100
commit9cf09ecad7411089d6b24c830b30dadd808d3c88 (patch)
treeebf5373df5eca06dd208a60f60093fcae67ccad0 /src
parentc15eea7306d049a357a7517040614997b5385818 (diff)
downloadstrongswan-9cf09ecad7411089d6b24c830b30dadd808d3c88.tar.bz2
strongswan-9cf09ecad7411089d6b24c830b30dadd808d3c88.tar.xz
charon-nm: Use VIP (if any) as local address
NM will install this address on the provided device.
Diffstat (limited to 'src')
-rw-r--r--src/charon-nm/nm/nm_service.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/charon-nm/nm/nm_service.c b/src/charon-nm/nm/nm_service.c
index e0d17be59..aa5fdc04a 100644
--- a/src/charon-nm/nm/nm_service.c
+++ b/src/charon-nm/nm/nm_service.c
@@ -87,11 +87,11 @@ static void signal_ipv4_config(NMVPNPlugin *plugin,
NMStrongswanPluginPrivate *priv = NM_STRONGSWAN_PLUGIN_GET_PRIVATE(plugin);
GValue *val;
GHashTable *config;
+ enumerator_t *enumerator;
host_t *me;
nm_handler_t *handler;
config = g_hash_table_new(g_str_hash, g_str_equal);
- me = ike_sa->get_my_host(ike_sa);
handler = priv->handler;
/* NM requires a tundev, but netkey does not use one. Passing the physical
@@ -102,6 +102,15 @@ static void signal_ipv4_config(NMVPNPlugin *plugin,
g_value_set_string (val, priv->tun->get_name(priv->tun));
g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV, val);
+ /* NM installs this IP address on the interface above, so we use the VIP if
+ * we got one.
+ */
+ enumerator = ike_sa->create_virtual_ip_enumerator(ike_sa, TRUE);
+ if (!enumerator->enumerate(enumerator, &me))
+ {
+ me = ike_sa->get_my_host(ike_sa);
+ }
+ enumerator->destroy(enumerator);
val = g_slice_new0(GValue);
g_value_init(val, G_TYPE_UINT);
g_value_set_uint(val, *(u_int32_t*)me->get_address(me).ptr);