diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-27 17:03:33 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-27 17:03:33 +0200 |
| commit | b92fc658301eb82b80167a31179c9b839f151b18 (patch) | |
| tree | 26e2203952eef4ee60e58c6904755e5508150a26 /src/nm-core-utils.h | |
| parent | 486e0bef719d78ee55d2166b0bfb4fa684c09854 (diff) | |
| parent | 136d191f1c96dbae1489fed7c2565f5e1b1f8d40 (diff) | |
Merge branch 'upstream/latest' of https://salsa.debian.org/utopia-team/network-manager into upstream/latest
Diffstat (limited to 'src/nm-core-utils.h')
| -rw-r--r-- | src/nm-core-utils.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index fae7adbf..55792d57 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -156,8 +156,13 @@ double nm_utils_exp10 (gint16 e); * nm_utils_ip6_route_metric_normalize: * @metric: the route metric * - * 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_IP6. + * For IPv6 route, when adding a route via netlink, kernel treats the value 0 as IP6_RT_PRIO_USER (1024). + * So, user space cannot add routes with such a metric, and 0 gets "normalized" + * to NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6. + * + * Note that kernel itself can add IPv6 routes with metric zero. Also, you can delete + * them, but mostly because with `ip -6 route delete ... metric 0` the 0 acts as a wildcard + * and kills the first matching route. * * Returns: @metric, if @metric is not zero, otherwise 1024. */ @@ -174,9 +179,8 @@ nm_utils_ip_route_metric_normalize (int addr_family, guint32 metric) } static inline guint32 -nm_utils_ip_route_metric_penalize (int addr_family, guint32 metric, guint32 penalty) +nm_utils_ip_route_metric_penalize (guint32 metric, guint32 penalty) { - metric = nm_utils_ip_route_metric_normalize (addr_family, metric); if (metric < G_MAXUINT32 - penalty) return metric + penalty; return G_MAXUINT32; |