1#!/usr/bin/env bash 2# SPDX-License-Identifier: LGPL-2.1-or-later 3set -ex 4set -o pipefail 5 6setup() { 7 systemd-analyze log-level debug 8 systemd-analyze log-target console 9 10 for i in {0..3}; 11 do 12 ip netns del "ns${i}" || true 13 ip link del "veth${i}" || true 14 ip netns add "ns${i}" 15 ip link add "veth${i}" type veth peer name "veth${i}_" 16 ip link set "veth${i}_" netns "ns${i}" 17 ip -n "ns${i}" link set dev "veth${i}_" up 18 ip -n "ns${i}" link set dev lo up 19 ip -n "ns${i}" addr add "192.168.113."$((4*i+1))/30 dev "veth${i}_" 20 ip link set dev "veth${i}" up 21 ip addr add "192.168.113."$((4*i+2))/30 dev "veth${i}" 22 done 23} 24 25teardown() { 26 set +e 27 28 for i in {0..3}; 29 do 30 ip netns del "ns${i}" 31 ip link del "veth${i}" 32 done 33 34 systemd-analyze log-level info 35} 36 37KERNEL_VERSION="$(uname -r)" 38KERNEL_MAJOR="${KERNEL_VERSION%%.*}" 39KERNEL_MINOR="${KERNEL_VERSION#"$KERNEL_MAJOR".}" 40KERNEL_MINOR="${KERNEL_MINOR%%.*}" 41 42MAJOR_REQUIRED=5 43MINOR_REQUIRED=7 44 45if [[ "$KERNEL_MAJOR" -lt $MAJOR_REQUIRED || ("$KERNEL_MAJOR" -eq $MAJOR_REQUIRED && "$KERNEL_MINOR" -lt $MINOR_REQUIRED) ]]; then 46 echo "kernel is not 5.7+" >>/skipped 47 exit 0 48fi 49 50if systemctl --version | grep -q -F -- "-BPF_FRAMEWORK"; then 51 echo "bpf-framework is disabled" >>/skipped 52 exit 0 53fi 54 55trap teardown EXIT 56setup 57 58systemctl start --wait testsuite-62-1.service 59systemctl start --wait testsuite-62-2.service 60systemctl start --wait testsuite-62-3.service 61systemctl start --wait testsuite-62-4.service 62systemctl start --wait testsuite-62-5.service 63 64echo OK > /testok 65 66exit 0 67