diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-17 09:07:00 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-04-18 11:11:44 +0200 |
commit | cd62d43963647451d2a152e2c4cbf79e243d1123 (patch) | |
tree | 95a5c90d271a51bb86169afde16b338895132493 | |
parent | ee269b318ef7f2cedfdb2e62af89fab7218edfba (diff) | |
download | NetworkManager-cd62d43963647451d2a152e2c4cbf79e243d1123.tar.gz |
platform: detect kernel support for FRA_PROTOCOL
-rw-r--r-- | src/platform/nm-linux-platform.c | 7 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 5 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 0e84f99f4c..662f3d7046 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3414,6 +3414,13 @@ _new_from_nl_routing_rule (struct nlmsghdr *nlh, gboolean id_only) else nm_assert (props->protocol == RTPROT_UNSPEC); + if (!_nm_platform_kernel_support_detected (NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL)) { + /* FRA_PROTOCOL was added in kernel 4.17, dated 3 June, 2018. + * See commit 1b71af6053af1bd2f849e9fda4f71c1e3f145dcf. */ + _nm_platform_kernel_support_init (NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL, + tb[FRA_PROTOCOL] ? 1 : -1); + } + if (tb[FRA_IP_PROTO]) props->ip_proto = nla_get_u8 (tb[FRA_IP_PROTO]); diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 88f2b0decf..b5636d60d5 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -296,6 +296,11 @@ static const struct { .name = "RTA_PREF", .desc = "ability to set router preference for IPv6 routes", }, + [NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL] = { + .compile_time_default = (FRA_MAX >= 21 /* FRA_PROTOCOL */), + .name = "FRA_PROTOCOL", + .desc = "FRA_PROTOCOL attribute for policy routing rules", + }, }; int diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index d5a7a2d182..1d5b18402a 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -848,6 +848,7 @@ typedef enum { NM_PLATFORM_KERNEL_SUPPORT_TYPE_EXTENDED_IFA_FLAGS, NM_PLATFORM_KERNEL_SUPPORT_TYPE_USER_IPV6LL, NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF, + NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL, _NM_PLATFORM_KERNEL_SUPPORT_NUM, } NMPlatformKernelSupportType; |