summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-10-20 11:46:52 +0200
committerThomas Haller <thaller@redhat.com>2014-10-20 14:33:47 +0200
commit60aee59f18a57b7ad5dbd32adb7f9fb11d67617b (patch)
treef4b76711c6257df4ccc3f25281947ccba6d47016
parentd60f593b3eb04aaaa4f295bad182aa3e08dd6e78 (diff)
parent7d5779300450bc2602ba4f7f472ebfa58bea3571 (diff)
rdisc: merge branch 'lkundrak/lr-rdisc-mtu' (bgo#738104)
https://bugzilla.gnome.org/show_bug.cgi?id=738104 Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--include/nm-test-utils.h4
-rw-r--r--src/devices/nm-device-ethernet.c2
-rw-r--r--src/devices/nm-device-infiniband.c2
-rw-r--r--src/devices/nm-device-vlan.c2
-rw-r--r--src/devices/nm-device.c17
-rw-r--r--src/devices/wifi/nm-device-wifi.c2
-rw-r--r--src/devices/wwan/nm-modem-broadband.c2
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient-utils.c2
-rw-r--r--src/dhcp-manager/nm-dhcp-utils.c14
-rw-r--r--src/nm-ip4-config.c35
-rw-r--r--src/nm-ip4-config.h3
-rw-r--r--src/nm-ip6-config.c11
-rw-r--r--src/nm-policy.c24
-rw-r--r--src/nm-types.h14
-rw-r--r--src/platform/nm-fake-platform.c12
-rw-r--r--src/platform/nm-linux-platform.c38
-rw-r--r--src/platform/nm-platform.c28
-rw-r--r--src/platform/nm-platform.h27
-rw-r--r--src/platform/tests/platform.c4
-rw-r--r--src/platform/tests/test-cleanup.c12
-rw-r--r--src/platform/tests/test-route.c32
-rw-r--r--src/ppp-manager/nm-ppp-manager.c4
-rw-r--r--src/rdisc/nm-lndp-rdisc.c15
-rw-r--r--src/rdisc/nm-rdisc.h2
-rw-r--r--src/tests/test-ip4-config.c46
-rw-r--r--src/tests/test-ip6-config.c84
-rw-r--r--src/vpn-manager/nm-vpn-connection.c18
27 files changed, 246 insertions, 210 deletions
diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h
index 12e84b3393..4a38d145b0 100644
--- a/include/nm-test-utils.h
+++ b/include/nm-test-utils.h
@@ -585,7 +585,7 @@ nmtst_platform_ip6_address (const char *address, const char *peer_address, guint
inline static NMPlatformIP6Address *
nmtst_platform_ip6_address_full (const char *address, const char *peer_address, guint plen,
- int ifindex, NMPlatformSource source, guint32 timestamp,
+ int ifindex, NMIPConfigSource source, guint32 timestamp,
guint32 lifetime, guint32 preferred, guint flags)
{
NMPlatformIP6Address *addr = nmtst_platform_ip6_address (address, peer_address, plen);
@@ -615,7 +615,7 @@ nmtst_platform_ip6_route (const char *network, guint plen, const char *gateway)
inline static NMPlatformIP6Route *
nmtst_platform_ip6_route_full (const char *network, guint plen, const char *gateway,
- int ifindex, NMPlatformSource source,
+ int ifindex, NMIPConfigSource source,
guint metric, guint mss)
{
NMPlatformIP6Route *route = nmtst_platform_ip6_route (network, plen, gateway);
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index d057f1bea8..a0713a7922 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -1354,7 +1354,7 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
/* MTU override */
mtu = nm_setting_wired_get_mtu (s_wired);
if (mtu)
- nm_ip4_config_set_mtu (config, mtu);
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
}
static void
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c
index 8101c3e12c..acf74490f2 100644
--- a/src/devices/nm-device-infiniband.c
+++ b/src/devices/nm-device-infiniband.c
@@ -142,7 +142,7 @@ ip4_config_pre_commit (NMDevice *self, NMIP4Config *config)
/* MTU override */
mtu = nm_setting_infiniband_get_mtu (s_infiniband);
if (mtu)
- nm_ip4_config_set_mtu (config, mtu);
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
}
static gboolean
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
index 71013a99c8..8ca39be64b 100644
--- a/src/devices/nm-device-vlan.c
+++ b/src/devices/nm-device-vlan.c
@@ -390,7 +390,7 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
if (s_wired) {
mtu = nm_setting_wired_get_mtu (s_wired);
if (mtu)
- nm_ip4_config_set_mtu (config, mtu);
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
}
}
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 646c9e1a4d..1c01c8dc26 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -2359,14 +2359,14 @@ aipd_get_ip4_config (NMDevice *self, guint32 lla)
memset (&address, 0, sizeof (address));
address.address = lla;
address.plen = 16;
- address.source = NM_PLATFORM_SOURCE_IP4LL;
+ address.source = NM_IP_CONFIG_SOURCE_IP4LL;
nm_ip4_config_add_address (config, &address);
/* Add a multicast route for link-local connections: destination= 224.0.0.0, netmask=240.0.0.0 */
memset (&route, 0, sizeof (route));
route.network = htonl (0xE0000000L);
route.plen = 4;
- route.source = NM_PLATFORM_SOURCE_IP4LL;
+ route.source = NM_IP_CONFIG_SOURCE_IP4LL;
route.metric = nm_device_get_priority (self);
nm_ip4_config_add_route (config, &route);
@@ -2888,7 +2888,7 @@ shared4_new_config (NMDevice *self, NMConnection *connection, NMDeviceStateReaso
}
config = nm_ip4_config_new ();
- address.source = NM_PLATFORM_SOURCE_SHARED;
+ address.source = NM_IP_CONFIG_SOURCE_SHARED;
nm_ip4_config_add_address (config, &address);
/* Remove the address lock when the object gets disposed */
@@ -3575,7 +3575,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self)
address.preferred = discovered_address->preferred;
if (address.preferred > address.lifetime)
address.preferred = address.lifetime;
- address.source = NM_PLATFORM_SOURCE_RDISC;
+ address.source = NM_IP_CONFIG_SOURCE_RDISC;
address.flags = ifa_flags;
nm_ip6_config_add_address (priv->ac_ip6_config, &address);
@@ -3599,7 +3599,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self)
route.network = discovered_route->network;
route.plen = discovered_route->plen;
route.gateway = discovered_route->gateway;
- route.source = NM_PLATFORM_SOURCE_RDISC;
+ route.source = NM_IP_CONFIG_SOURCE_RDISC;
route.metric = nm_device_get_priority (self);
nm_ip6_config_add_route (priv->ac_ip6_config, &route);
@@ -3663,6 +3663,13 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self)
nm_device_ipv6_sysctl_set (self, "hop_limit", val);
}
+ if (changed & NM_RDISC_CONFIG_MTU) {
+ char val[16];
+
+ g_snprintf (val, sizeof (val), "%d", rdisc->mtu);
+ nm_device_ipv6_sysctl_set (self, "mtu", val);
+ }
+
nm_device_activate_schedule_ip6_config_result (self);
}
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 6d93833792..cf5a4f631c 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -2883,7 +2883,7 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
/* MTU override */
mtu = nm_setting_wireless_get_mtu (s_wifi);
if (mtu)
- nm_ip4_config_set_mtu (config, mtu);
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
}
static gboolean
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index 7cf75c28ec..ad2c8de4fa 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -691,7 +691,7 @@ static_stage3_ip4_done (NMModemBroadband *self)
memset (&address, 0, sizeof (address));
address.address = address_network;
address.plen = mm_bearer_ip_config_get_prefix (self->priv->ipv4_config);
- address.source = NM_PLATFORM_SOURCE_WWAN;
+ address.source = NM_IP_CONFIG_SOURCE_WWAN;
nm_ip4_config_add_address (config, &address);
nm_log_info (LOGD_MB, " address %s/%d", address_string, address.plen);
diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c
index 6c5be77cb8..d39da6b9f9 100644
--- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c
+++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c
@@ -623,7 +623,7 @@ nm_dhcp_dhclient_read_lease_ip_configs (const char *iface,
address.timestamp = now_monotonic_ts;
address.lifetime = address.preferred = expiry;
- address.source = NM_PLATFORM_SOURCE_DHCP;
+ address.source = NM_IP_CONFIG_SOURCE_DHCP;
ip4 = nm_ip4_config_new ();
nm_ip4_config_add_address (ip4, &address);
diff --git a/src/dhcp-manager/nm-dhcp-utils.c b/src/dhcp-manager/nm-dhcp-utils.c
index c017f6cfb3..46fa96ecd9 100644
--- a/src/dhcp-manager/nm-dhcp-utils.c
+++ b/src/dhcp-manager/nm-dhcp-utils.c
@@ -84,7 +84,7 @@ ip4_process_dhcpcd_rfc3442_routes (const char *str,
route.network = rt_addr;
route.plen = rt_cidr;
route.gateway = rt_route;
- route.source = NM_PLATFORM_SOURCE_DHCP;
+ route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = priority;
nm_ip4_config_add_route (ip4_config, &route);
}
@@ -191,7 +191,7 @@ ip4_process_dhclient_rfc3442_routes (const char *str,
char addr[INET_ADDRSTRLEN];
/* normal route */
- route.source = NM_PLATFORM_SOURCE_DHCP;
+ route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = priority;
nm_ip4_config_add_route (ip4_config, &route);
@@ -313,7 +313,7 @@ process_classful_routes (GHashTable *options, guint priority, NMIP4Config *ip4_c
route.plen = 32;
}
route.gateway = rt_route;
- route.source = NM_PLATFORM_SOURCE_DHCP;
+ route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = priority;
nm_ip4_config_add_route (ip4_config, &route);
@@ -462,7 +462,7 @@ nm_dhcp_utils_ip4_config_from_options (const char *iface,
route.plen = 32;
/* this will be a device route if gwaddr is 0 */
route.gateway = gwaddr;
- route.source = NM_PLATFORM_SOURCE_DHCP;
+ route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = priority;
nm_ip4_config_add_route (ip4_config, &route);
nm_log_dbg (LOGD_IP, "adding route for server identifier: %s",
@@ -479,7 +479,7 @@ nm_dhcp_utils_ip4_config_from_options (const char *iface,
nm_log_info (LOGD_DHCP4, " lease time %d", address.lifetime);
}
- address.source = NM_PLATFORM_SOURCE_DHCP;
+ address.source = NM_IP_CONFIG_SOURCE_DHCP;
nm_ip4_config_add_address (ip4_config, &address);
str = g_hash_table_lookup (options, "host_name");
@@ -542,7 +542,7 @@ nm_dhcp_utils_ip4_config_from_options (const char *iface,
goto error;
if (int_mtu > 576)
- nm_ip4_config_set_mtu (ip4_config, int_mtu);
+ nm_ip4_config_set_mtu (ip4_config, int_mtu, NM_IP_CONFIG_SOURCE_DHCP);
}
str = g_hash_table_lookup (options, "nis_domain");
@@ -629,7 +629,7 @@ nm_dhcp_utils_ip6_config_from_options (const char *iface,
}
address.address = tmp_addr;
- address.source = NM_PLATFORM_SOURCE_DHCP;
+ address.source = NM_IP_CONFIG_SOURCE_DHCP;
nm_ip6_config_add_address (ip6_config, &address);
nm_log_info (LOGD_DHCP6, " address %s", str);
} else if (info_only == FALSE) {
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index aab50aeb8d..490c0f18cb 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -23,7 +23,6 @@
#include "nm-ip4-config.h"
-#include "nm-platform.h"
#include "nm-utils.h"
#include "nm-dbus-manager.h"
#include "nm-dbus-glib-types.h"
@@ -50,6 +49,7 @@ typedef struct {
char *nis_domain;
GArray *wins;
guint32 mtu;
+ NMIPConfigSource mtu_source;
} NMIP4ConfigPrivate;
/* internal guint32 are assigned to gobject properties of type uint. Ensure, that uint is large enough */
@@ -336,7 +336,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
address.plen = nm_ip4_address_get_prefix (s_addr);
address.lifetime = NM_PLATFORM_LIFETIME_PERMANENT;
address.preferred = NM_PLATFORM_LIFETIME_PERMANENT;
- address.source = NM_PLATFORM_SOURCE_USER;
+ address.source = NM_IP_CONFIG_SOURCE_USER;
g_strlcpy (address.label, label, sizeof (address.label));
nm_ip4_config_add_address (config, &address);
@@ -356,7 +356,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
route.metric = nm_ip4_route_get_metric (s_route);
if (!route.metric)
route.metric = default_route_metric;
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_route (config, &route);
}
@@ -447,7 +447,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
continue;
/* Ignore routes provided by external sources */
- if (route->source != NM_PLATFORM_SOURCE_USER)
+ if (route->source != NM_IP_CONFIG_SOURCE_USER)
continue;
s_route = nm_ip4_route_new ();
@@ -517,7 +517,8 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src)
/* MTU */
if (!nm_ip4_config_get_mtu (dst))
- nm_ip4_config_set_mtu (dst, nm_ip4_config_get_mtu (src));
+ nm_ip4_config_set_mtu (dst, nm_ip4_config_get_mtu (src),
+ nm_ip4_config_get_mtu_source (src));
/* NIS */
for (i = 0; i < nm_ip4_config_get_num_nis_servers (src); i++)
@@ -631,7 +632,7 @@ nm_ip4_config_subtract (NMIP4Config *dst, const NMIP4Config *src)
/* MTU */
if (nm_ip4_config_get_mtu (src) == nm_ip4_config_get_mtu (dst))
- nm_ip4_config_set_mtu (dst, 0);
+ nm_ip4_config_set_mtu (dst, 0, NM_IP_CONFIG_SOURCE_UNKNOWN);
/* NIS */
for (i = 0; i < nm_ip4_config_get_num_nis_servers (src); i++) {
@@ -871,7 +872,7 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev
/* mtu */
if (src_priv->mtu != dst_priv->mtu) {
- nm_ip4_config_set_mtu (dst, src_priv->mtu);
+ nm_ip4_config_set_mtu (dst, src_priv->mtu, src_priv->mtu_source);
has_minor_changes = TRUE;
}
@@ -1052,7 +1053,7 @@ nm_ip4_config_add_address (NMIP4Config *config, const NMPlatformIP4Address *new)
* with "what should be" and the kernel values are "what turned out after configuring it".
*
* For other sources, the longer lifetime wins. */
- if ( (new->source == NM_PLATFORM_SOURCE_KERNEL && new->source != item_old.source)
+ if ( (new->source == NM_IP_CONFIG_SOURCE_KERNEL && new->source != item_old.source)
|| nm_platform_ip_address_cmp_expiry ((const NMPlatformIPAddress *) &item_old, (const NMPlatformIPAddress *) new) > 0) {
item->timestamp = item_old.timestamp;
item->lifetime = item_old.lifetime;
@@ -1139,7 +1140,7 @@ void
nm_ip4_config_add_route (NMIP4Config *config, const NMPlatformIP4Route *new)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
- NMPlatformSource old_source;
+ NMIPConfigSource old_source;
int i;
g_return_if_fail (new != NULL);
@@ -1503,11 +1504,15 @@ nm_ip4_config_get_wins (const NMIP4Config *config, guint i)
/******************************************************************/
void
-nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu)
+nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu, NMIPConfigSource source)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
- priv->mtu = mtu;
+ if (source > priv->mtu_source) {
+ priv->mtu = mtu;
+ priv->mtu_source = source;
+ } else if (source == priv->mtu_source && (!priv->mtu || priv->mtu > mtu))
+ priv->mtu = mtu;
}
guint32
@@ -1518,6 +1523,14 @@ nm_ip4_config_get_mtu (const NMIP4Config *config)
return priv->mtu;
}
+NMIPConfigSource
+nm_ip4_config_get_mtu_source (const NMIP4Config *config)
+{
+ NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
+
+ return priv->mtu_source;
+}
+
/******************************************************************/
static inline void
diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h
index 6b88228bbe..5faaeb5f7b 100644
--- a/src/nm-ip4-config.h
+++ b/src/nm-ip4-config.h
@@ -134,8 +134,9 @@ guint32 nm_ip4_config_get_num_wins (const NMIP4Config *config);
guint32 nm_ip4_config_get_wins (const NMIP4Config *config, guint i);
/* MTU */
-void nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu);
+void nm_ip4_config_set_mtu (NMIP4Config *config, guint32 mtu, NMIPConfigSource source);
guint32 nm_ip4_config_get_mtu (const NMIP4Config *config);
+NMIPConfigSource nm_ip4_config_get_mtu_source (const NMIP4Config *config);
void nm_ip4_config_hash (const NMIP4Config *config, GChecksum *sum, gboolean dns_only);
gboolean nm_ip4_config_equal (const NMIP4Config *a, const NMIP4Config *b);
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 9d2b61f2c5..92064f9791 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -24,7 +24,6 @@
#include "nm-ip6-config.h"
#include "nm-glib-compat.h"
-#include "nm-platform.h"
#include "nm-utils.h"
#include "nm-dbus-manager.h"
#include "nm-dbus-glib-types.h"
@@ -440,7 +439,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
address.plen = nm_ip6_address_get_prefix (s_addr);
address.lifetime = NM_PLATFORM_LIFETIME_PERMANENT;
address.preferred = NM_PLATFORM_LIFETIME_PERMANENT;
- address.source = NM_PLATFORM_SOURCE_USER;
+ address.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_address (config, &address);
}
@@ -459,7 +458,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
route.metric = nm_ip6_route_get_metric (s_route);
if (!route.metric)
route.metric = default_route_metric;
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_route (config, &route);
}
@@ -558,7 +557,7 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
continue;
/* Ignore routes provided by external sources */
- if (route->source != NM_PLATFORM_SOURCE_USER)
+ if (route->source != NM_IP_CONFIG_SOURCE_USER)
continue;
s_route = nm_ip6_route_new ();
@@ -1058,7 +1057,7 @@ nm_ip6_config_add_address (NMIP6Config *config, const NMPlatformIP6Address *new)
* with "what should be" and the kernel values are "what turned out after configuring it".
*
* For other sources, the longer lifetime wins. */
- if ( (new->source == NM_PLATFORM_SOURCE_KERNEL && new->source != item_old.source)
+ if ( (new->source == NM_IP_CONFIG_SOURCE_KERNEL && new->source != item_old.source)
|| nm_platform_ip_address_cmp_expiry ((const NMPlatformIPAddress *) &item_old, (const NMPlatformIPAddress *) new) > 0) {
item->timestamp = item_old.timestamp;
item->lifetime = item_old.lifetime;
@@ -1146,7 +1145,7 @@ void
nm_ip6_config_add_route (NMIP6Config *config, const NMPlatformIP6Route *new)
{
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
- NMPlatformSource old_source;
+ NMIPConfigSource old_source;
int i;
g_return_if_fail (new != NULL);
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 120afd65c6..ff100d069d 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -670,13 +670,13 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
if (ip_ifindex <= 0)
ip_ifindex = parent_ifindex;
- if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN,
+ if (!nm_platform_ip4_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_VPN,
0, 0, int_gw,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) {
- (void) nm_platform_ip4_route_add (parent_ifindex, NM_PLATFORM_SOURCE_VPN,
+ (void) nm_platform_ip4_route_add (parent_ifindex, NM_IP_CONFIG_SOURCE_VPN,
gw_addr, 32, 0,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, parent_mss);
- if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN,
+ if (!nm_platform_ip4_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_VPN,
0, 0, int_gw,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss))
nm_log_err (LOGD_IP4 | LOGD_VPN, "Failed to set default route.");
@@ -687,13 +687,13 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
int mss = nm_ip4_config_get_mss (ip4_config);
g_assert (ip_iface);
- if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER,
+ if (!nm_platform_ip4_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_USER,
0, 0, gw_addr,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) {
- (void) nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER,
+ (void) nm_platform_ip4_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_USER,
gw_addr, 32, 0,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss);
- if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER,
+ if (!nm_platform_ip4_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_USER,
0, 0, gw_addr,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) {
nm_log_err (LOGD_IP4, "Failed to set default route.");
@@ -876,13 +876,13 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
if (ip_ifindex <= 0)
ip_ifindex = parent_ifindex;
- if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN,
+ if (!nm_platform_ip6_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_VPN,
in6addr_any, 0, *int_gw,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) {
- (void) nm_platform_ip6_route_add (parent_ifindex, NM_PLATFORM_SOURCE_VPN,
+ (void) nm_platform_ip6_route_add (parent_ifindex, NM_IP_CONFIG_SOURCE_VPN,
*gw_addr, 128, in6addr_any,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, parent_mss);
- if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN,
+ if (!nm_platform_ip6_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_VPN,
in6addr_any, 0, *int_gw,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) {
nm_log_err (LOGD_IP6 | LOGD_VPN, "Failed to set default route.");
@@ -893,13 +893,13 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
} else {
int mss = nm_ip6_config_get_mss (ip6_config);
- if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER,
+ if (!nm_platform_ip6_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_USER,
in6addr_any, 0, *gw_addr,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) {
- (void) nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER,
+ (void) nm_platform_ip6_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_USER,
*gw_addr, 128, in6addr_any,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss);
- if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER,
+ if (!nm_platform_ip6_route_add (ip_ifindex, NM_IP_CONFIG_SOURCE_USER,
in6addr_any, 0, *gw_addr,
NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss))
nm_log_err (LOGD_IP6, "Failed to set default route.");
diff --git a/src/nm-types.h b/src/nm-types.h
index 2acc25c0bd..e67ae20527 100644
--- a/src/nm-types.h
+++ b/src/nm-types.h
@@ -39,6 +39,20 @@ typedef struct _NMRfkillManager NMRfkillManager;
typedef struct _NMSessionMonitor NMSessionMonitor;
typedef struct _NMSleepMonitor NMSleepMonitor;
+typedef enum {
+ /* In priority order; higher number == higher priority */
+ NM_IP_CONFIG_SOURCE_UNKNOWN,
+ NM_IP_CONFIG_SOURCE_KERNEL,
+ NM_IP_CONFIG_SOURCE_SHARED,
+ NM_IP_CONFIG_SOURCE_IP4LL,
+ NM_IP_CONFIG_SOURCE_PPP,
+ NM_IP_CONFIG_SOURCE_WWAN,
+ NM_IP_CONFIG_SOURCE_VPN,
+ NM_IP_CONFIG_SOURCE_DHCP,
+ NM_IP_CONFIG_SOURCE_RDISC,
+ NM_IP_CONFIG_SOURCE_USER,
+} NMIPConfigSource;
+
/* platform */
typedef struct _NMPlatformIP4Address NMPlatformIP4Address;
typedef struct _NMPlatformIP4Route NMPlatformIP4Route;
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 4e5d424e33..9e376e5035 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -827,7 +827,7 @@ ip4_address_add (NMPlatform *platform, int ifindex,
int i;
memset (&address, 0, sizeof (address));
- address.source = NM_PLATFORM_SOURCE_KERNEL;
+ address.source = NM_IP_CONFIG_SOURCE_KERNEL;
address.ifindex = ifindex;
address.address = addr;
address.peer_address = peer_addr;
@@ -869,7 +869,7 @@ ip6_address_add (NMPlatform *platform, int ifindex,
int i;
memset (&address, 0, sizeof (address));
- address.source = NM_PLATFORM_SOURCE_KERNEL;
+ address.source = NM_IP_CONFIG_SOURCE_KERNEL;
address.ifindex = ifindex;
address.address = addr;
address.peer_address = peer_addr;
@@ -1040,7 +1040,7 @@ ip6_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
}
static gboolean
-ip4_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
+ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
int metric, int mss)
{
@@ -1049,7 +1049,7 @@ ip4_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
guint i;
memset (&route, 0, sizeof (route));
- route.source = NM_PLATFORM_SOURCE_KERNEL;
+ route.source = NM_IP_CONFIG_SOURCE_KERNEL;
route.ifindex = ifindex;
route.source = source;
route.network = network;
@@ -1080,7 +1080,7 @@ ip4_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
}
static gboolean
-ip6_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
+ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
int metric, int mss)
{
@@ -1089,7 +1089,7 @@ ip6_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
guint i;
memset (&route, 0, sizeof (route));
- route.source = NM_PLATFORM_SOURCE_KERNEL;
+ route.source = NM_IP_CONFIG_SOURCE_KERNEL;
route.ifindex = ifindex;
route.source = source;
route.network = network;
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 26fa5fe135..603701685d 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1206,7 +1206,7 @@ init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr)
memset (address, 0, sizeof (*address));
- address->source = NM_PLATFORM_SOURCE_KERNEL;
+ address->source = NM_IP_CONFIG_SOURCE_KERNEL;
address->ifindex = rtnl_addr_get_ifindex (rtnladdr);
address->plen = rtnl_addr_get_prefixlen (rtnladdr);
_init_ip_address_lifetime ((NMPlatformIPAddress *) address, rtnladdr);
@@ -1238,7 +1238,7 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr)
memset (address, 0, sizeof (*address));
- address->source = NM_PLATFORM_SOURCE_KERNEL;
+ address->source = NM_IP_CONFIG_SOURCE_KERNEL;
address->ifindex = rtnl_addr_get_ifindex (rtnladdr);
address->plen = rtnl_addr_get_prefixlen (rtnladdr);
_init_ip_address_lifetime ((NMPlatformIPAddress *) address, rtnladdr);
@@ -1260,16 +1260,16 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr)
}
static guint
-source_to_rtprot (NMPlatformSource source)
+source_to_rtprot (NMIPConfigSource source)
{
switch (source) {
- case NM_PLATFORM_SOURCE_UNKNOWN:
+ case NM_IP_CONFIG_SOURCE_UNKNOWN:
return RTPROT_UNSPEC;
- case NM_PLATFORM_SOURCE_KERNEL:
+ case NM_IP_CONFIG_SOURCE_KERNEL:
return RTPROT_KERNEL;
- case NM_PLATFORM_SOURCE_DHCP:
+ case NM_IP_CONFIG_SOURCE_DHCP:
return RTPROT_DHCP;
- case NM_PLATFORM_SOURCE_RDISC:
+ case NM_IP_CONFIG_SOURCE_RDISC:
return RTPROT_RA;
default:
@@ -1277,22 +1277,22 @@ source_to_rtprot (NMPlatformSource source)
}
}
-static NMPlatformSource
+static NMIPConfigSource
rtprot_to_source (guint rtprot)
{
switch (rtprot) {
case RTPROT_UNSPEC:
- return NM_PLATFORM_SOURCE_UNKNOWN;
+ return NM_IP_CONFIG_SOURCE_UNKNOWN;
case RTPROT_REDIRECT:
case RTPROT_KERNEL:
- return NM_PLATFORM_SOURCE_KERNEL;
+ return NM_IP_CONFIG_SOURCE_KERNEL;
case RTPROT_RA:
- return NM_PLATFORM_SOURCE_RDISC;
+ return NM_IP_CONFIG_SOURCE_RDISC;
case RTPROT_DHCP:
- return NM_PLATFORM_SOURCE_DHCP;
+ return NM_IP_CONFIG_SOURCE_DHCP;
default:
- return NM_PLATFORM_SOURCE_USER;
+ return NM_IP_CONFIG_SOURCE_USER;
}
}
@@ -3708,7 +3708,7 @@ clear_host_address (int family, const void *network, int plen, void *dst)
}
static struct nl_object *
-build_rtnl_route (int family, int ifindex, NMPlatformSource source,
+build_rtnl_route (int family, int ifindex, NMIPConfigSource source,
gconstpointer network, int plen, gconstpointer gateway,
int metric, int mss)
{
@@ -3749,7 +3749,7 @@ build_rtnl_route (int family, int ifindex, NMPlatformSource source,
}
static gboolean
-ip4_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
+ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
int metric, int mss)
{
@@ -3757,7 +3757,7 @@ ip4_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
}
static gboolean
-ip6_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source,
+ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
int metric, int mss)
{
@@ -3818,7 +3818,7 @@ ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t network, int plen
{
in_addr_t gateway = 0;
struct rtnl_route *cached_object;
- struct nl_object *route = build_rtnl_route (AF_INET, ifindex, NM_PLATFORM_SOURCE_UNKNOWN, &network, plen, &gateway, metric, 0);
+ struct nl_object *route = build_rtnl_route (AF_INET, ifindex, NM_IP_CONFIG_SOURCE_UNKNOWN, &network, plen, &gateway, metric, 0);
uint8_t scope = RT_SCOPE_NOWHERE;
struct nl_cache *cache;
@@ -3878,7 +3878,7 @@ ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_addr network, in
{
struct in6_addr gateway = IN6ADDR_ANY_INIT;
- return delete_object (platform, build_rtnl_route (AF_INET6, ifindex, NM_PLATFORM_SOURCE_UNKNOWN ,&network, plen, &gateway, metric, 0), FALSE) &&
+ return delete_object (platform, build_rtnl_route (AF_INET6, ifindex, NM_IP_CONFIG_SOURCE_UNKNOWN ,&network, plen, &gateway, metric, 0), FALSE) &&
refresh_route (platform, AF_INET6, ifindex, &network, plen, metric);
}
@@ -3886,7 +3886,7 @@ static gboolean
ip_route_exists (NMPlatform *platform, int family, int ifindex, gpointer network, int plen, int metric)
{
auto_nl_object struct nl_object *object = build_rtnl_route (family, ifindex,
- NM_PLATFORM_SOURCE_UNKNOWN,
+ NM_IP_CONFIG_SOURCE_UNKNOWN,
network, plen, NULL, metric, 0);
struct nl_cache *cache = choose_cache (platform, object);
auto_nl_object struct nl_object *cached_object = nl_cache_search (cache, object);
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index fb2058faa7..75e6448d2b 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1858,7 +1858,7 @@ nm_platform_ip6_route_get_all (int ifindex, gboolean include_default)
}
gboolean
-nm_platform_ip4_route_add (int ifindex, NMPlatformSource source,
+nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
in_addr_t network, int plen,
in_addr_t gateway, int metric, int mss)
{
@@ -1887,7 +1887,7 @@ nm_platform_ip4_route_add (int ifindex, NMPlatformSource source,
}
gboolean
-nm_platform_ip6_route_add (int ifindex, NMPlatformSource source,
+nm_platform_ip6_route_add (int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
int metric, int mss)
{
@@ -2059,7 +2059,7 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
known_route->gateway,
known_route->metric,
known_route->mss);
- if (!success && known_route->source < NM_PLATFORM_SOURCE_USER) {
+ if (!success && known_route->source < NM_IP_CONFIG_SOURCE_USER) {
nm_log_dbg (LOGD_PLATFORM, "ignore error adding IPv4 route to kernel: %s",
nm_platform_ip4_route_to_string (known_route));
success = TRUE;
@@ -2127,7 +2127,7 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes)
known_route->gateway,
known_route->metric,
known_route->mss);
- if (!success && known_route->source < NM_PLATFORM_SOURCE_USER) {
+ if (!success && known_route->source < NM_IP_CONFIG_SOURCE_USER) {
nm_log_dbg (LOGD_PLATFORM, "ignore error adding IPv6 route to kernel: %s",
nm_platform_ip6_route_to_string (known_route));
success = TRUE;
@@ -2150,26 +2150,26 @@ nm_platform_route_flush (int ifindex)
/******************************************************************/
static const char *
-source_to_string (NMPlatformSource source)
+source_to_string (NMIPConfigSource source)
{
switch (source) {
- case NM_PLATFORM_SOURCE_KERNEL:
+ case NM_IP_CONFIG_SOURCE_KERNEL:
return "kernel";
- case NM_PLATFORM_SOURCE_SHARED:
+ case NM_IP_CONFIG_SOURCE_SHARED:
return "shared";
- case NM_PLATFORM_SOURCE_IP4LL:
+ case NM_IP_CONFIG_SOURCE_IP4LL:
return "ipv4ll";
- case NM_PLATFORM_SOURCE_PPP:
+ case NM_IP_CONFIG_SOURCE_PPP:
return "ppp";
- case NM_PLATFORM_SOURCE_WWAN:
+ case NM_IP_CONFIG_SOURCE_WWAN:
return "wwan";
- case NM_PLATFORM_SOURCE_VPN:
+ case NM_IP_CONFIG_SOURCE_VPN:
return "vpn";
- case NM_PLATFORM_SOURCE_DHCP:
+ case NM_IP_CONFIG_SOURCE_DHCP:
return "dhcp";
- case NM_PLATFORM_SOURCE_RDISC:
+ case NM_IP_CONFIG_SOURCE_RDISC:
return "rdisc";
- case NM_PLATFORM_SOURCE_USER:
+ case NM_IP_CONFIG_SOURCE_USER:
return "user";
default:
break;
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 4cddd9c2b7..cd2729cddf 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -143,21 +143,6 @@ typedef enum {
#define NM_PLATFORM_LIFETIME_PERMANENT G_MAXUINT32
-typedef enum {
- /* In priority order; higher number == higher priority */
- NM_PLATFORM_SOURCE_UNKNOWN,
- NM_PLATFORM_SOURCE_KERNEL,
- NM_PLATFORM_SOURCE_SHARED,
- NM_PLATFORM_SOURCE_IP4LL,
- NM_PLATFORM_SOURCE_PPP,
- NM_PLATFORM_SOURCE_WWAN,
- NM_PLATFORM_SOURCE_VPN,
- NM_PLATFORM_SOURCE_DHCP,
- NM_PLATFORM_SOURCE_RDISC,
- NM_PLATFORM_SOURCE_USER,
-} NMPlatformSource;
-
-
typedef struct {
__NMPlatformObject_COMMON;
} NMPlatformObject;
@@ -165,7 +150,7 @@ typedef struct {
#define __NMPlatformIPAddress_COMMON \
__NMPlatformObject_COMMON; \
- NMPlatformSource source; \
+ NMIPConfigSource source; \
\
/* Timestamp in seconds in the reference system of nm_utils_get_monotonic_timestamp_*().
*
@@ -235,7 +220,7 @@ G_STATIC_ASSERT (G_STRUCT_OFFSET (NMPlatformIPAddress, address_ptr) == G_STRUCT_
#define __NMPlatformIPRoute_COMMON \
__NMPlatformObject_COMMON; \
- NMPlatformSource source; \
+ NMIPConfigSource source; \
int plen; \
guint metric; \
guint mss; \
@@ -454,10 +439,10 @@ typedef struct {
GArray * (*ip4_route_get_all) (NMPlatform *, int ifindex, gboolean include_default);
GArray * (*ip6_route_get_all) (NMPlatform *, int ifindex, gboolean include_default);
- gboolean (*ip4_route_add) (NMPlatform *, int ifindex, NMPlatformSource source,
+ gboolean (*ip4_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
int prio, int mss);
- gboolean (*ip6_route_add) (NMPlatform *, int ifindex, NMPlatformSource source,
+ gboolean (*ip6_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
int prio, int mss);
gboolean (*ip4_route_delete) (NMPlatform *, int ifindex, in_addr_t network, int plen, int metric);
@@ -602,10 +587,10 @@ gboolean nm_platform_address_flush (int ifindex);
GArray *nm_platform_ip4_route_get_all (int ifindex, gboolean include_default);
GArray *nm_platform_ip6_route_get_all (int ifindex, gboolean include_default);
gboolean nm_platform_route_set_metric (int ifindex, int metric);
-gboolean nm_platform_ip4_route_add (int ifindex, NMPlatformSource source,
+gboolean nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
int metric, int mss);
-gboolean nm_platform_ip6_route_add (int ifindex, NMPlatformSource source,
+gboolean nm_platform_ip6_route_add (int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
int metric, int mss);
gboolean nm_platform_ip4_route_delete (int ifindex, in_addr_t network, int plen, int metric);
diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c
index 3bc2acbf9d..469652c55f 100644
--- a/src/platform/tests/platform.c
+++ b/src/platform/tests/platform.c
@@ -680,7 +680,7 @@ do_ip4_route_add (char **argv)
metric = strtol (*argv++, NULL, 10);
mss = strtol (*argv++, NULL, 10);
- return nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER,
+ return nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER,
network, plen, gateway,
metric, mss);
}
@@ -696,7 +696,7 @@ do_ip6_route_add (char **argv)
parse_ip6_address (*argv++, &gateway, NULL);
metric = strtol (*argv++, NULL, 10);
mss = strtol (*argv++, NULL, 10);
- return nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER,
+ return nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER,
network, plen, gateway,
metric, mss);
}
diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c
index e60d82f0ed..6006ca1f1b 100644
--- a/src/platform/tests/test-cleanup.c
+++ b/src/platform/tests/test-cleanup.c
@@ -43,12 +43,12 @@ test_cleanup_internal ()
/* Add routes and addresses */
g_assert (nm_platform_ip4_address_add (ifindex, addr4, 0, plen4, lifetime, preferred, NULL));
g_assert (nm_platform_ip6_address_add (ifindex, addr6, in6addr_any, plen6, lifetime, preferred, flags));
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway4, 32, INADDR_ANY, metric, mss));
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network4, plen4, gateway4, metric, mss));
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gateway4, metric, mss));
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway6, 128, in6addr_any, metric, mss));
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network6, plen6, gateway6, metric, mss));
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, gateway6, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway4, 32, INADDR_ANY, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network4, plen4, gateway4, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway4, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway6, 128, in6addr_any, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network6, plen6, gateway6, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, in6addr_any, 0, gateway6, metric, mss));
addresses4 = nm_platform_ip4_address_get_all (ifindex);
addresses6 = nm_platform_ip6_address_get_all (ifindex);
diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c
index d45730ac57..4d6c5f09b0 100644
--- a/src/platform/tests/test-route.c
+++ b/src/platform/tests/test-route.c
@@ -66,56 +66,56 @@ test_ip4_route ()
inet_pton (AF_INET, "198.51.100.1", &gateway);
/* Add route to gateway */
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway, 32, INADDR_ANY, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway, 32, INADDR_ANY, metric, mss));
no_error ();
accept_signal (route_added);
/* Add route */
g_assert (!nm_platform_ip4_route_exists (ifindex, network, plen, metric));
no_error ();
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, metric, mss));
no_error ();
g_assert (nm_platform_ip4_route_exists (ifindex, network, plen, metric));
no_error ();
accept_signal (route_added);
/* Add route again */
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, metric, mss));
no_error ();
accept_signal (route_changed);
/* Add default route */
g_assert (!nm_platform_ip4_route_exists (ifindex, 0, 0, metric));
no_error ();
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, metric, mss));
no_error ();
g_assert (nm_platform_ip4_route_exists (ifindex, 0, 0, metric));
no_error ();
accept_signal (route_added);
/* Add default route again */
- g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, metric, mss));
no_error ();
accept_signal (route_changed);
/* Test route listing */
routes = nm_platform_ip4_route_get_all (ifindex, TRUE);
memset (rts, 0, sizeof (rts));
- rts[0].source = NM_PLATFORM_SOURCE_USER;
+ rts[0].source = NM_IP_CONFIG_SOURCE_USER;
rts[0].network = gateway;
rts[0].plen = 32;
rts[0].ifindex = ifindex;
rts[0].gateway = INADDR_ANY;
rts[0].metric = metric;
rts[0].mss = mss;
- rts[1].source = NM_PLATFORM_SOURCE_USER;
+ rts[1].source = NM_IP_CONFIG_SOURCE_USER;
rts[1].network = network;
rts[1].plen = plen;
rts[1].ifindex = ifindex;
rts[1].gateway = gateway;
rts[1].metric = metric;
rts[1].mss = mss;
- rts[2].source = NM_PLATFORM_SOURCE_USER;
+ rts[2].source = NM_IP_CONFIG_SOURCE_USER;
rts[2].network = 0;
rts[2].plen = 0;
rts[2].ifindex = ifindex;
@@ -161,56 +161,56 @@ test_ip6_route ()
inet_pton (AF_INET6, "2001:db8:c:d:1:2:3:4", &gateway);
/* Add route to gateway */
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway, 128, in6addr_any, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway, 128, in6addr_any, metric, mss));
no_error ();
accept_signal (route_added);
/* Add route */
g_assert (!nm_platform_ip6_route_exists (ifindex, network, plen, metric));
no_error ();
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, metric, mss));
no_error ();
g_assert (nm_platform_ip6_route_exists (ifindex, network, plen, metric));
no_error ();
accept_signal (route_added);
/* Add route again */
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, metric, mss));
no_error ();
accept_signal (route_changed);
/* Add default route */
g_assert (!nm_platform_ip6_route_exists (ifindex, in6addr_any, 0, metric));
no_error ();
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, gateway, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, in6addr_any, 0, gateway, metric, mss));
no_error ();
g_assert (nm_platform_ip6_route_exists (ifindex, in6addr_any, 0, metric));
no_error ();
accept_signal (route_added);
/* Add default route again */
- g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, gateway, metric, mss));
+ g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, in6addr_any, 0, gateway, metric, mss));
no_error ();
accept_signal (route_changed);
/* Test route listing */
routes = nm_platform_ip6_route_get_all (ifindex, TRUE);
memset (rts, 0, sizeof (rts));
- rts[0].source = NM_PLATFORM_SOURCE_USER;
+ rts[0].source = NM_IP_CONFIG_SOURCE_USER;
rts[0].network = gateway;
rts[0].plen = 128;
rts[0].ifindex = ifindex;
rts[0].gateway = in6addr_any;
rts[0].metric = metric;
rts[0].mss = mss;
- rts[1].source = NM_PLATFORM_SOURCE_USER;
+ rts[1].source = NM_IP_CONFIG_SOURCE_USER;
rts[1].network = network;
rts[1].plen = plen;
rts[1].ifindex = ifindex;
rts[1].gateway = gateway;
rts[1].metric = metric;
rts[1].mss = mss;
- rts[2].source = NM_PLATFORM_SOURCE_USER;
+ rts[2].source = NM_IP_CONFIG_SOURCE_USER;
rts[2].network = in6addr_any;
rts[2].plen = 0;
rts[2].ifindex = ifindex;
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index 0b8481d419..ac2fb9f7a3 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -583,7 +583,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
address.plen = g_value_get_uint (val);
if (address.address && address.plen) {
- address.source = NM_PLATFORM_SOURCE_PPP;
+ address.source = NM_IP_CONFIG_SOURCE_PPP;
nm_ip4_config_add_address (config, &address);
} else {
nm_log_err (LOGD_PPP, "invalid IPv4 address received!");
@@ -610,7 +610,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
goto out;
if (mtu)
- nm_ip4_config_set_mtu (config, mtu);
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_PPP);
/* Push the IP4 config up to the device */
g_signal_emit (manager, signals[IP4_CONFIG], 0, priv->ip_iface, config);
diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c
index 1ec8921ee9..bd599ca18a 100644
--- a/src/rdisc/nm-lndp-rdisc.c
+++ b/src/rdisc/nm-lndp-rdisc.c
@@ -621,6 +621,21 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
changed |= NM_RDISC_CONFIG_HOP_LIMIT;
}
+ /* MTU */
+ ndp_msg_opt_for_each_offset(offset, msg, NDP_MSG_OPT_MTU) {
+ guint32 mtu = ndp_msg_opt_mtu(msg, offset);
+ if (mtu >= 1280) {
+ rdisc->mtu = mtu;
+ changed |= NM_RDISC_CONFIG_MTU;
+ } else {
+ /* All sorts of bad things would happen if we accepted this.
+ * Kernel would set it, but would flush out all IPv6 addresses away
+ * from the link, even the link-local, and we wouldn't be able to
+ * listen for further RAs that could fix the MTU. */
+ warning ("(%s): MTU too small for IPv6 ignored: %d", rdisc->ifname, mtu);
+ }
+ }
+
check_timestamps (rdisc, now, changed);
return 0;
diff --git a/src/rdisc/nm-rdisc.h b/src/rdisc/nm-rdisc.h
index f4ebc228a9..2d83f0f020 100644
--- a/src/rdisc/nm-rdisc.h
+++ b/src/rdisc/nm-rdisc.h
@@ -95,6 +95,7 @@ typedef enum {
NM_RDISC_CONFIG_DNS_SERVERS = 1 << 4,
NM_RDISC_CONFIG_DNS_DOMAINS = 1 << 5,
NM_RDISC_CONFIG_HOP_LIMIT = 1 << 6,
+ NM_RDISC_CONFIG_MTU = 1 << 7,
} NMRDiscConfigMap;
#define NM_RDISC_MAX_ADDRESSES_DEFAULT 16
@@ -125,6 +126,7 @@ typedef struct {
GArray *dns_servers;
GArray *dns_domains;
int hop_limit;
+ guint32 mtu;
} NMRDisc;
typedef struct {
diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c
index 0032b8f7a7..68de1e3ea6 100644
--- a/src/tests/test-ip4-config.c
+++ b/src/tests/test-ip4-config.c
@@ -139,7 +139,7 @@ test_subtract (void)
nm_ip4_config_add_wins (dst, expected_wins);
nm_ip4_config_set_mss (dst, expected_mss);
- nm_ip4_config_set_mtu (dst, expected_mtu);
+ nm_ip4_config_set_mtu (dst, expected_mtu, NM_IP_CONFIG_SOURCE_UNKNOWN);
nm_ip4_config_subtract (dst, src);
@@ -194,18 +194,18 @@ test_compare_with_source (void)
/* Address */
addr_init (&addr, "1.2.3.4", NULL, 24);
- addr.source = NM_PLATFORM_SOURCE_USER;
+ addr.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_address (a, &addr);
- addr.source = NM_PLATFORM_SOURCE_VPN;
+ addr.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip4_config_add_address (b, &addr);
/* Route */
route_new (&route, "10.0.0.0", 8, "192.168.1.1");
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_route (a, &route);
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip4_config_add_route (b, &route);
/* Assert that the configs are basically the same, eg that the source is ignored */
@@ -226,31 +226,31 @@ test_add_address_with_source (void)
/* Test that a higher priority source is not overwritten */
addr_init (&addr, "1.2.3.4", NULL, 24);
- addr.source = NM_PLATFORM_SOURCE_USER;
+ addr.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_address (a, &addr);
test_addr = nm_ip4_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_USER);
- addr.source = NM_PLATFORM_SOURCE_VPN;
+ addr.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip4_config_add_address (a, &addr);
test_addr = nm_ip4_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_USER);
/* Test that a lower priority address source is overwritten */
nm_ip4_config_del_address (a, 0);
- addr.source = NM_PLATFORM_SOURCE_KERNEL;
+ addr.source = NM_IP_CONFIG_SOURCE_KERNEL;
nm_ip4_config_add_address (a, &addr);
test_addr = nm_ip4_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
- addr.source = NM_PLATFORM_SOURCE_USER;
+ addr.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_address (a, &addr);
test_addr = nm_ip4_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_USER);
g_object_unref (a);
}
@@ -266,31 +266,31 @@ test_add_route_with_source (void)
/* Test that a higher priority source is not overwritten */
route_new (&route, "1.2.3.4", 24, "1.2.3.1");
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_route (a, &route);
test_route = nm_ip4_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_USER);
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip4_config_add_route (a, &route);
test_route = nm_ip4_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_USER);
/* Test that a lower priority address source is overwritten */
nm_ip4_config_del_route (a, 0);
- route.source = NM_PLATFORM_SOURCE_KERNEL;
+ route.source = NM_IP_CONFIG_SOURCE_KERNEL;
nm_ip4_config_add_route (a, &route);
test_route = nm_ip4_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_route (a, &route);
test_route = nm_ip4_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_USER);
g_object_unref (a);
}
@@ -310,9 +310,9 @@ test_merge_subtract_mss_mtu (void)
/* add MSS, MTU to configs to test them */
nm_ip4_config_set_mss (cfg2, expected_mss2);
- nm_ip4_config_set_mtu (cfg2, expected_mtu2);
+ nm_ip4_config_set_mtu (cfg2, expected_mtu2, NM_IP_CONFIG_SOURCE_UNKNOWN);
nm_ip4_config_set_mss (cfg3, expected_mss3);
- nm_ip4_config_set_mtu (cfg3, expected_mtu3);
+ nm_ip4_config_set_mtu (cfg3, expected_mtu3, NM_IP_CONFIG_SOURCE_UNKNOWN);
nm_ip4_config_merge (cfg1, cfg2);
/* ensure MSS and MTU are in cfg1 */
diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c
index 2177241de5..f8ecefc93b 100644
--- a/src/tests/test-ip6-config.c
+++ b/src/tests/test-ip6-config.c
@@ -132,18 +132,18 @@ test_compare_with_source (void)
/* Address */
addr = *nmtst_platform_ip6_address ("1122:3344:5566::7788", NULL, 64);
- addr.source = NM_PLATFORM_SOURCE_USER;
+ addr.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_address (a, &addr);
- addr.source = NM_PLATFORM_SOURCE_VPN;
+ addr.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip6_config_add_address (b, &addr);
/* Route */
route = *nmtst_platform_ip6_route ("abcd:1234:4321::", 24, "abcd:1234:4321:cdde::2");
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_route (a, &route);
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip6_config_add_route (b, &route);
/* Assert that the configs are basically the same, eg that the source is ignored */
@@ -164,31 +164,31 @@ test_add_address_with_source (void)
/* Test that a higher priority source is not overwritten */
addr = *nmtst_platform_ip6_address ("1122:3344:5566::7788", NULL, 64);
- addr.source = NM_PLATFORM_SOURCE_USER;
+ addr.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_address (a, &addr);
test_addr = nm_ip6_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_USER);
- addr.source = NM_PLATFORM_SOURCE_VPN;
+ addr.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip6_config_add_address (a, &addr);
test_addr = nm_ip6_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_USER);
/* Test that a lower priority address source is overwritten */
nm_ip6_config_del_address (a, 0);
- addr.source = NM_PLATFORM_SOURCE_KERNEL;
+ addr.source = NM_IP_CONFIG_SOURCE_KERNEL;
nm_ip6_config_add_address (a, &addr);
test_addr = nm_ip6_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
- addr.source = NM_PLATFORM_SOURCE_USER;
+ addr.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_address (a, &addr);
test_addr = nm_ip6_config_get_address (a, 0);
- g_assert_cmpint (test_addr->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_addr->source, ==, NM_IP_CONFIG_SOURCE_USER);
g_object_unref (a);
}
@@ -204,31 +204,31 @@ test_add_route_with_source (void)
/* Test that a higher priority source is not overwritten */
route = *nmtst_platform_ip6_route ("abcd:1234:4321::", 24, "abcd:1234:4321:cdde::2");
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_route (a, &route);
test_route = nm_ip6_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_USER);
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip6_config_add_route (a, &route);
test_route = nm_ip6_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_USER);
/* Test that a lower priority address source is overwritten */
nm_ip6_config_del_route (a, 0);
- route.source = NM_PLATFORM_SOURCE_KERNEL;
+ route.source = NM_IP_CONFIG_SOURCE_KERNEL;
nm_ip6_config_add_route (a, &route);
test_route = nm_ip6_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_KERNEL);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
- route.source = NM_PLATFORM_SOURCE_USER;
+ route.source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_route (a, &route);
test_route = nm_ip6_config_get_route (a, 0);
- g_assert_cmpint (test_route->source, ==, NM_PLATFORM_SOURCE_USER);
+ g_assert_cmpint (test_route->source, ==, NM_IP_CONFIG_SOURCE_USER);
g_object_unref (a);
}
@@ -286,33 +286,33 @@ test_nm_ip6_config_addresses_sort (void)
#define ADDR_ADD(...) nm_ip6_config_add_address (config, nmtst_platform_ip6_address_full (__VA_ARGS__))
nm_ip6_config_reset_addresses (config);
- ADDR_ADD("2607:f0d0:1002:51::4", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
- ADDR_ADD("2607:f0d0:1002:51::5", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
- ADDR_ADD("2607:f0d0:1002:51::6", NULL, 64, 0, NM_PLATFORM_SOURCE_RDISC, 0, 0, 0, IFA_F_MANAGETEMPADDR);
- ADDR_ADD("2607:f0d0:1002:51::3", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
- ADDR_ADD("2607:f0d0:1002:51::8", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
- ADDR_ADD("2607:f0d0:1002:51::0", NULL, 64, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, IFA_F_SECONDARY);
- ADDR_ADD("fec0::1", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
- ADDR_ADD("fe80::208:74ff:feda:625c", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
- ADDR_ADD("fe80::208:74ff:feda:625d", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
- ADDR_ADD("::1", NULL, 128, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
- ADDR_ADD("2607:f0d0:1002:51::2", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, IFA_F_TENTATIVE);
+ ADDR_ADD("2607:f0d0:1002:51::4", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, 0);
+ ADDR_ADD("2607:f0d0:1002:51::5", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, 0);
+ ADDR_ADD("2607:f0d0:1002:51::6", NULL, 64, 0, NM_IP_CONFIG_SOURCE_RDISC, 0, 0, 0, IFA_F_MANAGETEMPADDR);
+ ADDR_ADD("2607:f0d0:1002:51::3", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
+ ADDR_ADD("2607:f0d0:1002:51::8", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
+ ADDR_ADD("2607:f0d0:1002:51::0", NULL, 64, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, IFA_F_SECONDARY);
+ ADDR_ADD("fec0::1", NULL, 128, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, 0);
+ ADDR_ADD("fe80::208:74ff:feda:625c", NULL, 128, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, 0);
+ ADDR_ADD("fe80::208:74ff:feda:625d", NULL, 128, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, 0);
+ ADDR_ADD("::1", NULL, 128, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, 0);
+ ADDR_ADD("2607:f0d0:1002:51::2", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, IFA_F_TENTATIVE);
test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN, 8);
test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED, 8);
test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR, 8);
nm_ip6_config_reset_addresses (config);
- ADDR_ADD("2607:f0d0:1002:51::3", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
- ADDR_ADD("2607:f0d0:1002:51::4", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
- ADDR_ADD("2607:f0d0:1002:51::5", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
- ADDR_ADD("2607:f0d0:1002:51::8", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
- ADDR_ADD("2607:f0d0:1002:51::0", NULL, 64, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, IFA_F_SECONDARY);
- ADDR_ADD("2607:f0d0:1002:51::6", NULL, 64, 0, NM_PLATFORM_SOURCE_RDISC, 0, 0, 0, IFA_F_MANAGETEMPADDR);
- ADDR_ADD("fec0::1", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
- ADDR_ADD("fe80::208:74ff:feda:625c", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
- ADDR_ADD("fe80::208:74ff:feda:625d", NULL, 128, 0, NM_PLATFORM_SOURCE_KERNEL, 0, 0, 0, 0);
- ADDR_ADD("::1", NULL, 128, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, 0);
- ADDR_ADD("2607:f0d0:1002:51::2", NULL, 64, 0, NM_PLATFORM_SOURCE_USER, 0, 0, 0, IFA_F_TENTATIVE);
+ ADDR_ADD("2607:f0d0:1002:51::3", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
+ ADDR_ADD("2607:f0d0:1002:51::4", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, 0);
+ ADDR_ADD("2607:f0d0:1002:51::5", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, 0);
+ ADDR_ADD("2607:f0d0:1002:51::8", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, IFA_F_SECONDARY);
+ ADDR_ADD("2607:f0d0:1002:51::0", NULL, 64, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, IFA_F_SECONDARY);
+ ADDR_ADD("2607:f0d0:1002:51::6", NULL, 64, 0, NM_IP_CONFIG_SOURCE_RDISC, 0, 0, 0, IFA_F_MANAGETEMPADDR);
+ ADDR_ADD("fec0::1", NULL, 128, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, 0);
+ ADDR_ADD("fe80::208:74ff:feda:625c", NULL, 128, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, 0);
+ ADDR_ADD("fe80::208:74ff:feda:625d", NULL, 128, 0, NM_IP_CONFIG_SOURCE_KERNEL, 0, 0, 0, 0);
+ ADDR_ADD("::1", NULL, 128, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, 0);
+ ADDR_ADD("2607:f0d0:1002:51::2", NULL, 64, 0, NM_IP_CONFIG_SOURCE_USER, 0, 0, 0, IFA_F_TENTATIVE);
test_nm_ip6_config_addresses_sort_check (config, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR, 8);
#undef ADDR_ADD
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index cd22b61fd1..5ddf22e771 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -493,7 +493,7 @@ add_ip4_vpn_gateway_route (NMIP4Config *config, NMDevice *parent_device, guint32
if (nm_ip4_config_destination_is_direct (parent_config, vpn_gw, 32))
route.gateway = 0;
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = nm_device_get_priority (parent_device);
nm_ip4_config_add_route (config, &route);
@@ -505,7 +505,7 @@ add_ip4_vpn_gateway_route (NMIP4Config *config, NMDevice *parent_device, guint32
memset (&route, 0, sizeof (route));
route.network = parent_gw;
route.plen = 32;
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = nm_device_get_priority (parent_device);
nm_ip4_config_add_route (config, &route);
@@ -542,7 +542,7 @@ add_ip6_vpn_gateway_route (NMIP6Config *config,
if (nm_ip6_config_destination_is_direct (parent_config, vpn_gw, 128))
route.gateway = in6addr_any;
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = nm_device_get_priority (parent_device);
nm_ip6_config_add_route (config, &route);
@@ -554,7 +554,7 @@ add_ip6_vpn_gateway_route (NMIP6Config *config,
memset (&route, 0, sizeof (route));
route.network = *parent_gw;
route.plen = 128;
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = nm_device_get_priority (parent_device);
nm_ip6_config_add_route (config, &route);
@@ -1130,7 +1130,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
address.plen = g_value_get_uint (val);
if (address.address && address.plen) {
- address.source = NM_PLATFORM_SOURCE_VPN;
+ address.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip4_config_add_address (config, &address);
} else {
nm_log_err (LOGD_VPN, "invalid IP4 config received!");
@@ -1160,7 +1160,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
nm_ip4_config_set_mss (config, g_value_get_uint (val));
if (priv->mtu)
- nm_ip4_config_set_mtu (config, priv->mtu);
+ nm_ip4_config_set_mtu (config, priv->mtu, NM_IP_CONFIG_SOURCE_VPN);
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN);
if (val)
@@ -1189,7 +1189,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
route.network = nm_ip4_route_get_dest (item);
route.plen = nm_ip4_route_get_prefix (item);
route.gateway = nm_ip4_route_get_next_hop (item);
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = vpn_routing_metric (connection);
/* Ignore host routes to the VPN gateway since NM adds one itself
@@ -1284,7 +1284,7 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
address.plen = g_value_get_uint (val);
if (!IN6_IS_ADDR_UNSPECIFIED (&address.address) && address.plen) {
- address.source = NM_PLATFORM_SOURCE_VPN;
+ address.source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip6_config_add_address (config, &address);
} else {
nm_log_err (LOGD_VPN, "invalid IP6 config received!");
@@ -1335,7 +1335,7 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
route.network = *nm_ip6_route_get_dest (item);
route.plen = nm_ip6_route_get_prefix (item);
route.gateway = *nm_ip6_route_get_next_hop (item);
- route.source = NM_PLATFORM_SOURCE_VPN;
+ route.source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = vpn_routing_metric (connection);
/* Ignore host routes to the VPN gateway since NM adds one itself