diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-10-29 09:12:52 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-11-01 11:28:10 +0100 |
commit | 3b145a33b748935b17a83c85e451406698e6cec3 (patch) | |
tree | 498aee37e43b3aef44fb3aaa7a83a267f38fa7a9 | |
parent | 698f54456f52e7854a512e5355c54168662d2ccb (diff) | |
download | NetworkManager-lr/tunnelled-route.tar.gz |
vpn-connections: allow the plugin to specify route preferred srclr/tunnelled-route
Tunnelled VPNs can need that so that correct source address is used for tunnel
routes.
-rw-r--r-- | src/vpn-manager/nm-vpn-connection.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index cdda03452c..22d54dc9cf 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1451,10 +1451,13 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict) if (g_variant_lookup (dict, NM_VPN_PLUGIN_IP4_CONFIG_ROUTES, "aau", &iter)) { while (g_variant_iter_next (iter, "@au", &v)) { - NMPlatformIP4Route route; + NMPlatformIP4Route route = { 0, }; - if (g_variant_n_children (v) == 4) { - memset (&route, 0, sizeof (route)); + switch (g_variant_n_children (v)) { + case 5: + g_variant_get_child (v, 4, "u", &route.pref_src); + /* fallthrough */ + case 4: g_variant_get_child (v, 0, "u", &route.network); g_variant_get_child (v, 1, "u", &route.plen); g_variant_get_child (v, 2, "u", &route.gateway); @@ -1469,6 +1472,8 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict) */ if (!(priv->ip4_external_gw && route.network == priv->ip4_external_gw && route.plen == 32)) nm_ip4_config_add_route (config, &route); + default: + _LOGW ("VPN connection: received invalid IPv4 route"); } g_variant_unref (v); } |