core: rename NM_PLATFORM_ROUTE_METRIC_DEFAULT to NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6
For IPv4, iproute for example defaults to a metric of 0. Hence, the name NM_PLATFORM_ROUTE_METRIC_DEFAULT was misleading. Also add a NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP4 define for completeness. https://bugzilla.gnome.org/show_bug.cgi?id=740780
This commit is contained in:
@@ -39,14 +39,14 @@ const struct in6_addr *nm_utils_ip6_address_clear_host_address (struct in6_addr
|
|||||||
* @metric: the route metric
|
* @metric: the route metric
|
||||||
*
|
*
|
||||||
* For IPv6 route, kernel treats the value 0 as IP6_RT_PRIO_USER (1024).
|
* For IPv6 route, kernel treats the value 0 as IP6_RT_PRIO_USER (1024).
|
||||||
* Thus, when comparing metric (values), we want to treat zero as NM_PLATFORM_ROUTE_METRIC_DEFAULT.
|
* Thus, when comparing metric (values), we want to treat zero as NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6.
|
||||||
*
|
*
|
||||||
* Returns: @metric, if @metric is not zero, otherwise 1024.
|
* Returns: @metric, if @metric is not zero, otherwise 1024.
|
||||||
*/
|
*/
|
||||||
static inline guint32
|
static inline guint32
|
||||||
nm_utils_ip6_route_metric_normalize (guint32 metric)
|
nm_utils_ip6_route_metric_normalize (guint32 metric)
|
||||||
{
|
{
|
||||||
return metric ? metric : 1024 /*NM_PLATFORM_ROUTE_METRIC_DEFAULT*/;
|
return metric ? metric : 1024 /*NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nm_spawn_process (const char *args);
|
int nm_spawn_process (const char *args);
|
||||||
|
@@ -669,7 +669,7 @@ nm_device_get_priority (NMDevice *self)
|
|||||||
*
|
*
|
||||||
* For comparison, note that iproute2 by default adds IPv4 routes with
|
* For comparison, note that iproute2 by default adds IPv4 routes with
|
||||||
* metric 0, and IPv6 routes with metric 1024. The latter is the IPv6
|
* metric 0, and IPv6 routes with metric 1024. The latter is the IPv6
|
||||||
* "user default" in the kernel (NM_PLATFORM_ROUTE_METRIC_DEFAULT).
|
* "user default" in the kernel (NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6).
|
||||||
* In kernel, the full uint32_t range is available for route
|
* In kernel, the full uint32_t range is available for route
|
||||||
* metrics (except for IPv6, where 0 means 1024).
|
* metrics (except for IPv6, where 0 means 1024).
|
||||||
*/
|
*/
|
||||||
|
@@ -184,9 +184,15 @@ typedef union {
|
|||||||
#undef __NMPlatformIPAddress_COMMON
|
#undef __NMPlatformIPAddress_COMMON
|
||||||
|
|
||||||
|
|
||||||
/* Adding an IPv6 route with metric 0, kernel translates to IP6_RT_PRIO_USER (1024).
|
/* Default value for adding an IPv4 route. This is also what iproute2 does.
|
||||||
* Thus, the value is not choosen arbitraily, but matches kernel IPv6 default. */
|
* Note that contrary to IPv6, you can add routes with metric 0 and it is even
|
||||||
#define NM_PLATFORM_ROUTE_METRIC_DEFAULT 1024
|
* the default.
|
||||||
|
*/
|
||||||
|
#define NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP4 0
|
||||||
|
|
||||||
|
/* Default value for adding an IPv6 route. This is also what iproute2 does.
|
||||||
|
* Adding an IPv6 route with metric 0, kernel translates to IP6_RT_PRIO_USER (1024). */
|
||||||
|
#define NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6 1024
|
||||||
|
|
||||||
/* For IPv4, kernel adds a device route (subnet routes) with metric 0 when user
|
/* For IPv4, kernel adds a device route (subnet routes) with metric 0 when user
|
||||||
* configures addresses. */
|
* configures addresses. */
|
||||||
|
Reference in New Issue
Block a user