diff options
| author | Thomas Haller <thaller@redhat.com> | 2017-08-30 19:10:59 +0200 |
|---|---|---|
| committer | Thomas Haller <thaller@redhat.com> | 2017-09-08 11:05:04 +0200 |
| commit | c16e8718880b18fcaa8d2e4bf3b4ee98ee995768 (patch) | |
| tree | f856b3e2e1d6ee0c225642aa9031e4c23ad7f189 /src/nm-core-utils.h | |
| parent | 6801cd65bf5b429d7295f335605742b92642c508 (diff) | |
| download | NetworkManager-c16e8718880b18fcaa8d2e4bf3b4ee98ee995768.tar.gz | |
core: nm_utils_ip_route_metric_normalize() util
Functions that take and addr_family argument are just nicer
to use at places where we treat IPv4 and IPv6 generically.
Diffstat (limited to 'src/nm-core-utils.h')
| -rw-r--r-- | src/nm-core-utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index 42afcb0e2d..f9545653de 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -174,6 +174,12 @@ nm_utils_ip6_route_metric_normalize (guint32 metric) return metric ? metric : 1024 /*NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6*/; } +static inline guint32 +nm_utils_ip_route_metric_normalize (int addr_family, guint32 metric) +{ + return addr_family == AF_INET6 ? nm_utils_ip6_route_metric_normalize (metric) : metric; +} + int nm_utils_modprobe (GError **error, gboolean suppress_error_loggin, const char *arg1, ...) G_GNUC_NULL_TERMINATED; guint64 nm_utils_get_start_time_for_pid (pid_t pid, char *out_state, pid_t *out_ppid); |
