mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-18 15:42:15 +00:00
platform: detect kernel support for FRA_IP_PROTO, FRA_SPORT_RANGE, FRA_DPORT_RANGE
This commit is contained in:
parent
cd62d43963
commit
91252bb2fb
|
@ -3431,6 +3431,18 @@ _new_from_nl_routing_rule (struct nlmsghdr *nlh, gboolean id_only)
|
|||
nla_memcpy_checked_size (&props->sport_range, tb[FRA_SPORT_RANGE], sizeof (props->sport_range));
|
||||
nla_memcpy_checked_size (&props->dport_range, tb[FRA_DPORT_RANGE], sizeof (props->dport_range));
|
||||
|
||||
if (!_nm_platform_kernel_support_detected (NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_IP_PROTO)) {
|
||||
/* support for FRA_IP_PROTO, FRA_SPORT_RANGE, and FRA_DPORT_RANGE was added together
|
||||
* by bfff4862653bb96001ab57c1edd6d03f48e5f035, kernel 4.17, 4 June 2018.
|
||||
*
|
||||
* Unfortunately, a missing attribute does not tell us anything about support.
|
||||
* We can only tell for sure when we have support, but not when we don't have. */
|
||||
if ( tb[FRA_IP_PROTO]
|
||||
|| tb[FRA_SPORT_RANGE]
|
||||
|| tb[FRA_DPORT_RANGE])
|
||||
_nm_platform_kernel_support_init (NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_IP_PROTO, 1);
|
||||
}
|
||||
|
||||
G_STATIC_ASSERT_EXPR (sizeof (NMFibRuleUidRange) == 8);
|
||||
G_STATIC_ASSERT_EXPR (G_STRUCT_OFFSET (NMFibRuleUidRange, start) == 0);
|
||||
G_STATIC_ASSERT_EXPR (G_STRUCT_OFFSET (NMFibRuleUidRange, end) == 4);
|
||||
|
|
|
@ -301,6 +301,11 @@ static const struct {
|
|||
.name = "FRA_PROTOCOL",
|
||||
.desc = "FRA_PROTOCOL attribute for policy routing rules",
|
||||
},
|
||||
[NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_IP_PROTO] = {
|
||||
.compile_time_default = (FRA_MAX >= 22 /* FRA_IP_PROTO */),
|
||||
.name = "FRA_IP_PROTO",
|
||||
.desc = "FRA_IP_PROTO, FRA_SPORT_RANGE, FRA_DPORT_RANGE attributes for policy routing rules",
|
||||
},
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -849,6 +849,11 @@ typedef enum {
|
|||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_USER_IPV6LL,
|
||||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF,
|
||||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL,
|
||||
|
||||
/* this also includes FRA_SPORT_RANGE and FRA_DPORT_RANGE which
|
||||
* were added at the same time. */
|
||||
NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_IP_PROTO,
|
||||
|
||||
_NM_PLATFORM_KERNEL_SUPPORT_NUM,
|
||||
} NMPlatformKernelSupportType;
|
||||
|
||||
|
|
Loading…
Reference in a new issue