platform: detect kernel support for FRA_PROTOCOL

(cherry picked from commit cd62d43963)
This commit is contained in:
Thomas Haller 2019-04-17 09:07:00 +02:00
parent bf36fa11d2
commit 6bfce3587e
3 changed files with 13 additions and 0 deletions

View file

@ -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]);

View file

@ -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

View file

@ -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;