mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 01:47:58 +02:00
merge: branch 'lr/tunnelled-route'
https://bugzilla.gnome.org/show_bug.cgi?id=757287
This commit is contained in:
commit
6a5595fc1a
5 changed files with 22 additions and 10 deletions
|
|
@ -1189,7 +1189,7 @@ ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_addr network, in
|
|||
static gboolean
|
||||
ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
|
||||
in_addr_t network, int plen, in_addr_t gateway,
|
||||
guint32 pref_src, guint32 metric, guint32 mss)
|
||||
in_addr_t pref_src, guint32 metric, guint32 mss)
|
||||
{
|
||||
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
|
||||
NMPlatformIP4Route route;
|
||||
|
|
|
|||
|
|
@ -4474,7 +4474,7 @@ _nmp_vt_cmd_plobj_to_nl_ip6_route (NMPlatform *platform, const NMPlatformObject
|
|||
static gboolean
|
||||
ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
|
||||
in_addr_t network, int plen, in_addr_t gateway,
|
||||
guint32 pref_src, guint32 metric, guint32 mss)
|
||||
in_addr_t pref_src, guint32 metric, guint32 mss)
|
||||
{
|
||||
NMPObject obj_needle;
|
||||
auto_nl_object struct nl_object *nlo = NULL;
|
||||
|
|
|
|||
|
|
@ -2216,7 +2216,7 @@ gboolean
|
|||
nm_platform_ip4_route_add (NMPlatform *self,
|
||||
int ifindex, NMIPConfigSource source,
|
||||
in_addr_t network, int plen,
|
||||
in_addr_t gateway, guint32 pref_src,
|
||||
in_addr_t gateway, in_addr_t pref_src,
|
||||
guint32 metric, guint32 mss)
|
||||
{
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ struct _NMPlatformIP4Route {
|
|||
|
||||
/* RTA_PREFSRC/rtnl_route_get_pref_src(). A value of zero means that
|
||||
* no pref-src is set. */
|
||||
guint32 pref_src;
|
||||
in_addr_t pref_src;
|
||||
};
|
||||
|
||||
struct _NMPlatformIP6Route {
|
||||
|
|
@ -534,7 +534,7 @@ typedef struct {
|
|||
GArray * (*ip6_route_get_all) (NMPlatform *, int ifindex, NMPlatformGetRouteFlags flags);
|
||||
gboolean (*ip4_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
|
||||
in_addr_t network, int plen, in_addr_t gateway,
|
||||
guint32 pref_src, guint32 metric, guint32 mss);
|
||||
in_addr_t pref_src, guint32 metric, guint32 mss);
|
||||
gboolean (*ip6_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
|
||||
struct in6_addr network, int plen, struct in6_addr gateway,
|
||||
guint32 metric, guint32 mss);
|
||||
|
|
@ -738,7 +738,7 @@ GArray *nm_platform_ip4_route_get_all (NMPlatform *self, int ifindex, NMPlatform
|
|||
GArray *nm_platform_ip6_route_get_all (NMPlatform *self, int ifindex, NMPlatformGetRouteFlags flags);
|
||||
gboolean nm_platform_ip4_route_add (NMPlatform *self, int ifindex, NMIPConfigSource source,
|
||||
in_addr_t network, int plen, in_addr_t gateway,
|
||||
guint32 pref_src, guint32 metric, guint32 mss);
|
||||
in_addr_t pref_src, guint32 metric, guint32 mss);
|
||||
gboolean nm_platform_ip6_route_add (NMPlatform *self, int ifindex, NMIPConfigSource source,
|
||||
struct in6_addr network, int plen, struct in6_addr gateway,
|
||||
guint32 metric, guint32 mss);
|
||||
|
|
|
|||
|
|
@ -1359,6 +1359,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
const char *str;
|
||||
GVariant *v;
|
||||
gboolean b;
|
||||
int ifindex;
|
||||
|
||||
g_return_if_fail (dict && g_variant_is_of_type (dict, G_VARIANT_TYPE_VARDICT));
|
||||
|
||||
|
|
@ -1386,7 +1387,13 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
priv->has_ip6 = FALSE;
|
||||
}
|
||||
|
||||
config = nm_ip4_config_new (priv->ip_ifindex);
|
||||
if (priv->ip_ifindex > 0) {
|
||||
ifindex = priv->ip_ifindex;
|
||||
} else {
|
||||
NMDevice *parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (self));
|
||||
ifindex = nm_device_get_ip_ifindex (parent_dev);
|
||||
}
|
||||
config = nm_ip4_config_new (ifindex);
|
||||
|
||||
memset (&address, 0, sizeof (address));
|
||||
address.plen = 24;
|
||||
|
|
@ -1444,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);
|
||||
|
|
@ -1462,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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue