1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-05 09:18:06 +03:00

ctdb-tests: Implement "ip -brief link show" in ip stub

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2022-08-17 11:37:56 +10:00 committed by Amitay Isaacs
parent ef921bdbdb
commit 5abaec4992

View File

@ -130,17 +130,26 @@ ip_link_show()
_mac="00:00:00:00:00:00" _mac="00:00:00:00:00:00"
_brd="00:00:00:00:00:00" _brd="00:00:00:00:00:00"
_type="loopback" _type="loopback"
_opts="<LOOPBACK${_flags}> mtu 65536 qdisc noqueue state UNKNOWN" _state="UNKNOWN"
_status="<LOOPBACK${_flags}>"
_opts="mtu 65536 qdisc noqueue state ${_state}"
;; ;;
*) *)
_mac=$(echo "$dev" | cksum | sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@') _mac=$(echo "$dev" | cksum | sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@')
_brd="ff:ff:ff:ff:ff:ff" _brd="ff:ff:ff:ff:ff:ff"
_type="ether" _type="ether"
_opts="<BROADCAST,MULTICAST${_flags}> mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000" _status="<BROADCAST,MULTICAST${_flags}>"
_opts="mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000"
;; ;;
esac esac
echo "${n:-42}: ${dev}: ${_opts}"
if $brief; then
printf '%-16s %-14s %-17s %s\n' \
"$dev" "$_status" "$_mac" "$_status"
else
echo "${n:-42}: ${dev}: ${_status} ${_opts}"
echo " link/${_type} ${_mac} brd ${_brd}" echo " link/${_type} ${_mac} brd ${_brd}"
fi
} }
# This is incomplete because it doesn't actually look up table ids in # This is incomplete because it doesn't actually look up table ids in
@ -209,6 +218,11 @@ ip_addr_show()
primary=true primary=true
secondary=true secondary=true
_to="" _to=""
if $brief; then
not_implemented "ip -br addr show in \"$orig_args\""
fi
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
dev) dev)
@ -466,6 +480,10 @@ ip_rule()
ip_rule_show() ip_rule_show()
{ {
if $brief; then
not_implemented "ip -br rule show in \"$orig_args\""
fi
ip_rule_show_1() ip_rule_show_1()
{ {
_pre="$1" _pre="$1"
@ -784,6 +802,14 @@ ip_route_del()
orig_args="$*" orig_args="$*"
brief=false
case "$1" in
-br*)
brief=true
shift
;;
esac
case "$1" in case "$1" in
link) link)
shift shift