30 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03 4# Check FDB default-remote handling across "ip link set".5 6check_remotes()7{8 local what=$1; shift9 local N=$(bridge fdb sh dev vx | grep 00:00:00:00:00:00 | wc -l)10 11 echo -ne "expected two remotes after $what\t"12 if [[ $N != 2 ]]; then13 echo "[FAIL]"14 EXIT_STATUS=115 else16 echo "[ OK ]"17 fi18}19 20ip link add name vx up type vxlan id 2000 dstport 478921bridge fdb ap dev vx 00:00:00:00:00:00 dst 192.0.2.20 self permanent22bridge fdb ap dev vx 00:00:00:00:00:00 dst 192.0.2.30 self permanent23check_remotes "fdb append"24 25ip link set dev vx type vxlan remote 192.0.2.3026check_remotes "link set"27 28ip link del dev vx29exit $EXIT_STATUS30