platform: detect kernel support for FRA_UID_RANGE

This commit is contained in:
Thomas Haller
2019-04-17 10:43:42 +02:00
parent 91252bb2fb
commit 1dd1dcb81e
3 changed files with 16 additions and 0 deletions

View File

@@ -3448,6 +3448,16 @@ _new_from_nl_routing_rule (struct nlmsghdr *nlh, gboolean id_only)
G_STATIC_ASSERT_EXPR (G_STRUCT_OFFSET (NMFibRuleUidRange, end) == 4);
if (tb[FRA_UID_RANGE]) {
if (!_nm_platform_kernel_support_detected (NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_UID_RANGE)) {
/* support for FRA_UID_RANGE was added in 622ec2c9d52405973c9f1ca5116eb1c393adfc7d,
* kernel 4.10, 19 February 2017.
*
* We can only detect support if the attribute is present. A missing attribute
* is not conclusive. */
_nm_platform_kernel_support_init (NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_UID_RANGE, 1);
}
nla_memcpy_checked_size (&props->uid_range, tb[FRA_UID_RANGE], sizeof (props->uid_range));
props->uid_range_has = TRUE;
}

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_UID_RANGE] = {
.compile_time_default = (FRA_MAX >= 20 /* FRA_UID_RANGE */),
.name = "FRA_UID_RANGE",
.desc = "FRA_UID_RANGE attribute for policy routing rules",
},
[NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL] = {
.compile_time_default = (FRA_MAX >= 21 /* FRA_PROTOCOL */),
.name = "FRA_PROTOCOL",

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_UID_RANGE,
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL,
/* this also includes FRA_SPORT_RANGE and FRA_DPORT_RANGE which