diff --git a/script/check-config.sh b/script/check-config.sh index 642ff33a1..c749c6015 100755 --- a/script/check-config.sh +++ b/script/check-config.sh @@ -29,9 +29,19 @@ kernelMajor="${kernelVersion%%.*}" kernelMinor="${kernelVersion#"$kernelMajor".}" kernelMinor="${kernelMinor%%.*}" +# Usage: to check if kernel version is < 4.8, use +# kernel_lt 4 8 +# (here "lt" stands for "less than"). kernel_lt() { [ "$kernelMajor" -lt "$1" ] && return - [ "$kernelMajor" -eq "$1" ] && [ "$kernelMinor" -le "$2" ] + [ "$kernelMajor" -eq "$1" ] && [ "$kernelMinor" -lt "$2" ] +} + +# Usage: to check if kernel version is >= 6.1, use +# kernel_ge 6 1 +# (here "ge" stands for "greater or equal"). +kernel_ge() { + ! kernel_lt "$1" "$2" } is_set() { @@ -234,16 +244,17 @@ flags=( ) check_flags "${flags[@]}" -if ! kernel_lt 4 14; then - if [ $cgroup = "v2" ]; then - check_flags CGROUP_BPF - fi +# Linux kernel commit 3007098494be. +if kernel_ge 4 10 && [ $cgroup = "v2" ]; then + check_flags CGROUP_BPF fi +# Linux kernel commit 3bf195ae6037. if kernel_lt 5 1; then check_flags NF_NAT_IPV4 fi +# Linux kernel commit 4806e975729f99c7. if kernel_lt 5 2; then check_flags NF_NAT_NEEDED fi @@ -259,9 +270,11 @@ echo 'Optional Features:' check_flags SECCOMP_FILTER check_flags CGROUP_PIDS + # Linux kernel commit e55b9f96860f. if kernel_lt 6 1; then check_flags MEMCG_SWAP fi + # Linux kernel commit 2d1c498072de. if kernel_lt 5 8; then check_flags MEMCG_SWAP_ENABLED if is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then @@ -270,20 +283,24 @@ echo 'Optional Features:' fi } +# Linux kernel commit d886f4e483ce. if kernel_lt 4 5; then check_flags MEMCG_KMEM fi -if kernel_lt 3 18; then +# Linux kernel commit 5b1efc027c0b. +if kernel_lt 3 19; then check_flags RESOURCE_COUNTERS fi -if kernel_lt 3 13; then +# Linux kernel commit 86f8515f9721. +if kernel_lt 3 14; then netprio=NETPRIO_CGROUP else netprio=CGROUP_NET_PRIO fi +# Linux kernel commit f382fb0bcef4. if kernel_lt 5 0; then check_flags IOSCHED_CFQ CFQ_GROUP_IOSCHED fi