Lines Matching +full:g +full:- +full:link

2 # SPDX-License-Identifier: GPL-2.0
7 declare -A NETIFS=(
42 # Constants for netdevice bring-up:
46 # Like INTERFACE_TIMEOUT, but default for ad-hoc waiting in testing scripts.
83 # Whether the machine is "slow" -- i.e. might be incapable of running tests
85 # e.g. a low-power board.
89 # Find netifs by test-specified driver name
96 if [[ -L $driver_path ]]; then
103 local ifnames=`ip -j link show | jq -r ".[].ifname"`
109 if [[ ! -z $driver_name && $driver_name == $NETIF_FIND_DRIVER ]]; then
121 declare -A NETIFS
125 net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
127 if [[ -f $net_forwarding_dir/forwarding.config ]]; then
138 tc -j &> /dev/null
139 if [[ $? -ne 0 ]]; then
151 if [[ $? -ne 0 ]]; then
166 if [[ $? -ne 0 ]]; then
184 if [[ $? -ne 0 ]]; then
185 echo "SKIP: iproute2 too old; tc-flower is missing extended MPLS support"
189 tc -j filter show dev $dev ingress protocol mpls_uc | jq . &> /dev/null
194 if [[ $ret -ne 0 ]]; then
195 echo "SKIP: iproute2 too old; tc-flower produces invalid json output for extended MPLS filters"
203 if [[ $? -ne 0 ]]; then
212 if [[ $? -ne 0 ]]; then
220 tc actions help 2>&1 | grep -q hw_stats
221 if [[ $? -ne 0 ]]; then
229 tc qdisc add dev lo mqprio help 2>&1 | grep -q "fp "
230 if [[ $? -ne 0 ]]; then
238 ethtool --help 2>&1| grep lanes &> /dev/null
239 if [[ $? -ne 0 ]]; then
247 ethtool --help 2>&1| grep -- '--show-mm' &> /dev/null
248 if [[ $? -ne 0 ]]; then
256 ethtool --help 2>&1| grep -- '--all-groups' &> /dev/null
257 if [[ $? -ne 0 ]]; then
268 [ 0 -ne $(ethtool --json -S $dev --all-groups --src pmac 2>/dev/null \
274 if ! bridge -d link show | grep -q " locked"; then
282 if ! bridge -d link show | grep -q "mab"; then
288 if [[ "$(id -u)" -ne 0 ]]; then
312 local version="$(msend -v)"
316 major=$(echo $version | cut -d. -f1)
318 if [ $major -lt 3 ]; then
345 while [[ $# -gt 0 ]]; do
346 if [[ "$count" -eq "0" ]]; then
348 declare -A NETIFS
358 if [[ ! -v NUM_NETIFS ]]; then
382 if [ -z ${NETIFS[p$i]} ]; then
387 ip link show dev ${NETIFS[p$i]} &> /dev/null
388 if [[ $? -ne 0 ]]; then
389 ip link add ${NETIFS[p$i]} type veth \
391 if [[ $? -ne 0 ]]; then
411 declare -A MAC_ADDR_ORIG
421 MAC_ADDR_ORIG["$dev"]=$(ip -j link show dev $dev | jq -e '.[].address')
424 ip link set dev $dev address $new_addr
434 ip link set dev $dev address ${MAC_ADDR_ORIG["$dev"]}
447 ip link show dev ${NETIFS[p$i]} &> /dev/null
448 if [[ $? -ne 0 ]]; then
469 if [[ $cur -gt $max ]]; then
485 if [ "$1" == "-v" ]; then
495 "$@" | grep -q "Link detected: yes"
500 "$@" | grep -q offload
505 "$@" | grep -q trap
511 local wait_time=${1:-$WAIT_TIME}; shift
525 local max_iterations=${1:-$WAIT_TIMEOUT}; shift
526 local wait_time=${1:-$WAIT_TIME}; shift
530 ip link show dev $dev up \
532 if [[ $? -ne 0 ]]; then
564 local timeout=${1:-$WAIT_TIMEOUT}; shift
566 slowwait $timeout ip link show dev $dev &> /dev/null
588 ip -4 rule add pref 32765 table local
589 ip -4 rule del pref 0
590 ip -6 rule add pref 32765 table local
591 ip -6 rule del pref 0
596 ip -6 rule add pref 0 table local
597 ip -6 rule del pref 32765
598 ip -4 rule add pref 0 table local
599 ip -4 rule del pref 32765
609 declare -A __TB_IDS
635 ip link add dev $vrf_name type vrf table $tb_id
636 ip -4 route add table $tb_id unreachable default metric 4278198272
637 ip -6 route add table $tb_id unreachable default metric 4278198272
648 ip -6 route del table $tb_id unreachable default metric 4278198272
649 ip -4 route del table $tb_id unreachable default metric 4278198272
650 ip link del dev $vrf_name
674 ip link set dev $if_name master $vrf_name
675 ip link set dev $if_name up
687 ip link set dev $if_name down
688 ip link set dev $if_name nomaster
702 ip link set dev $vrf_name up
733 ip link add name $name type $type \
735 ip link set dev $name up
742 ip link del dev $name
753 ip link add name $name link $if_name type vlan id $vid
755 ip link set dev $name master $vrf
757 ip link set dev $name up
767 ip link del dev $name
776 $TEAMD -t $if_name -d -c '{"runner": {"name": "'$mode'"}}'
778 ip link set dev $slave down
779 ip link set dev $slave master $if_name
780 ip link set dev $slave up
782 ip link set dev $if_name up
789 $TEAMD -t $if_name -k
796 ip -j link show dev $if_name | jq -r '.[]["master"]'
805 ip -j -s link show dev $if_name \
824 ethtool -S $dev | grep "^ *$stat:" | head -n 1 | cut -d: -f2
834 ethtool --json -S $dev --groups $grp -- --src $src | \
844 tc -j -s qdisc show dev "$dev" \
854 tc -j -s qdisc show dev "$dev" invisible \
863 cat /proc/net/dev_snmp6/$dev | grep "^$stat" | cut -f2
873 ip -j stats show dev $if_name group offload subgroup $suite |
883 ip -j -s -s nexthop show id $group_id |
884 jq --argjson member_id "$member_id" --arg key "$key" \
925 echo $((8 * (t1 - t0) / interval))
934 echo $(((t1 - t0) / interval))
961 for ((i = 40; i >= 0; i -= 8)); do
964 if [ $i -ne 0 ]; then
974 ip -j addr show dev $if_name | \
975 jq -r '.[]["addr_info"][] | select(.scope == "link").local' | \
976 head -1
985 ageing_time=$(ip -j -d link show dev $bridge \
990 declare -A SYSCTL_ORIG
995 SYSCTL_ORIG[$key]=$(sysctl -n $key)
1004 sysctl -qw $key="$value"
1011 sysctl -qw $key="${SYSCTL_ORIG[$key]}"
1032 declare -A MTU_ORIG
1038 MTU_ORIG["$dev"]=$(ip -j link show dev $dev | jq -e '.[].mtu')
1039 ip link set dev $dev mtu $mtu
1046 ip link set dev $dev mtu ${MTU_ORIG["$dev"]}
1051 local num_netifs=${1:-$NUM_NETIFS}
1054 ethtool -k ${NETIFS[p$i]} \
1055 | grep "hw-tc-offload: on" &> /dev/null
1056 if [[ $? -ne 0 ]]; then
1069 # Some devices may not support or need in-hardware trapping of traffic
1070 # (e.g. the veth pairs that this library creates for non-existent
1233 if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then
1235 | bc -l)
1238 | bc -l)
1241 if [[ "$packets_rp12" -eq "0" || "$packets_rp13" -eq "0" ]]; then
1248 if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then
1250 | bc -l)
1253 | bc -l)
1256 diff=$(echo $weights_ratio - $packets_ratio | bc -l)
1257 diff=${diff#-}
1259 test "$(echo "$diff / $weights_ratio > 0.15" | bc -l)" -eq 0
1269 ip netns exec $name bash <<-EOF
1288 $PING $args -c $PING_COUNT -i 0.1 \
1289 -w $PING_TIMEOUT $dip &> /dev/null
1319 $PING6 $args -c $PING_COUNT -i 0.1 \
1320 -w $PING_TIMEOUT $dip &> /dev/null
1352 bridge -j fdb show br $bridge brport $br_port1 \
1353 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1359 bridge link set dev $br_port1 flood off
1361 ip link set $host1_if promisc on
1366 $MZ $host2_if -c 1 -p 64 -b $mac -t ip -q
1369 tc -j -s filter show dev $host1_if ingress \
1370 | jq -e ".[] | select(.options.handle == 101) \
1374 $MZ $host1_if -c 1 -p 64 -a $mac -t ip -q
1377 bridge -j fdb show br $bridge brport $br_port1 \
1378 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1381 $MZ $host2_if -c 1 -p 64 -b $mac -t ip -q
1384 tc -j -s filter show dev $host1_if ingress \
1385 | jq -e ".[] | select(.options.handle == 101) \
1390 # record was aged-out.
1394 bridge -j fdb show br $bridge brport $br_port1 \
1395 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1398 bridge link set dev $br_port1 learning off
1400 $MZ $host1_if -c 1 -p 64 -a $mac -t ip -q
1403 bridge -j fdb show br $bridge brport $br_port1 \
1404 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1407 bridge link set dev $br_port1 learning on
1411 ip link set $host1_if promisc off
1413 bridge link set dev $br_port1 flood on
1429 ip link set $host2_if promisc on
1434 $MZ $host1_if -c 1 -p 64 -b $mac -B $ip -t ip -q
1437 tc -j -s filter show dev $host2_if ingress \
1438 | jq -e ".[] | select(.options.handle == 101) \
1440 if [[ $? -ne 0 && $should_flood == "true" || \
1441 $? -eq 0 && $should_flood == "false" ]]; then
1447 ip link set $host2_if promisc off
1462 bridge link set dev $br_port flood off
1467 bridge link set dev $br_port flood on
1485 bridge link set dev $br_port mcast_flood off
1490 bridge link set dev $br_port mcast_flood on
1517 local -a mz_args=("$@")
1519 $MZ $h_in -p $pktsize -A $sip -B $dip -c 0 \
1520 -a own -b $dmac -t "$proto" -q "${mz_args[@]}" &
1531 local -a mz_args=("$@")
1544 local -a mz_args=("$@")
1556 local -a mz_args=("$@")
1568 local -a mz_args=("$@")
1576 local pid=${1-%%}; shift
1581 declare -A cappid
1582 declare -A capfile
1583 declare -A capout
1593 if [ -z $ns ]; then
1599 if [ -z $SUDO_USER ] ; then
1602 capuser="-Z $SUDO_USER"
1605 $ns_cmd tcpdump $TCPDUMP_EXTRA_FLAGS -e -n -Q in -i $if_name \
1606 -s 65535 -B 32768 $capuser -w ${capfile[$if_name]} \
1633 tcpdump -e -n -r ${capfile[$if_name]} 2>&1
1649 if [[ ! $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
1651 mz_v6arg="-6"
1660 $MZ $host1_if $mz_v6arg -c 1 -p 64 -b $mac -A $src_ip -B $ip -t udp "dp=4096,sp=2048" -q
1663 tc -j -s filter show dev $host2_if ingress \
1664 | jq -e ".[] | select(.options.handle == 101) \
1666 if [[ $? -eq 0 ]]; then
1685 bridge -j -d -s mdb show dev br0 \
1686 | jq -e ".[].mdb[] | \
1688 check_err $? "Wrong *,G entry source list after $report report"
1691 bridge -j -d -s mdb show dev br0 \
1692 | jq -e ".[].mdb[] | \
1694 check_err $? "Missing S,G entry ($sgent, $TEST_GROUP)"
1708 if [ $should_fwd -eq 1 ]; then
1709 check_fail $retval "Didn't forward traffic from S,G ($src, $TEST_GROUP)"
1711 check_err $retval "Forwarded traffic for blocked S,G ($src, $TEST_GROUP)"
1722 if [ $is_blocked -eq 1 ]; then
1727 bridge -j -d -s mdb show dev br0 \
1728 | jq -e ".[].mdb[] | \
1735 bridge -j -d -s mdb show dev br0 \
1736 | jq -e ".[].mdb[] | \
1753 mreceive -g $group -I $if_name > /dev/null 2>&1 &
1771 msend -g $groups -I $if_name -c 1 > /dev/null 2>&1
1787 smcroutedir=$(mktemp -d)
1788 defer rm -rf "$smcroutedir"
1797 ip link set dev "$if" multicast on
1798 defer ip link set dev "$if" multicast off
1805 "$MCD" -N -I "$table_name" -f "$smcroutedir/$table_name.conf" \
1806 -P "$smcroutedir/$table_name.pid"
1807 busywait "$BUSYWAIT_TIMEOUT" test -e "$smcroutedir/$table_name.pid"
1816 "$MC_CLI" -I "$table_name" "$@"
1822 local ip=${1-ip}; shift
1840 local lines=`grep '^\w' $tmpfile | wc -l`
1841 test $lines -eq $el
1843 rm -rf $tmpfile
1852 local ip=${1-ip}; shift
1888 # expanded, and each 16-bit group is padded with zeroes to be 4 hexadecimal
1890 # individual bytes of each 16-bit group.
1899 # IP where :: -> the appropriate number of colons:
1923 # Given a mausezahn-formatted payload (colon-separated bytes given as %02x),
1924 # possibly with a keyword CHECKSUM stashed where a 16-bit checksum should be,
1940 sed 's/CHECKSUM/00:00/g' |
1943 sed 's/\(..\):\(..\):/\1\2+\n/g' |
1948 echo "FFFF r - p" # Bit-flip and print.
1961 echo "$payload" | sed "s/CHECKSUM/$ckbytes/g"
1969 sed 's/:/\n/g' | wc -l
1982 )"22:"$( : Type - Membership Report
1987 )"01:"$( : Record Type - IS_IN
1993 echo -n :
2006 )"17:"$( : Type - Leave Group
2007 )"00:"$( : Max Resp Time - not meaningful
2027 )"3a:"$( : Next Header - ICMPv6
2033 )"8f:"$( : Type - MLDv2 Report
2038 )"01:"$( : Record Type - IS_IN
2044 echo -n :
2052 )"${len}:"$( : Upper-layer length
2053 )"00:3a:"$( : Zero and next-header
2069 )"3a:"$( : Next Header - ICMPv6
2075 )"84:"$( : Type - MLDv1 Done
2078 )"00:00:"$( : Max Resp Delay - not meaningful
2087 )"${len}:"$( : Upper-layer length
2088 )"00:3a:"$( : Zero and next-header
2102 if systemctl is-active --quiet lldpad; then
2104 cat >/dev/stderr <<-EOF
2114 if [[ -z $ALLOW_LLDPAD ]]; then
2115 cat >/dev/stderr <<-EOF
2119 non-empty string.
2133 echo $((v > 0 ? v : -v))
2143 ip link set $dev up
2144 ip link add link $dev name macvlan-tmp type macvlan mode private
2145 ip link set macvlan-tmp address $(u64_to_ether_addr $((tmp + 1)))
2146 ip link set macvlan-tmp up
2148 promisc=$(ip -j -d link show dev $dev | jq -r '.[].promiscuity')
2150 ip link del macvlan-tmp