platform: detect kernel support for FRA_L3MDEV

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

View File

@@ -3402,6 +3402,16 @@ _new_from_nl_routing_rule (struct nlmsghdr *nlh, gboolean id_only)
props->tun_id = nla_get_be64 (tb[FRA_TUN_ID]);
if (tb[FRA_L3MDEV]) {
if (!_nm_platform_kernel_support_detected (NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_L3MDEV)) {
/* support for FRA_L3MDEV was added in 96c63fa7393d0a346acfe5a91e0c7d4c7782641b,
* kernel 4.8, 3 October 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_L3MDEV, 1);
}
/* actually, kernel only allows this attribute to be missing or
* "1". Still, encode it as full uint8.
*

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_L3MDEV] = {
.compile_time_default = (FRA_MAX >= 19 /* FRA_L3MDEV */),
.name = "FRA_L3MDEV",
.desc = "FRA_L3MDEV attribute for policy routing rules",
},
[NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_UID_RANGE] = {
.compile_time_default = (FRA_MAX >= 20 /* FRA_UID_RANGE */),
.name = "FRA_UID_RANGE",

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_L3MDEV,
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_UID_RANGE,
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL,