Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
executable file 33 lines (25 sloc) 638 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