diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-27 17:08:17 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-27 17:09:21 +0200 |
| commit | c75fd9f7edaeaec5bc520b1e73afa83063cdc279 (patch) | |
| tree | cb044da62877cf9e3536a4d4e377cd3f20721ca8 /src/nm-core-utils.h | |
| parent | 68b70c827c50c51b5361c3cdd1764ff569b85d94 (diff) | |
| parent | f86436e83639986f20fb44663edcccf36c3c150c (diff) | |
Merge remote-tracking branch 'salsa/debian/master' into ubuntu/master
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; |