Lines Matching +full:local +full:- +full:mac +full:- +full:address

2 # SPDX-License-Identifier: GPL-2.0
7 declare -A NETIFS=(
41 # Constants for netdevice bring-up:
45 # Like INTERFACE_TIMEOUT, but default for ad-hoc waiting in testing scripts.
73 # Whether to override MAC addresses on interfaces participating in the test.
82 # Whether the machine is "slow" -- i.e. might be incapable of running tests
84 # e.g. a low-power board.
88 # Find netifs by test-specified driver name
92 local dev=$1; shift
93 local driver_path="/sys/class/net/$dev/device/driver"
95 if [[ -L $driver_path ]]; then
102 local ifnames=`ip -j link show | jq -r ".[].ifname"`
103 local count=0
107 local driver_name=`driver_name_get $ifname`
108 if [[ ! -z $driver_name && $driver_name == $NETIF_FIND_DRIVER ]]; then
120 declare -A NETIFS
124 net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
126 if [[ -f $net_forwarding_dir/forwarding.config ]]; then
137 tc -j &> /dev/null
138 if [[ $? -ne 0 ]]; then
147 local dev=$1; shift
151 if [[ $? -ne 0 ]]; then
162 local dev=$1; shift
163 local ret;
169 if [[ $? -ne 0 ]]; then
170 echo "SKIP: iproute2 too old; tc-flower is missing extended MPLS support"
174 tc -j filter show dev $dev ingress protocol mpls_uc | jq . &> /dev/null
179 if [[ $ret -ne 0 ]]; then
180 echo "SKIP: iproute2 too old; tc-flower produces invalid json output for extended MPLS filters"
188 if [[ $? -ne 0 ]]; then
197 if [[ $? -ne 0 ]]; then
205 tc actions help 2>&1 | grep -q hw_stats
206 if [[ $? -ne 0 ]]; then
214 tc qdisc add dev lo mqprio help 2>&1 | grep -q "fp "
215 if [[ $? -ne 0 ]]; then
223 ethtool --help 2>&1| grep lanes &> /dev/null
224 if [[ $? -ne 0 ]]; then
232 ethtool --help 2>&1| grep -- '--show-mm' &> /dev/null
233 if [[ $? -ne 0 ]]; then
234 echo "SKIP: ethtool too old; it is missing MAC Merge layer support"
241 ethtool --help 2>&1| grep -- '--all-groups' &> /dev/null
242 if [[ $? -ne 0 ]]; then
250 local dev=$1; shift
251 local grp=$1; shift
253 [ 0 -ne $(ethtool --json -S $dev --all-groups --src pmac 2>/dev/null \
259 if ! bridge -d link show | grep -q " locked"; then
267 if ! bridge -d link show | grep -q "mab"; then
273 if [[ "$(id -u)" -ne 0 ]]; then
280 local dev=$1; shift
281 local expected=$1; shift
282 local driver_name=`driver_name_get $dev`
296 local cmd=$1; shift
298 if [[ ! -x "$(command -v "$cmd")" ]]; then
307 local version="$(msend -v)"
308 local major
311 major=$(echo $version | cut -d. -f1)
313 if [ $major -lt 3 ]; then
337 while [[ $# -gt 0 ]]; do
338 if [[ "$count" -eq "0" ]]; then
340 declare -A NETIFS
350 if [[ ! -v NUM_NETIFS ]]; then
369 local i
372 local j=$((i+1))
374 if [ -z ${NETIFS[p$i]} ]; then
380 if [[ $? -ne 0 ]]; then
383 if [[ $? -ne 0 ]]; then
403 declare -A MAC_ADDR_ORIG
406 local new_addr=
407 local dev=
413 MAC_ADDR_ORIG["$dev"]=$(ip -j link show dev $dev | jq -e '.[].address')
416 ip link set dev $dev address $new_addr
422 local dev=
426 ip link set dev $dev address ${MAC_ADDR_ORIG["$dev"]}
440 if [[ $? -ne 0 ]]; then
451 # Per-test return value. Clear at the beginning of each test.
456 local ksft_status=$1; shift
457 local msg=$1; shift
470 local err=$1
471 local msg=$2
484 local err=$1
485 local msg=$2
492 local should_fail=$1; shift
493 local err=$1; shift
494 local what=$1; shift
526 local dev=$1; shift
527 local kind
529 kind=$(ip -j -d link show dev $dev |
530 jq -r '.[].linkinfo.info_kind')
540 local test_name=$1; shift
541 local opt_str=$1; shift
542 local result=$1; shift
543 local retmsg=$1; shift
545 printf "TEST: %-60s [%s]\n" "$test_name $opt_str" "$result"
562 local test_name=$1; shift
563 local opt_str=$1; shift
570 local test_name=$1; shift
571 local opt_str=$1; shift
579 local test_name=$1; shift
580 local opt_str=$1; shift
588 local test_name=$1; shift
589 local opt_str=$1; shift
596 local test_name=$1
597 local opt_str=$2
599 if [[ $# -eq 2 ]]; then
629 local msg=$1
642 local arr=("$@")
646 if [[ $cur -gt $max ]]; then
656 local addr=$1; shift
657 local word
658 local flag
662 if [ "$1" == "-v" ]; then
672 "$@" | grep -q "Link detected: yes"
677 "$@" | grep -q offload
682 "$@" | grep -q trap
687 local dev=$1; shift
688 local wait_time=${1:-$WAIT_TIME}; shift
701 local dev=$1; shift
702 local max_iterations=${1:-$WAIT_TIMEOUT}; shift
703 local wait_time=${1:-$WAIT_TIME}; shift
704 local i
709 if [[ $? -ne 0 ]]; then
722 local num_netifs=${1:-$NUM_NETIFS}
723 local i
735 local dev=$1; shift
736 local timeout=${1:-$WAIT_TIMEOUT}; shift
748 local cmd=$1
749 local jq_exp=$2
750 local jq_opts=$3
751 local ret
752 local output
757 if [[ $ret -ne 0 ]]; then
760 output=$(echo $output | jq -r $jq_opts "$jq_exp")
762 if [[ $ret -ne 0 ]]; then
766 # return success only in case of non-empty output
767 [ ! -z "$output" ]
784 ip -4 rule add pref 32765 table local
785 ip -4 rule del pref 0
786 ip -6 rule add pref 32765 table local
787 ip -6 rule del pref 0
792 ip -6 rule add pref 0 table local
793 ip -6 rule del pref 32765
794 ip -4 rule add pref 0 table local
795 ip -4 rule del pref 32765
799 declare -A __TB_IDS
803 local vrf_name=$1
812 local vrf_name=$1
819 local vrf_name=$1
820 local tb_id
826 ip -4 route add table $tb_id unreachable default metric 4278198272
827 ip -6 route add table $tb_id unreachable default metric 4278198272
832 local vrf_name=$1
833 local tb_id
838 ip -6 route del table $tb_id unreachable default metric 4278198272
839 ip -4 route del table $tb_id unreachable default metric 4278198272
845 local if_name=$1
846 local add_del=$2
847 local array
854 ip address $add_del $addrstr dev $if_name
860 local if_name=$1; shift
861 local vrf_name=$1; shift
862 local addrs=("${@}")
872 local if_name=$1; shift
873 local addrs=("${@}")
883 local if_name=$1
884 local vrf_name
885 local array
898 local if_name=$1
899 local vrf_name
900 local array
912 local name=$1; shift
913 local type=$1; shift
914 local local=$1; shift
915 local remote=$1; shift
918 local $local remote $remote "$@"
924 local name=$1; shift
931 local if_name=$1; shift
932 local vid=$1; shift
933 local vrf=$1; shift
934 local ips=("${@}")
935 local name=$if_name.$vid
947 local if_name=$1; shift
948 local vid=$1; shift
949 local name=$if_name.$vid
956 local if_name=$1; shift
957 local mode=$1; shift
960 $TEAMD -t $if_name -d -c '{"runner": {"name": "'$mode'"}}'
971 local if_name=$1; shift
973 $TEAMD -t $if_name -k
978 local if_name=$1
980 ip -j link show dev $if_name | jq -r '.[]["master"]'
985 local if_name=$1; shift
986 local dir=$1; shift
987 local stat=$1; shift
989 ip -j -s link show dev $if_name \
1005 local dev=$1; shift
1006 local stat=$1; shift
1008 ethtool -S $dev | grep "^ *$stat:" | head -n 1 | cut -d: -f2
1013 local dev=$1; shift
1014 local grp=$1; shift
1015 local name=$1; shift
1016 local src=$1; shift
1018 ethtool --json -S $dev --groups $grp -- --src $src | \
1024 local dev=$1; shift
1025 local handle=$1; shift
1026 local selector=$1; shift
1028 tc -j -s qdisc show dev "$dev" \
1034 local dev=$1; shift
1035 local parent=$1; shift
1036 local selector=$1; shift
1038 tc -j -s qdisc show dev "$dev" invisible \
1044 local dev=$1; shift
1045 local stat=$1; shift
1047 cat /proc/net/dev_snmp6/$dev | grep "^$stat" | cut -f2
1052 local suite=$1; shift
1053 local if_name=$1; shift
1054 local dir=$1; shift
1055 local stat=$1; shift
1057 ip -j stats show dev $if_name group offload subgroup $suite |
1063 local key=$1; shift
1064 local group_id=$1; shift
1065 local member_id=$1; shift
1067 ip -j -s -s nexthop show id $group_id |
1068 jq --argjson member_id "$member_id" --arg key "$key" \
1074 local group_id=$1; shift
1075 local member_id=$1; shift
1082 local group_id=$1; shift
1083 local member_id=$1; shift
1090 local speed=$1; shift
1105 local t0=$1; shift
1106 local t1=$1; shift
1107 local interval=$1; shift
1109 echo $((8 * (t1 - t0) / interval))
1114 local t0=$1; shift
1115 local t1=$1; shift
1116 local interval=$1; shift
1118 echo $(((t1 - t0) / interval))
1123 local if_name=$1
1125 ip -j link show dev $if_name | jq -r '.[]["address"]'
1130 local addr="$1"
1131 local order="$((1 << 40))"
1132 local val=0
1133 local byte
1148 local val=$1
1149 local byte
1150 local i
1152 for ((i = 40; i >= 0; i -= 8)); do
1155 if [ $i -ne 0 ]; then
1163 local if_name=$1
1165 ip -j addr show dev $if_name | \
1166 jq -r '.[]["addr_info"][] | select(.scope == "link").local' | \
1167 head -1
1172 local bridge=$1
1173 local ageing_time
1176 ageing_time=$(ip -j -d link show dev $bridge \
1181 declare -A SYSCTL_ORIG
1184 local key=$1; shift
1186 SYSCTL_ORIG[$key]=$(sysctl -n $key)
1191 local key=$1; shift
1192 local value=$1; shift
1195 sysctl -qw $key="$value"
1200 local key=$1; shift
1202 sysctl -qw $key="${SYSCTL_ORIG[$key]}"
1217 declare -A MTU_ORIG
1220 local dev=$1; shift
1221 local mtu=$1; shift
1223 MTU_ORIG["$dev"]=$(ip -j link show dev $dev | jq -e '.[].mtu')
1229 local dev=$1; shift
1236 local num_netifs=${1:-$NUM_NETIFS}
1239 ethtool -k ${NETIFS[p$i]} \
1240 | grep "hw-tc-offload: on" &> /dev/null
1241 if [[ $? -ne 0 ]]; then
1251 local dev=$1; shift
1252 local direction=$1; shift
1254 # Some devices may not support or need in-hardware trapping of traffic
1255 # (e.g. the veth pairs that this library creates for non-existent
1267 local dev=$1; shift
1268 local direction=$1; shift
1275 local add_del=$1; shift
1276 local pref=$1; shift
1277 local vsuf=$1; shift
1278 local tundev=$1; shift
1279 local filter=$1; shift
1289 local tundev=$1; shift
1290 local filter=$1; shift
1297 local tundev=$1; shift
1298 local filter=$1; shift
1305 local tundev=$1; shift
1306 local filter=$1; shift
1313 local tundev=$1; shift
1314 local filter=$1; shift
1321 local add_del=$1; shift
1322 local pref=$1; shift
1323 local dev=$1; shift
1324 local filter=$1; shift
1334 local dev=$1; shift
1335 local filter=$1; shift
1342 local dev=$1; shift
1343 local filter=$1; shift
1350 local add_del=$1; shift
1351 local dev=$1; shift
1352 local base=$1; shift
1353 local dscp;
1364 local dev=$1; shift
1365 local base=$1; shift
1372 local dev=$1; shift
1373 local base=$1; shift
1380 local dev=$1; shift
1381 local base=$1; shift
1384 local dscp=$((base + prio))
1385 local t=$(tc_rule_stats_get $dev $((dscp + 100)))
1392 local dev=$1; shift
1403 local current_test
1405 for current_test in ${TESTS:-$ALL_TESTS}; do
1412 local desc="$1"
1413 local weight_rp12=$2
1414 local weight_rp13=$3
1415 local packets_rp12=$4
1416 local packets_rp13=$5
1417 local weights_ratio packets_ratio diff
1421 if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then
1423 | bc -l)
1426 | bc -l)
1429 if [[ "$packets_rp12" -eq "0" || "$packets_rp13" -eq "0" ]]; then
1436 if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then
1438 | bc -l)
1441 | bc -l)
1444 diff=$(echo $weights_ratio - $packets_ratio | bc -l)
1445 diff=${diff#-}
1447 test "$(echo "$diff / $weights_ratio > 0.15" | bc -l)" -eq 0
1455 local name=$1; shift
1457 ip netns exec $name bash <<-EOF
1469 local if_name=$1
1470 local dip=$2
1471 local args=$3
1472 local vrf_name
1476 $PING $args $dip -c $PING_COUNT -i 0.1 \
1477 -w $PING_TIMEOUT &> /dev/null
1500 local if_name=$1
1501 local dip=$2
1502 local args=$3
1503 local vrf_name
1507 $PING6 $args $dip -c $PING_COUNT -i 0.1 \
1508 -w $PING_TIMEOUT &> /dev/null
1531 local bridge=$1
1532 local br_port1=$2 # Connected to `host1_if`.
1533 local host1_if=$3
1534 local host2_if=$4
1535 local mac=de:ad:be:ef:13:37
1536 local ageing_time
1540 bridge -j fdb show br $bridge brport $br_port1 \
1541 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1552 flower dst_mac $mac action drop
1554 $MZ $host2_if -c 1 -p 64 -b $mac -t ip -q
1557 tc -j -s filter show dev $host1_if ingress \
1558 | jq -e ".[] | select(.options.handle == 101) \
1562 $MZ $host1_if -c 1 -p 64 -a $mac -t ip -q
1565 bridge -j fdb show br $bridge brport $br_port1 \
1566 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1569 $MZ $host2_if -c 1 -p 64 -b $mac -t ip -q
1572 tc -j -s filter show dev $host1_if ingress \
1573 | jq -e ".[] | select(.options.handle == 101) \
1578 # record was aged-out.
1582 bridge -j fdb show br $bridge brport $br_port1 \
1583 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1588 $MZ $host1_if -c 1 -p 64 -a $mac -t ip -q
1591 bridge -j fdb show br $bridge brport $br_port1 \
1592 | jq -e ".[] | select(.mac == \"$mac\")" &> /dev/null
1608 local should_flood=$1
1609 local mac=$2
1610 local ip=$3
1611 local host1_if=$4
1612 local host2_if=$5
1613 local err=0
1620 flower dst_mac $mac action drop
1622 $MZ $host1_if -c 1 -p 64 -b $mac -B $ip -t ip -q
1625 tc -j -s filter show dev $host2_if ingress \
1626 | jq -e ".[] | select(.options.handle == 101) \
1628 if [[ $? -ne 0 && $should_flood == "true" || \
1629 $? -eq 0 && $should_flood == "false" ]]; then
1642 local br_port=$1
1643 local host1_if=$2
1644 local host2_if=$3
1645 local mac=de:ad:be:ef:13:37
1646 local ip=192.0.2.100
1652 flood_test_do false $mac $ip $host1_if $host2_if
1657 flood_test_do true $mac $ip $host1_if $host2_if
1665 local br_port=$1
1666 local host1_if=$2
1667 local host2_if=$3
1668 local mac=01:00:5e:00:00:01
1669 local ip=239.0.0.1
1675 flood_test_do false $mac $ip $host1_if $host2_if
1680 flood_test_do true $mac $ip $host1_if $host2_if
1689 local br_port=$1
1690 local host1_if=$2
1691 local host2_if=$3
1699 local pktsize=$1; shift
1700 local proto=$1; shift
1701 local h_in=$1; shift # Where the traffic egresses the host
1702 local sip=$1; shift
1703 local dip=$1; shift
1704 local dmac=$1; shift
1705 local -a mz_args=("$@")
1707 $MZ $h_in -p $pktsize -A $sip -B $dip -c 0 \
1708 -a own -b $dmac -t "$proto" -q "${mz_args[@]}" &
1714 local pktsize=$1; shift
1715 local h_in=$1; shift
1716 local sip=$1; shift
1717 local dip=$1; shift
1718 local dmac=$1; shift
1719 local -a mz_args=("$@")
1727 local pktsize=$1; shift
1728 local h_in=$1; shift
1729 local sip=$1; shift
1730 local dip=$1; shift
1731 local dmac=$1; shift
1732 local -a mz_args=("$@")
1740 local h_in=$1; shift
1741 local sip=$1; shift
1742 local dip=$1; shift
1743 local dmac=$1; shift
1744 local -a mz_args=("$@")
1752 local h_in=$1; shift
1753 local sip=$1; shift
1754 local dip=$1; shift
1755 local dmac=$1; shift
1756 local -a mz_args=("$@")
1768 declare -A cappid
1769 declare -A capfile
1770 declare -A capout
1774 local if_name=$1; shift
1775 local ns=$1; shift
1780 if [ -z $ns ]; then
1786 if [ -z $SUDO_USER ] ; then
1789 capuser="-Z $SUDO_USER"
1792 $ns_cmd tcpdump $TCPDUMP_EXTRA_FLAGS -e -n -Q in -i $if_name \
1793 -s 65535 -B 32768 $capuser -w ${capfile[$if_name]} \
1802 local if_name=$1
1803 local pid=${cappid[$if_name]}
1811 local if_name=$1
1818 local if_name=$1
1820 tcpdump -e -n -r ${capfile[$if_name]} 2>&1
1826 local mac=$1
1827 local src_ip=$2
1828 local ip=$3
1829 local host1_if=$4
1830 local host2_if=$5
1831 local seen=0
1832 local tc_proto="ip"
1833 local mz_v6arg=""
1835 # basic check to see if we were passed an IPv4 address, if not assume IPv6
1836 if [[ ! $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
1838 mz_v6arg="-6"
1845 flower ip_proto udp dst_mac $mac action drop
1847 $MZ $host1_if $mz_v6arg -c 1 -p 64 -b $mac -A $src_ip -B $ip -t udp "dp=4096,sp=2048" -q
1850 tc -j -s filter show dev $host2_if ingress \
1851 | jq -e ".[] | select(.options.handle == 101) \
1853 if [[ $? -eq 0 ]]; then
1865 local report=$1; shift
1866 local slist=("$@")
1867 local sarg=""
1870 sarg="${sarg} and .source_list[].address == \"$src\""
1872 bridge -j -d -s mdb show dev br0 \
1873 | jq -e ".[].mdb[] | \
1878 bridge -j -d -s mdb show dev br0 \
1879 | jq -e ".[].mdb[] | \
1887 local should_fwd=$1; shift
1888 local sources=("$@")
1891 local retval=0
1895 if [ $should_fwd -eq 1 ]; then
1905 local is_blocked=$1; shift
1906 local sources=("$@")
1907 local should_fail=1
1909 if [ $is_blocked -eq 1 ]; then
1914 bridge -j -d -s mdb show dev br0 \
1915 | jq -e ".[].mdb[] | \
1918 select(.address == \"$src\") |
1922 bridge -j -d -s mdb show dev br0 \
1923 | jq -e ".[].mdb[] | \
1932 local if_name=$1
1933 local group=$2
1934 local vrf_name=$(master_name_get $if_name)
1937 # IP multicast group and adding the L2 address to the device's
1938 # MAC filtering table
1940 mreceive -g $group -I $if_name > /dev/null 2>&1 &
1953 local if_name=$1
1954 local groups=$2
1955 local vrf_name=$(master_name_get $if_name)
1958 msend -g $groups -I $if_name -c 1 > /dev/null 2>&1
1963 local mtype=$1; shift
1964 local ip=${1-ip}; shift
1975 local mpid=$1; shift
1976 local tmpfile=$1; shift
1977 local el=$1; shift
1978 local what=$1; shift
1982 local lines=`grep '^\w' $tmpfile | wc -l`
1983 test $lines -eq $el
1985 rm -rf $tmpfile
1990 local dev=$1; shift
1991 local type=$1; shift
1992 local make_suitable=$1; shift
1993 local make_unsuitable=$1; shift
1994 local ip=${1-ip}; shift
1999 local ipmout=$(start_ip_monitor stats "$ip")
2004 local ipmout=$(start_ip_monitor stats "$ip")
2009 local ipmout=$(start_ip_monitor stats "$ip")
2014 local ipmout=$(start_ip_monitor stats "$ip")
2023 local IP=$1; shift
2029 # Convert a given IPv6 address, `IP' such that the :: token, if present, is
2030 # expanded, and each 16-bit group is padded with zeroes to be 4 hexadecimal
2032 # individual bytes of each 16-bit group.
2035 local IP=$1; shift
2036 local bytesep=$1; shift
2038 local cvt_ip=${IP/::/_}
2039 local colons=${cvt_ip//[^:]/}
2040 local allcol=:::::::
2041 # IP where :: -> the appropriate number of colons:
2042 local allcol_ip=${cvt_ip/_/${allcol:${#colons}}}
2053 local IP=$1; shift
2060 local u16=$1; shift
2065 # Given a mausezahn-formatted payload (colon-separated bytes given as %02x),
2066 # possibly with a keyword CHECKSUM stashed where a 16-bit checksum should be,
2071 local payload=$1; shift
2090 echo "FFFF r - p" # Bit-flip and print.
2098 local payload=$1; shift
2099 local checksum=$1; shift
2101 local ckbytes=$(u16_to_bytes $checksum)
2108 local payload=$1; shift
2111 sed 's/:/\n/g' | wc -l
2116 local GRP=$1; shift
2117 local sources=("$@")
2119 local igmpv3
2120 local nsources=$(u16_to_bytes ${#sources[@]})
2124 )"22:"$( : Type - Membership Report
2129 )"01:"$( : Record Type - IS_IN
2132 )"$(ipv4_to_bytes $GRP):"$( : Multicast Address
2135 echo -n :
2138 local checksum=$(payload_template_calc_checksum "$igmpv3")
2145 local GRP=$1; shift
2147 local payload=$(:
2148 )"17:"$( : Type - Leave Group
2149 )"00:"$( : Max Resp Time - not meaningful
2151 )"$(ipv4_to_bytes $GRP)"$( : Group Address
2153 local checksum=$(payload_template_calc_checksum "$payload")
2160 local SIP=$1; shift
2161 local GRP=$1; shift
2162 local sources=("$@")
2164 local hbh
2165 local icmpv6
2166 local nsources=$(u16_to_bytes ${#sources[@]})
2169 )"3a:"$( : Next Header - ICMPv6
2175 )"8f:"$( : Type - MLDv2 Report
2180 )"01:"$( : Record Type - IS_IN
2183 )"$(ipv6_to_bytes $GRP):"$( : Multicast address
2186 echo -n :
2190 local len=$(u16_to_bytes $(payload_template_nbytes $icmpv6))
2191 local sudohdr=$(:
2193 )"$(ipv6_to_bytes $GRP):"$( : DIP is multicast address
2194 )"${len}:"$( : Upper-layer length
2195 )"00:3a:"$( : Zero and next-header
2197 local checksum=$(payload_template_calc_checksum ${sudohdr}${icmpv6})
2204 local SIP=$1; shift
2205 local GRP=$1; shift
2207 local hbh
2208 local icmpv6
2211 )"3a:"$( : Next Header - ICMPv6
2217 )"84:"$( : Type - MLDv1 Done
2220 )"00:00:"$( : Max Resp Delay - not meaningful
2222 )"$(ipv6_to_bytes $GRP):"$( : Multicast address
2225 local len=$(u16_to_bytes $(payload_template_nbytes $icmpv6))
2226 local sudohdr=$(:
2228 )"$(ipv6_to_bytes $GRP):"$( : DIP is multicast address
2229 )"${len}:"$( : Upper-layer length
2230 )"00:3a:"$( : Zero and next-header
2232 local checksum=$(payload_template_calc_checksum ${sudohdr}${icmpv6})
2239 local reason1="$1"; shift
2240 local reason2="$1"; shift
2241 local caller=${FUNCNAME[1]}
2242 local src=${BASH_SOURCE[1]}
2244 if systemctl is-active --quiet lldpad; then
2246 cat >/dev/stderr <<-EOF
2256 if [[ -z $ALLOW_LLDPAD ]]; then
2257 cat >/dev/stderr <<-EOF
2261 non-empty string.
2273 local v=$1; shift
2275 echo $((v > 0 ? v : -v))
2280 local dev=$1; shift
2281 local mac_addr=$(mac_get $dev)
2282 local tmp=$(ether_addr_to_u64 $mac_addr)
2283 local promisc
2286 ip link add link $dev name macvlan-tmp type macvlan mode private
2287 ip link set macvlan-tmp address $(u64_to_ether_addr $((tmp + 1)))
2288 ip link set macvlan-tmp up
2290 promisc=$(ip -j -d link show dev $dev | jq -r '.[].promiscuity')
2292 ip link del macvlan-tmp