|
3 | 3 |
|
4 | 4 | ALL_TESTS="
|
5 | 5 | test_set_remote
|
| 6 | + test_change_mc_remote |
6 | 7 | "
|
7 | 8 | source lib.sh
|
8 | 9 |
|
@@ -31,6 +32,81 @@ test_set_remote()
|
31 | 32 | log_test 'FDB default-remote handling across "ip link set"'
|
32 | 33 | }
|
33 | 34 |
|
| 35 | +fmt_remote() |
| 36 | +{ |
| 37 | + local addr=$1; shift |
| 38 | + |
| 39 | + if [[ $addr == 224.* ]]; then |
| 40 | + echo "group $addr" |
| 41 | + else |
| 42 | + echo "remote $addr" |
| 43 | + fi |
| 44 | +} |
| 45 | + |
| 46 | +change_remote() |
| 47 | +{ |
| 48 | + local remote=$1; shift |
| 49 | + |
| 50 | + ip link set dev vx type vxlan $(fmt_remote $remote) dev v1 |
| 51 | +} |
| 52 | + |
| 53 | +check_membership() |
| 54 | +{ |
| 55 | + local check_vec=("$@") |
| 56 | + |
| 57 | + local memberships |
| 58 | + memberships=$( |
| 59 | + netstat -n --groups | |
| 60 | + sed -n '/^v1\b/p' | |
| 61 | + grep -o '[^ ]*$' |
| 62 | + ) |
| 63 | + check_err $? "Couldn't obtain group memberships" |
| 64 | + |
| 65 | + local item |
| 66 | + for item in "${check_vec[@]}"; do |
| 67 | + eval "local $item" |
| 68 | + echo "$memberships" | grep -q "\b$group\b" |
| 69 | + check_err_fail $fail $? "$group is_ex reported in IGMP query response" |
| 70 | + done |
| 71 | +} |
| 72 | + |
| 73 | +test_change_mc_remote() |
| 74 | +{ |
| 75 | + check_command netstat || return |
| 76 | + |
| 77 | + ip_link_add v1 up type veth peer name v2 |
| 78 | + ip_link_set_up v2 |
| 79 | + |
| 80 | + RET=0 |
| 81 | + |
| 82 | + ip_link_add vx up type vxlan dstport 4789 \ |
| 83 | + local 192.0.2.1 $(fmt_remote 224.1.1.1) dev v1 vni 1000 |
| 84 | + |
| 85 | + check_membership "group=224.1.1.1 fail=0" \ |
| 86 | + "group=224.1.1.2 fail=1" \ |
| 87 | + "group=224.1.1.3 fail=1" |
| 88 | + |
| 89 | + log_test "MC group report after VXLAN creation" |
| 90 | + |
| 91 | + RET=0 |
| 92 | + |
| 93 | + change_remote 224.1.1.2 |
| 94 | + check_membership "group=224.1.1.1 fail=1" \ |
| 95 | + "group=224.1.1.2 fail=0" \ |
| 96 | + "group=224.1.1.3 fail=1" |
| 97 | + |
| 98 | + log_test "MC group report after changing VXLAN remote MC->MC" |
| 99 | + |
| 100 | + RET=0 |
| 101 | + |
| 102 | + change_remote 192.0.2.2 |
| 103 | + check_membership "group=224.1.1.1 fail=1" \ |
| 104 | + "group=224.1.1.2 fail=1" \ |
| 105 | + "group=224.1.1.3 fail=1" |
| 106 | + |
| 107 | + log_test "MC group report after changing VXLAN remote MC->UC" |
| 108 | +} |
| 109 | + |
34 | 110 | trap defer_scopes_cleanup EXIT
|
35 | 111 |
|
36 | 112 | tests_run
|
|
0 commit comments