Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 34 lines (25 sloc) 644 Bytes
#!/usr/bin/env bash
set -eu
if (( EUID )); then
echo 'This script must be run with root privileges.' >&2
exit 1
fi
prgname=${0##*/}
# ----------------------------------------
case $prgname in
ip6*) prefix='ip6' ;;
*) prefix='ip' ;;
esac
tables=("$@")
if (( ! ${#tables[@]} )); then
src="/proc/net/${prefix}_tables_names"
[[ -e $src ]] && readarray -t tables <"$src"
fi
for table in "${tables[@]}"; do
echo $'\n--------------------------------------------------'
printf '> %s table %s:\n\n' "$prefix" "$table"
"${prefix}tables" -t "$table" -nvL
echo
"${prefix}tables" -t "$table" -S
done
echo