core/trivial: rename "source" field of addresses and routes

The "source" field of NMPlatformIPRoute (now "rt_source") maps to the
protocol field of the route. The source of NMPlatformIPAddress (now
"addr_source") has no direct equivalent in the kernel.

As their use is different, they should have different names. Also,
the name "source" is used all over the place. Hence give the fields
a more distinct name.
This commit is contained in:
Thomas Haller
2016-04-11 13:09:52 +02:00
parent 44753a590e
commit 6bf022359f
22 changed files with 173 additions and 175 deletions

View File

@@ -1209,7 +1209,7 @@ nmtst_platform_ip4_address_full (const char *address, const char *peer_address,
g_assert (!label || strlen (label) < IFNAMSIZ);
addr->ifindex = ifindex;
addr->source = source;
addr->addr_source = source;
addr->timestamp = timestamp;
addr->lifetime = lifetime;
addr->preferred = preferred;
@@ -1243,7 +1243,7 @@ nmtst_platform_ip6_address_full (const char *address, const char *peer_address,
NMPlatformIP6Address *addr = nmtst_platform_ip6_address (address, peer_address, plen);
addr->ifindex = ifindex;
addr->source = source;
addr->addr_source = source;
addr->timestamp = timestamp;
addr->lifetime = lifetime;
addr->preferred = preferred;
@@ -1277,7 +1277,7 @@ nmtst_platform_ip4_route_full (const char *network, guint plen, const char *gate
NMPlatformIP4Route *route = nmtst_platform_ip4_route (network, plen, gateway);
route->ifindex = ifindex;
route->source = source;
route->rt_source = source;
route->metric = metric;
route->mss = mss;
route->scope_inv = nm_platform_route_scope_inv (scope);
@@ -1309,7 +1309,7 @@ nmtst_platform_ip6_route_full (const char *network, guint plen, const char *gate
NMPlatformIP6Route *route = nmtst_platform_ip6_route (network, plen, gateway);
route->ifindex = ifindex;
route->source = source;
route->rt_source = source;
route->metric = metric;
route->mss = mss;

View File

@@ -3997,14 +3997,14 @@ ipv4ll_get_ip4_config (NMDevice *self, guint32 lla)
memset (&address, 0, sizeof (address));
nm_platform_ip4_address_set_addr (&address, lla, 16);
address.source = NM_IP_CONFIG_SOURCE_IP4LL;
address.addr_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_IP_CONFIG_SOURCE_IP4LL;
route.rt_source = NM_IP_CONFIG_SOURCE_IP4LL;
route.metric = nm_device_get_ip4_route_metric (self);
nm_ip4_config_add_route (config, &route);
@@ -4441,7 +4441,7 @@ ip4_config_merge_and_apply (NMDevice *self,
priv->default_route.v4_has = TRUE;
memset (&priv->default_route.v4, 0, sizeof (priv->default_route.v4));
priv->default_route.v4.source = NM_IP_CONFIG_SOURCE_USER;
priv->default_route.v4.rt_source = NM_IP_CONFIG_SOURCE_USER;
priv->default_route.v4.gateway = gateway;
priv->default_route.v4.metric = default_route_metric;
priv->default_route.v4.mss = nm_ip4_config_get_mss (composite);
@@ -4806,7 +4806,7 @@ shared4_new_config (NMDevice *self, NMConnection *connection, NMDeviceStateReaso
}
config = nm_ip4_config_new (nm_device_get_ip_ifindex (self));
address.source = NM_IP_CONFIG_SOURCE_SHARED;
address.addr_source = NM_IP_CONFIG_SOURCE_SHARED;
nm_ip4_config_add_address (config, &address);
/* Remove the address lock when the object gets disposed */
@@ -5172,7 +5172,7 @@ ip6_config_merge_and_apply (NMDevice *self,
priv->default_route.v6_has = TRUE;
memset (&priv->default_route.v6, 0, sizeof (priv->default_route.v6));
priv->default_route.v6.source = NM_IP_CONFIG_SOURCE_USER;
priv->default_route.v6.rt_source = NM_IP_CONFIG_SOURCE_USER;
priv->default_route.v6.gateway = *gateway;
priv->default_route.v6.metric = nm_device_get_ip6_route_metric (self);
priv->default_route.v6.mss = nm_ip6_config_get_mss (composite);
@@ -5799,7 +5799,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_IP_CONFIG_SOURCE_RDISC;
address.addr_source = NM_IP_CONFIG_SOURCE_RDISC;
address.n_ifa_flags = ifa_flags;
nm_ip6_config_add_address (priv->ac_ip6_config, &address);
@@ -5824,7 +5824,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self)
nm_assert (discovered_route->plen <= 128);
route.plen = discovered_route->plen;
route.gateway = discovered_route->gateway;
route.source = NM_IP_CONFIG_SOURCE_RDISC;
route.rt_source = NM_IP_CONFIG_SOURCE_RDISC;
route.metric = nm_device_get_ip6_route_metric (self);
nm_ip6_config_add_route (priv->ac_ip6_config, &route);
@@ -9004,7 +9004,7 @@ queued_ip6_config_change (gpointer user_data)
for (iter = priv->dad6_failed_addrs; iter; iter = g_slist_next (iter)) {
NMPlatformIP6Address *addr = iter->data;
if (addr->source >= NM_IP_CONFIG_SOURCE_USER)
if (addr->addr_source >= NM_IP_CONFIG_SOURCE_USER)
continue;
_LOGI (LOGD_IP6, "ipv6: duplicate address check failed for the %s address",
@@ -10218,7 +10218,7 @@ find_dhcp4_address (NMDevice *self)
for (i = 0; i < n; i++) {
const NMPlatformIP4Address *a = nm_ip4_config_get_address (priv->ip4_config, i);
if (a->source == NM_IP_CONFIG_SOURCE_DHCP)
if (a->addr_source == NM_IP_CONFIG_SOURCE_DHCP)
return g_strdup (nm_utils_inet4_ntop (a->address, NULL));
}
return NULL;

View File

@@ -869,7 +869,7 @@ static_stage3_ip4_done (NMModemBroadband *self)
address.address = address_network;
address.peer_address = address_network;
address.plen = mm_bearer_ip_config_get_prefix (self->priv->ipv4_config);
address.source = NM_IP_CONFIG_SOURCE_WWAN;
address.addr_source = NM_IP_CONFIG_SOURCE_WWAN;
if (address.plen <= 32)
nm_ip4_config_add_address (config, &address);

View File

@@ -700,7 +700,7 @@ nm_dhcp_dhclient_read_lease_ip_configs (const char *iface,
address.timestamp = now_monotonic_ts;
address.lifetime = address.preferred = expiry;
address.source = NM_IP_CONFIG_SOURCE_DHCP;
address.addr_source = NM_IP_CONFIG_SOURCE_DHCP;
ip4 = nm_ip4_config_new (ifindex);
nm_ip4_config_add_address (ip4, &address);

View File

@@ -256,7 +256,7 @@ lease_to_ip4_config (const char *iface,
SD_DHCP_OPTION_IP_ADDRESS_LEASE_TIME,
end_time);
address.source = NM_IP_CONFIG_SOURCE_DHCP;
address.addr_source = NM_IP_CONFIG_SOURCE_DHCP;
nm_ip4_config_add_address (ip4_config, &address);
/* DNS Servers */
@@ -322,7 +322,7 @@ lease_to_ip4_config (const char *iface,
route.gateway = a.s_addr;
if (route.plen) {
route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = default_priority;
nm_ip4_config_add_route (ip4_config, &route);
@@ -740,7 +740,7 @@ lease_to_ip6_config (const char *iface,
.timestamp = ts,
.lifetime = lft_valid,
.preferred = lft_pref,
.source = NM_IP_CONFIG_SOURCE_DHCP,
.addr_source = NM_IP_CONFIG_SOURCE_DHCP,
};
nm_ip6_config_add_address (ip6_config, &address);

View File

@@ -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_IP_CONFIG_SOURCE_DHCP;
route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = priority;
nm_ip4_config_add_route (ip4_config, &route);
}
@@ -192,7 +192,7 @@ ip4_process_dhclient_rfc3442_routes (const char *str,
char addr[INET_ADDRSTRLEN];
/* normal route */
route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = priority;
nm_ip4_config_add_route (ip4_config, &route);
@@ -314,7 +314,7 @@ process_classful_routes (GHashTable *options, guint32 priority, NMIP4Config *ip4
route.plen = 32;
}
route.gateway = rt_route;
route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
route.metric = priority;
nm_ip4_config_add_route (ip4_config, &route);
@@ -465,7 +465,7 @@ nm_dhcp_utils_ip4_config_from_options (int ifindex,
route.plen = 32;
/* this will be a device route if gwaddr is 0 */
route.gateway = gwaddr;
route.source = NM_IP_CONFIG_SOURCE_DHCP;
route.rt_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",
@@ -482,7 +482,7 @@ nm_dhcp_utils_ip4_config_from_options (int ifindex,
nm_log_info (LOGD_DHCP4, " lease time %u", address.lifetime);
}
address.source = NM_IP_CONFIG_SOURCE_DHCP;
address.addr_source = NM_IP_CONFIG_SOURCE_DHCP;
nm_ip4_config_add_address (ip4_config, &address);
str = g_hash_table_lookup (options, "host_name");
@@ -642,7 +642,7 @@ nm_dhcp_utils_ip6_config_from_options (int ifindex,
}
address.address = tmp_addr;
address.source = NM_IP_CONFIG_SOURCE_DHCP;
address.addr_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) {

View File

@@ -200,7 +200,7 @@ _vt_routes_has_entry (const VTableIP *vtable, GArray *routes, const Entry *entry
for (i = 0; i < routes->len; i++) {
NMPlatformIP4Route *r = &g_array_index (routes, NMPlatformIP4Route, i);
route.rx.source = r->source;
route.rx.rt_source = r->rt_source;
if (nm_platform_ip4_route_cmp (r, &route.r4) == 0)
return TRUE;
}
@@ -208,7 +208,7 @@ _vt_routes_has_entry (const VTableIP *vtable, GArray *routes, const Entry *entry
for (i = 0; i < routes->len; i++) {
NMPlatformIP6Route *r = &g_array_index (routes, NMPlatformIP6Route, i);
route.rx.source = r->source;
route.rx.rt_source = r->rt_source;
if (nm_platform_ip6_route_cmp (r, &route.r6) == 0)
return TRUE;
}
@@ -289,7 +289,7 @@ _platform_route_sync_add (const VTableIP *vtable, NMDefaultRouteManager *self, g
if (vtable->vt->is_ip4) {
success = nm_platform_ip4_route_add (priv->platform,
entry->route.rx.ifindex,
entry->route.rx.source,
entry->route.rx.rt_source,
0,
0,
entry->route.r4.gateway,
@@ -299,7 +299,7 @@ _platform_route_sync_add (const VTableIP *vtable, NMDefaultRouteManager *self, g
} else {
success = nm_platform_ip6_route_add (priv->platform,
entry->route.rx.ifindex,
entry->route.rx.source,
entry->route.rx.rt_source,
in6addr_any,
0,
entry->route.r6.gateway,
@@ -773,7 +773,7 @@ _ipx_update_default_route (const VTableIP *vtable, NMDefaultRouteManager *self,
* the device. */
memset (&rt, 0, sizeof (rt));
rt.rx.ifindex = ip_ifindex;
rt.rx.source = NM_IP_CONFIG_SOURCE_UNKNOWN;
rt.rx.rt_source = NM_IP_CONFIG_SOURCE_UNKNOWN;
rt.rx.metric = G_MAXUINT32;
default_route = &rt.rx;
@@ -795,7 +795,7 @@ _ipx_update_default_route (const VTableIP *vtable, NMDefaultRouteManager *self,
if (vpn_config) {
never_default = nm_ip4_config_get_never_default (vpn_config);
rt.r4.ifindex = ip_ifindex;
rt.r4.source = NM_IP_CONFIG_SOURCE_VPN;
rt.r4.rt_source = NM_IP_CONFIG_SOURCE_VPN;
rt.r4.gateway = nm_ip4_config_get_gateway (vpn_config);
rt.r4.metric = nm_vpn_connection_get_ip4_route_metric (vpn);
rt.r4.mss = nm_ip4_config_get_mss (vpn_config);
@@ -810,7 +810,7 @@ _ipx_update_default_route (const VTableIP *vtable, NMDefaultRouteManager *self,
never_default = nm_ip6_config_get_never_default (vpn_config);
rt.r6.ifindex = ip_ifindex;
rt.r6.source = NM_IP_CONFIG_SOURCE_VPN;
rt.r6.rt_source = NM_IP_CONFIG_SOURCE_VPN;
rt.r6.gateway = int_gw ? *int_gw : in6addr_any;
rt.r6.metric = nm_vpn_connection_get_ip6_route_metric (vpn);
rt.r6.mss = nm_ip6_config_get_mss (vpn_config);

View File

@@ -194,7 +194,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, gpointer user_da
address.preferred = discovered_address->preferred;
if (address.preferred > address.lifetime)
address.preferred = address.lifetime;
address.source = NM_IP_CONFIG_SOURCE_RDISC;
address.addr_source = NM_IP_CONFIG_SOURCE_RDISC;
address.n_ifa_flags = ifa_flags;
nm_ip6_config_add_address (rdisc_config, &address);
@@ -219,7 +219,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, gpointer user_da
route.network = discovered_route->network;
route.plen = discovered_route->plen;
route.gateway = discovered_route->gateway;
route.source = NM_IP_CONFIG_SOURCE_RDISC;
route.rt_source = NM_IP_CONFIG_SOURCE_RDISC;
route.metric = global_opt.priority_v6;
nm_ip6_config_add_route (rdisc_config, &route);

View File

@@ -207,8 +207,8 @@ _addresses_sort_cmp (gconstpointer a, gconstpointer b)
return p1 > p2 ? -1 : 1;
/* Sort the addresses based on their source. */
if (a1->source != a2->source)
return a1->source > a2->source ? -1 : 1;
if (a1->addr_source != a2->addr_source)
return a1->addr_source > a2->addr_source ? -1 : 1;
if ((a1->label[0] == '\0') != (a2->label[0] == '\0'))
return (a1->label[0] == '\0') ? -1 : 1;
@@ -368,7 +368,7 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, gboolean routes_fu
nm_assert (addr->plen <= 32);
route.ifindex = ifindex;
route.source = NM_IP_CONFIG_SOURCE_KERNEL;
route.rt_source = NM_IP_CONFIG_SOURCE_KERNEL;
/* The destination network depends on the peer-address. */
route.network = nm_utils_ip4_address_clear_host_address (addr->peer_address, addr->plen);
@@ -471,7 +471,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, gu
nm_assert (address.plen <= 32);
address.lifetime = NM_PLATFORM_LIFETIME_PERMANENT;
address.preferred = NM_PLATFORM_LIFETIME_PERMANENT;
address.source = NM_IP_CONFIG_SOURCE_USER;
address.addr_source = NM_IP_CONFIG_SOURCE_USER;
label = nm_ip_address_get_attribute (s_addr, "label");
if (label)
@@ -500,7 +500,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, gu
route.metric = default_route_metric;
else
route.metric = nm_ip_route_get_metric (s_route);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_route (config, &route);
}
@@ -606,7 +606,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
continue;
/* Ignore routes provided by external sources */
if (route->source != NM_IP_CONFIG_SOURCE_USER)
if (route->rt_source != NM_IP_CONFIG_SOURCE_USER)
continue;
s_route = nm_ip_route_new_binary (AF_INET,
@@ -1481,14 +1481,14 @@ nm_ip4_config_add_address (NMIP4Config *config, const NMPlatformIP4Address *new)
*item = *new;
/* But restore highest priority source */
item->source = MAX (item_old.source, new->source);
item->addr_source = MAX (item_old.addr_source, new->addr_source);
/* for addresses that we read from the kernel, we keep the timestamps as defined
* by the previous source (item_old). The reason is, that the other source configured the lifetimes
* 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_IP_CONFIG_SOURCE_KERNEL && new->source != item_old.source)
if ( (new->addr_source == NM_IP_CONFIG_SOURCE_KERNEL && new->addr_source != item_old.addr_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;
@@ -1582,10 +1582,10 @@ nm_ip4_config_add_route (NMIP4Config *config, const NMPlatformIP4Route *new)
if (routes_are_duplicate (item, new, FALSE)) {
if (nm_platform_ip4_route_cmp (item, new) == 0)
return;
old_source = item->source;
old_source = item->rt_source;
memcpy (item, new, sizeof (*item));
/* Restore highest priority source */
item->source = MAX (old_source, new->source);
item->rt_source = MAX (old_source, new->rt_source);
item->ifindex = priv->ifindex;
goto NOTIFY;
}

View File

@@ -240,8 +240,8 @@ _addresses_sort_cmp (gconstpointer a, gconstpointer b, gpointer user_data)
}
/* Sort the addresses based on their source. */
if (a1->source != a2->source)
return a1->source > a2->source ? -1 : 1;
if (a1->addr_source != a2->addr_source)
return a1->addr_source > a2->addr_source ? -1 : 1;
/* sort permanent addresses before non-permanent. */
perm1 = (a1->n_ifa_flags & IFA_F_PERMANENT);
@@ -457,7 +457,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, gu
nm_assert (address.plen <= 128);
address.lifetime = NM_PLATFORM_LIFETIME_PERMANENT;
address.preferred = NM_PLATFORM_LIFETIME_PERMANENT;
address.source = NM_IP_CONFIG_SOURCE_USER;
address.addr_source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_address (config, &address);
}
@@ -482,7 +482,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, gu
route.metric = default_route_metric;
else
route.metric = nm_ip_route_get_metric (s_route);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_route (config, &route);
}
@@ -596,7 +596,7 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
continue;
/* Ignore routes provided by external sources */
if (route->source != NM_IP_CONFIG_SOURCE_USER)
if (route->rt_source != NM_IP_CONFIG_SOURCE_USER)
continue;
s_route = nm_ip_route_new_binary (AF_INET6,
@@ -1290,14 +1290,14 @@ nm_ip6_config_add_address (NMIP6Config *config, const NMPlatformIP6Address *new)
*item = *new;
/* But restore highest priority source */
item->source = MAX (item_old.source, new->source);
item->addr_source = MAX (item_old.addr_source, new->addr_source);
/* for addresses that we read from the kernel, we keep the timestamps as defined
* by the previous source (item_old). The reason is, that the other source configured the lifetimes
* 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_IP_CONFIG_SOURCE_KERNEL && new->source != item_old.source)
if ( (new->addr_source == NM_IP_CONFIG_SOURCE_KERNEL && new->addr_source != item_old.addr_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;
@@ -1414,10 +1414,10 @@ nm_ip6_config_add_route (NMIP6Config *config, const NMPlatformIP6Route *new)
if (routes_are_duplicate (item, new, FALSE)) {
if (nm_platform_ip6_route_cmp (item, new) == 0)
return;
old_source = item->source;
old_source = item->rt_source;
*item = *new;
/* Restore highest priority source */
item->source = MAX (old_source, new->source);
item->rt_source = MAX (old_source, new->rt_source);
item->ifindex = priv->ifindex;
goto NOTIFY;
}

View File

@@ -873,7 +873,7 @@ next:
|| !_route_equals_ignoring_ifindex (vtable, cur_plat_route, cur_ipx_route, *p_effective_metric)) {
if (!vtable->vt->route_add (priv->platform, ifindex, cur_ipx_route, *p_effective_metric)) {
if (cur_ipx_route->rx.source < NM_IP_CONFIG_SOURCE_USER) {
if (cur_ipx_route->rx.rt_source < NM_IP_CONFIG_SOURCE_USER) {
_LOGD (vtable->vt->addr_family,
"ignore error adding IPv%c route to kernel: %s",
vtable->vt->is_ip4 ? '4' : '6',
@@ -1024,7 +1024,7 @@ _ip4_device_routes_ip4_route_changed (NMPlatform *platform,
if (change_type == NM_PLATFORM_SIGNAL_REMOVED)
return;
if ( route->source != NM_IP_CONFIG_SOURCE_RTPROT_KERNEL
if ( route->rt_source != NM_IP_CONFIG_SOURCE_RTPROT_KERNEL
|| route->metric != 0) {
/* we don't have an automatically created device route at hand. Bail out early. */
return;

View File

@@ -911,7 +911,7 @@ ip4_address_add (NMPlatform *platform,
int i;
memset (&address, 0, sizeof (address));
address.source = NM_IP_CONFIG_SOURCE_KERNEL;
address.addr_source = NM_IP_CONFIG_SOURCE_KERNEL;
address.ifindex = ifindex;
address.address = addr;
address.peer_address = peer_addr;
@@ -962,7 +962,7 @@ ip6_address_add (NMPlatform *platform,
int i;
memset (&address, 0, sizeof (address));
address.source = NM_IP_CONFIG_SOURCE_KERNEL;
address.addr_source = NM_IP_CONFIG_SOURCE_KERNEL;
address.ifindex = ifindex;
address.address = addr;
address.peer_address = (IN6_IS_ADDR_UNSPECIFIED (&peer_addr) || IN6_ARE_ADDR_EQUAL (&addr, &peer_addr)) ? in6addr_any : peer_addr;
@@ -1207,9 +1207,8 @@ ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
scope = gateway == 0 ? RT_SCOPE_LINK : RT_SCOPE_UNIVERSE;
memset (&route, 0, sizeof (route));
route.source = NM_IP_CONFIG_SOURCE_KERNEL;
route.ifindex = ifindex;
route.source = source;
route.rt_source = source;
route.network = nm_utils_ip4_address_clear_host_address (network, plen);
route.plen = plen;
route.gateway = gateway;
@@ -1273,9 +1272,8 @@ ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
metric = nm_utils_ip6_route_metric_normalize (metric);
memset (&route, 0, sizeof (route));
route.source = NM_IP_CONFIG_SOURCE_KERNEL;
route.ifindex = ifindex;
route.source = source;
route.rt_source = source;
nm_utils_ip6_address_clear_host_address (&route.network, &network, plen);
route.plen = plen;
route.gateway = gateway;

View File

@@ -1652,7 +1652,7 @@ _new_from_nl_addr (struct nlmsghdr *nlh, gboolean id_only)
}
}
obj->ip_address.source = NM_IP_CONFIG_SOURCE_KERNEL;
obj->ip_address.addr_source = NM_IP_CONFIG_SOURCE_KERNEL;
obj->ip_address.n_ifa_flags = tb[IFA_FLAGS]
? nla_get_u32 (tb[IFA_FLAGS])
@@ -1882,9 +1882,9 @@ _new_from_nl_route (struct nlmsghdr *nlh, gboolean id_only)
*
* This happens, because this route is not nmp_object_is_alive().
* */
obj->ip_route.source = _NM_IP_CONFIG_SOURCE_RTM_F_CLONED;
obj->ip_route.rt_source = _NM_IP_CONFIG_SOURCE_RTM_F_CLONED;
} else
obj->ip_route.source = nmp_utils_ip_config_source_from_rtprot (rtm->rtm_protocol);
obj->ip_route.rt_source = nmp_utils_ip_config_source_from_rtprot (rtm->rtm_protocol);
obj_result = obj;
obj = NULL;
@@ -5583,7 +5583,7 @@ ipx_route_get_all (NMPlatform *platform, int ifindex, NMPObjectType obj_type, NM
nm_assert (NMP_OBJECT_GET_CLASS (NMP_OBJECT_UP_CAST (routes[i])) == klass);
if ( with_rtprot_kernel
|| routes[i]->source != NM_IP_CONFIG_SOURCE_RTPROT_KERNEL)
|| routes[i]->rt_source != NM_IP_CONFIG_SOURCE_RTPROT_KERNEL)
g_array_append_vals (array, routes[i], 1);
}
return array;

View File

@@ -2912,7 +2912,7 @@ nm_platform_ip4_route_add (NMPlatform *self,
NMPlatformIP4Route route = { 0 };
route.ifindex = ifindex;
route.source = source;
route.rt_source = source;
route.network = network;
route.plen = plen;
route.gateway = gateway;
@@ -2939,7 +2939,7 @@ nm_platform_ip6_route_add (NMPlatform *self,
NMPlatformIP6Route route = { 0 };
route.ifindex = ifindex;
route.source = source;
route.rt_source = source;
route.network = network;
route.plen = plen;
route.gateway = gateway;
@@ -3528,7 +3528,7 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address, char *bu
str_dev,
_to_string_ifa_flags (address->n_ifa_flags, s_flags, sizeof (s_flags)),
str_label,
source_to_string (address->source));
source_to_string (address->addr_source));
g_free (str_peer);
return buf;
}
@@ -3634,7 +3634,7 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address, char *bu
str_peer ? str_peer : "",
str_dev,
_to_string_ifa_flags (address->n_ifa_flags, s_flags, sizeof (s_flags)),
source_to_string (address->source));
source_to_string (address->addr_source));
g_free (str_peer);
return buf;
}
@@ -3683,7 +3683,7 @@ nm_platform_ip4_route_to_string (const NMPlatformIP4Route *route, char *buf, gsi
str_dev,
route->metric,
route->mss,
source_to_string (route->source),
source_to_string (route->rt_source),
route->scope_inv ? " scope " : "",
route->scope_inv ? (nm_platform_route_scope2str (nm_platform_route_scope_inv (route->scope_inv), str_scope, sizeof (str_scope))) : "",
route->pref_src ? " pref-src " : "",
@@ -3731,7 +3731,7 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route, char *buf, gsi
str_dev,
route->metric,
route->mss,
source_to_string (route->source));
source_to_string (route->rt_source));
return buf;
}
@@ -3953,7 +3953,7 @@ nm_platform_ip4_address_cmp (const NMPlatformIP4Address *a, const NMPlatformIP4A
{
_CMP_SELF (a, b);
_CMP_FIELD (a, b, ifindex);
_CMP_FIELD (a, b, source);
_CMP_FIELD (a, b, addr_source);
_CMP_FIELD (a, b, address);
_CMP_FIELD (a, b, plen);
_CMP_FIELD (a, b, peer_address);
@@ -3972,7 +3972,7 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A
_CMP_SELF (a, b);
_CMP_FIELD (a, b, ifindex);
_CMP_FIELD (a, b, source);
_CMP_FIELD (a, b, addr_source);
_CMP_FIELD_MEMCMP (a, b, address);
p_a = nm_platform_ip6_address_get_peer (a);
@@ -3992,7 +3992,7 @@ nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route
{
_CMP_SELF (a, b);
_CMP_FIELD (a, b, ifindex);
_CMP_FIELD (a, b, source);
_CMP_FIELD (a, b, rt_source);
_CMP_FIELD (a, b, network);
_CMP_FIELD (a, b, plen);
_CMP_FIELD (a, b, gateway);
@@ -4008,7 +4008,7 @@ nm_platform_ip6_route_cmp (const NMPlatformIP6Route *a, const NMPlatformIP6Route
{
_CMP_SELF (a, b);
_CMP_FIELD (a, b, ifindex);
_CMP_FIELD (a, b, source);
_CMP_FIELD (a, b, rt_source);
_CMP_FIELD_MEMCMP (a, b, network);
_CMP_FIELD (a, b, plen);
_CMP_FIELD_MEMCMP (a, b, gateway);
@@ -4146,7 +4146,7 @@ _vtr_v4_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *rout
{
return nm_platform_ip4_route_add (self,
ifindex > 0 ? ifindex : route->rx.ifindex,
route->rx.source,
route->rx.rt_source,
route->r4.network,
route->rx.plen,
route->r4.gateway,
@@ -4160,7 +4160,7 @@ _vtr_v6_route_add (NMPlatform *self, int ifindex, const NMPlatformIPXRoute *rout
{
return nm_platform_ip6_route_add (self,
ifindex > 0 ? ifindex : route->rx.ifindex,
route->rx.source,
route->rx.rt_source,
route->r6.network,
route->rx.plen,
route->r6.gateway,

View File

@@ -200,7 +200,7 @@ typedef struct {
#define __NMPlatformIPAddress_COMMON \
__NMPlatformObject_COMMON; \
NMIPConfigSource source; \
NMIPConfigSource addr_source; \
\
/* Timestamp in seconds in the reference system of nm_utils_get_monotonic_timestamp_*().
*
@@ -303,7 +303,7 @@ typedef union {
#define __NMPlatformIPRoute_COMMON \
__NMPlatformObject_COMMON; \
NMIPConfigSource source; \
NMIPConfigSource rt_source; \
guint8 plen; \
guint32 metric; \
guint32 mss; \

View File

@@ -920,7 +920,7 @@ _vt_cmd_obj_is_alive_ipx_route (const NMPObject *obj)
* Instead we create a dead object, and nmp_cache_update_netlink()
* will remove the old version of the update.
**/
return obj->object.ifindex > 0 && (obj->ip_route.source != _NM_IP_CONFIG_SOURCE_RTM_F_CLONED);
return obj->object.ifindex > 0 && (obj->ip_route.rt_source != _NM_IP_CONFIG_SOURCE_RTM_F_CLONED);
}
gboolean

View File

@@ -178,7 +178,7 @@ test_ip4_route (void)
/* Test route listing */
routes = nm_platform_ip4_route_get_all (NM_PLATFORM_GET, ifindex, NM_PLATFORM_GET_ROUTE_FLAGS_WITH_DEFAULT | NM_PLATFORM_GET_ROUTE_FLAGS_WITH_NON_DEFAULT);
memset (rts, 0, sizeof (rts));
rts[0].source = NM_IP_CONFIG_SOURCE_USER;
rts[0].rt_source = NM_IP_CONFIG_SOURCE_USER;
rts[0].network = gateway;
rts[0].plen = 32;
rts[0].ifindex = ifindex;
@@ -186,7 +186,7 @@ test_ip4_route (void)
rts[0].metric = metric;
rts[0].mss = mss;
rts[0].scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK);
rts[1].source = NM_IP_CONFIG_SOURCE_USER;
rts[1].rt_source = NM_IP_CONFIG_SOURCE_USER;
rts[1].network = network;
rts[1].plen = plen;
rts[1].ifindex = ifindex;
@@ -194,7 +194,7 @@ test_ip4_route (void)
rts[1].metric = metric;
rts[1].mss = mss;
rts[1].scope_inv = nm_platform_route_scope_inv (RT_SCOPE_UNIVERSE);
rts[2].source = NM_IP_CONFIG_SOURCE_USER;
rts[2].rt_source = NM_IP_CONFIG_SOURCE_USER;
rts[2].network = 0;
rts[2].plen = 0;
rts[2].ifindex = ifindex;
@@ -265,21 +265,21 @@ test_ip6_route (void)
/* Test route listing */
routes = nm_platform_ip6_route_get_all (NM_PLATFORM_GET, ifindex, NM_PLATFORM_GET_ROUTE_FLAGS_WITH_DEFAULT | NM_PLATFORM_GET_ROUTE_FLAGS_WITH_NON_DEFAULT);
memset (rts, 0, sizeof (rts));
rts[0].source = NM_IP_CONFIG_SOURCE_USER;
rts[0].rt_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 = nm_utils_ip6_route_metric_normalize (metric);
rts[0].mss = mss;
rts[1].source = NM_IP_CONFIG_SOURCE_USER;
rts[1].rt_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 = nm_utils_ip6_route_metric_normalize (metric);
rts[1].mss = mss;
rts[2].source = NM_IP_CONFIG_SOURCE_USER;
rts[2].rt_source = NM_IP_CONFIG_SOURCE_USER;
rts[2].network = in6addr_any;
rts[2].plen = 0;
rts[2].ifindex = ifindex;

View File

@@ -482,7 +482,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
address.plen = u32;
if (address.address && address.plen && address.plen <= 32) {
address.source = NM_IP_CONFIG_SOURCE_PPP;
address.addr_source = NM_IP_CONFIG_SOURCE_PPP;
nm_ip4_config_add_address (config, &address);
} else {
_LOGE ("invalid IPv4 address received!");

View File

@@ -161,18 +161,18 @@ test_compare_with_source (void)
/* Address */
addr = *nmtst_platform_ip4_address ("1.2.3.4", NULL, 24);
addr.source = NM_IP_CONFIG_SOURCE_USER;
addr.addr_source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_address (a, &addr);
addr.source = NM_IP_CONFIG_SOURCE_VPN;
addr.addr_source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip4_config_add_address (b, &addr);
/* Route */
route = *nmtst_platform_ip4_route ("10.0.0.0", 8, "192.168.1.1");
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
nm_ip4_config_add_route (a, &route);
route.source = NM_IP_CONFIG_SOURCE_VPN;
route.rt_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 */
@@ -193,31 +193,31 @@ test_add_address_with_source (void)
/* Test that a higher priority source is not overwritten */
addr = *nmtst_platform_ip4_address ("1.2.3.4", NULL, 24);
addr.source = NM_IP_CONFIG_SOURCE_USER;
addr.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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_addr->addr_source, ==, NM_IP_CONFIG_SOURCE_USER);
addr.source = NM_IP_CONFIG_SOURCE_VPN;
addr.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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_addr->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_IP_CONFIG_SOURCE_KERNEL;
addr.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_IP_CONFIG_SOURCE_KERNEL);
g_assert_cmpint (test_addr->addr_source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
addr.source = NM_IP_CONFIG_SOURCE_USER;
addr.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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_addr->addr_source, ==, NM_IP_CONFIG_SOURCE_USER);
g_object_unref (a);
}
@@ -233,31 +233,31 @@ test_add_route_with_source (void)
/* Test that a higher priority source is not overwritten */
route = *nmtst_platform_ip4_route ("1.2.3.4", 24, "1.2.3.1");
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_route->rt_source, ==, NM_IP_CONFIG_SOURCE_USER);
route.source = NM_IP_CONFIG_SOURCE_VPN;
route.rt_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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_route->rt_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_IP_CONFIG_SOURCE_KERNEL;
route.rt_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_IP_CONFIG_SOURCE_KERNEL);
g_assert_cmpint (test_route->rt_source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_route->rt_source, ==, NM_IP_CONFIG_SOURCE_USER);
g_object_unref (a);
}

View File

@@ -132,18 +132,18 @@ test_compare_with_source (void)
/* Address */
addr = *nmtst_platform_ip6_address ("1122:3344:5566::7788", NULL, 64);
addr.source = NM_IP_CONFIG_SOURCE_USER;
addr.addr_source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_address (a, &addr);
addr.source = NM_IP_CONFIG_SOURCE_VPN;
addr.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_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
nm_ip6_config_add_route (a, &route);
route.source = NM_IP_CONFIG_SOURCE_VPN;
route.rt_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_IP_CONFIG_SOURCE_USER;
addr.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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_addr->addr_source, ==, NM_IP_CONFIG_SOURCE_USER);
addr.source = NM_IP_CONFIG_SOURCE_VPN;
addr.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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_addr->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_IP_CONFIG_SOURCE_KERNEL;
addr.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_IP_CONFIG_SOURCE_KERNEL);
g_assert_cmpint (test_addr->addr_source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
addr.source = NM_IP_CONFIG_SOURCE_USER;
addr.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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_addr->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_IP_CONFIG_SOURCE_USER;
route.rt_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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_route->rt_source, ==, NM_IP_CONFIG_SOURCE_USER);
route.source = NM_IP_CONFIG_SOURCE_VPN;
route.rt_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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_route->rt_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_IP_CONFIG_SOURCE_KERNEL;
route.rt_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_IP_CONFIG_SOURCE_KERNEL);
g_assert_cmpint (test_route->rt_source, ==, NM_IP_CONFIG_SOURCE_KERNEL);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_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_IP_CONFIG_SOURCE_USER);
g_assert_cmpint (test_route->rt_source, ==, NM_IP_CONFIG_SOURCE_USER);
g_object_unref (a);
}

View File

@@ -45,7 +45,7 @@ setup_dev0_ip4 (int ifindex, guint mss_of_first_route, guint32 metric_of_second_
route.ifindex = ifindex;
route.mss = 0;
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "6.6.6.0", &route.network);
route.plen = 24;
route.gateway = INADDR_ANY;
@@ -53,7 +53,7 @@ setup_dev0_ip4 (int ifindex, guint mss_of_first_route, guint32 metric_of_second_
route.mss = mss_of_first_route;
g_array_append_val (routes, route);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "7.0.0.0", &route.network);
route.plen = 8;
inet_pton (AF_INET, "6.6.6.1", &route.gateway);
@@ -87,21 +87,21 @@ setup_dev1_ip4 (int ifindex)
route.mss))
g_assert_not_reached ();
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "6.6.6.0", &route.network);
route.plen = 24;
route.gateway = INADDR_ANY;
route.metric = 20;
g_array_append_val (routes, route);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "7.0.0.0", &route.network);
route.plen = 8;
route.gateway = INADDR_ANY;
route.metric = 22;
g_array_append_val (routes, route);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "8.0.0.0", &route.network);
route.plen = 8;
inet_pton (AF_INET, "6.6.6.2", &route.gateway);
@@ -121,14 +121,14 @@ update_dev0_ip4 (int ifindex)
route.ifindex = ifindex;
route.mss = 0;
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "6.6.6.0", &route.network);
route.plen = 24;
route.gateway = INADDR_ANY;
route.metric = 20;
g_array_append_val (routes, route);
route.source = NM_IP_CONFIG_SOURCE_USER;
route.rt_source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "7.0.0.0", &route.network);
route.plen = 8;
route.gateway = INADDR_ANY;
@@ -163,7 +163,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
NMPlatformIP4Route state1[] = {
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("6.6.6.0"),
.plen = 24,
.ifindex = fixture->ifindex0,
@@ -173,7 +173,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("7.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex0,
@@ -183,7 +183,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_UNIVERSE),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("7.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex1,
@@ -193,7 +193,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("6.6.6.0"),
.plen = 24,
.ifindex = fixture->ifindex1,
@@ -203,7 +203,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("8.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex1,
@@ -216,7 +216,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
NMPlatformIP4Route state2[] = {
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("6.6.6.0"),
.plen = 24,
.ifindex = fixture->ifindex0,
@@ -226,7 +226,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("7.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex0,
@@ -236,7 +236,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("7.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex1,
@@ -246,7 +246,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("6.6.6.0"),
.plen = 24,
.ifindex = fixture->ifindex1,
@@ -256,7 +256,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("8.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex1,
@@ -269,7 +269,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
NMPlatformIP4Route state3[] = {
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("7.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex1,
@@ -279,7 +279,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("6.6.6.0"),
.plen = 24,
.ifindex = fixture->ifindex1,
@@ -289,7 +289,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_LINK),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("8.0.0.0"),
.plen = 8,
.ifindex = fixture->ifindex1,
@@ -299,7 +299,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.scope_inv = nm_platform_route_scope_inv (RT_SCOPE_UNIVERSE),
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = nmtst_inet4_from_string ("6.6.6.0"),
.plen = 24,
.ifindex = fixture->ifindex1,
@@ -542,7 +542,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
NMPlatformIP6Route state1[] = {
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:8086::"),
.plen = 48,
.ifindex = fixture->ifindex0,
@@ -551,7 +551,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:1337::"),
.plen = 48,
.ifindex = fixture->ifindex0,
@@ -560,7 +560,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:abad:c0de::"),
.plen = 64,
.ifindex = fixture->ifindex0,
@@ -569,7 +569,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:abad:c0de::"),
.plen = 64,
.ifindex = fixture->ifindex1,
@@ -578,7 +578,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:1337::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -587,7 +587,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:8086::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -596,7 +596,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:d34d::"),
.plen = 64,
.ifindex = fixture->ifindex1,
@@ -608,7 +608,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
NMPlatformIP6Route state2[] = {
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:8086::"),
.plen = 48,
.ifindex = fixture->ifindex0,
@@ -617,7 +617,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:1337::"),
.plen = 48,
.ifindex = fixture->ifindex0,
@@ -626,7 +626,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:abad:c0de::"),
.plen = 64,
.ifindex = fixture->ifindex0,
@@ -635,7 +635,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:abad:c0de::"),
.plen = 64,
.ifindex = fixture->ifindex1,
@@ -644,7 +644,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:1337::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -653,7 +653,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:8086::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -662,7 +662,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:d34d::"),
.plen = 64,
.ifindex = fixture->ifindex1,
@@ -674,7 +674,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
NMPlatformIP6Route state3[] = {
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:abad:c0de::"),
.plen = 64,
.ifindex = fixture->ifindex1,
@@ -683,7 +683,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:8086::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -692,7 +692,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:1337::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -701,7 +701,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:1337::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -710,7 +710,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:8086::"),
.plen = 48,
.ifindex = fixture->ifindex1,
@@ -719,7 +719,7 @@ test_ip6 (test_fixture *fixture, gconstpointer user_data)
.mss = 0,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
.rt_source = NM_IP_CONFIG_SOURCE_USER,
.network = *nmtst_inet6_from_string ("2001:db8:d34d::"),
.plen = 64,
.ifindex = fixture->ifindex1,

View File

@@ -680,7 +680,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_IP_CONFIG_SOURCE_VPN;
route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = route_metric;
nm_ip4_config_add_route (config, &route);
@@ -692,7 +692,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_IP_CONFIG_SOURCE_VPN;
route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = route_metric;
nm_ip4_config_add_route (config, &route);
@@ -732,7 +732,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_IP_CONFIG_SOURCE_VPN;
route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = route_metric;
nm_ip6_config_add_route (config, &route);
@@ -744,7 +744,7 @@ add_ip6_vpn_gateway_route (NMIP6Config *config,
memset (&route, 0, sizeof (route));
route.network = *parent_gw;
route.plen = 128;
route.source = NM_IP_CONFIG_SOURCE_VPN;
route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
route.metric = route_metric;
nm_ip6_config_add_route (config, &route);
@@ -1386,7 +1386,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
address.plen = u32;
if (address.address && address.plen && address.plen <= 32) {
address.source = NM_IP_CONFIG_SOURCE_VPN;
address.addr_source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip4_config_add_address (config, &address);
} else {
_LOGW ("invalid IP4 config received!");
@@ -1435,7 +1435,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
g_variant_get_child (v, 2, "u", &route.gateway);
/* 4th item is unused route metric */
route.metric = route_metric;
route.source = NM_IP_CONFIG_SOURCE_VPN;
route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
if (route.plen > 32)
break;
@@ -1523,7 +1523,7 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict)
address.plen = u32;
if (!IN6_IS_ADDR_UNSPECIFIED (&address.address) && address.plen && address.plen <= 128) {
address.source = NM_IP_CONFIG_SOURCE_VPN;
address.addr_source = NM_IP_CONFIG_SOURCE_VPN;
nm_ip6_config_add_address (config, &address);
} else {
_LOGW ("invalid IP6 config received!");
@@ -1575,7 +1575,7 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict)
route.plen = prefix;
ip6_addr_from_variant (next_hop, &route.gateway);
route.metric = route_metric;
route.source = NM_IP_CONFIG_SOURCE_VPN;
route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
/* Ignore host routes to the VPN gateway since NM adds one itself.
* Since NM knows more about the routing situation than the VPN