| .. | .. |
|---|
| 20 | 20 | tc filter del dev $swp1 $direction pref 1000 |
|---|
| 21 | 21 | } |
|---|
| 22 | 22 | |
|---|
| 23 | +is_ipv6() |
|---|
| 24 | +{ |
|---|
| 25 | + local addr=$1; shift |
|---|
| 26 | + |
|---|
| 27 | + [[ -z ${addr//[0-9a-fA-F:]/} ]] |
|---|
| 28 | +} |
|---|
| 29 | + |
|---|
| 23 | 30 | mirror_test() |
|---|
| 24 | 31 | { |
|---|
| 25 | 32 | local vrf_name=$1; shift |
|---|
| .. | .. |
|---|
| 29 | 36 | local pref=$1; shift |
|---|
| 30 | 37 | local expect=$1; shift |
|---|
| 31 | 38 | |
|---|
| 39 | + if is_ipv6 $dip; then |
|---|
| 40 | + local proto=-6 |
|---|
| 41 | + local type="icmp6 type=128" # Echo request. |
|---|
| 42 | + else |
|---|
| 43 | + local proto= |
|---|
| 44 | + local type="icmp echoreq" |
|---|
| 45 | + fi |
|---|
| 46 | + |
|---|
| 32 | 47 | local t0=$(tc_rule_stats_get $dev $pref) |
|---|
| 33 | | - ip vrf exec $vrf_name \ |
|---|
| 34 | | - ${PING} ${sip:+-I $sip} $dip -c 10 -i 0.1 -w 2 &> /dev/null |
|---|
| 48 | + $MZ $proto $vrf_name ${sip:+-A $sip} -B $dip -a own -b bc -q \ |
|---|
| 49 | + -c 10 -d 100msec -t $type |
|---|
| 50 | + sleep 0.5 |
|---|
| 35 | 51 | local t1=$(tc_rule_stats_get $dev $pref) |
|---|
| 36 | 52 | local delta=$((t1 - t0)) |
|---|
| 37 | 53 | # Tolerate a couple stray extra packets. |
|---|