mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-23 16:13:18 +01:00
Make 'show routing work with iproute 20111117
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
805166a354
commit
02342d5833
@ -454,16 +454,39 @@ sort_routes() {
|
|||||||
done | sort -r | while read dest rest; do echo $rest; done
|
done | sort -r | while read dest rest; do echo $rest; done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Find the table name in the passed routing rule
|
||||||
|
#
|
||||||
|
find_table() {
|
||||||
|
local word
|
||||||
|
|
||||||
|
while [ $# -gt 1 ]; do
|
||||||
|
word=$1
|
||||||
|
shift
|
||||||
|
[ $word = lookup ] && echo $1 && break
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Isolate the table in the routing rules being read from stdin
|
||||||
|
#
|
||||||
|
find_tables() {
|
||||||
|
while read rule; do
|
||||||
|
find_table $rule
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Show routing configuration
|
# Show routing configuration
|
||||||
#
|
#
|
||||||
show_routing() {
|
show_routing() {
|
||||||
|
local rule
|
||||||
|
local table
|
||||||
|
|
||||||
if [ -n "$(ip -$g_family rule list)" ]; then
|
if [ -n "$(ip -$g_family rule list)" ]; then
|
||||||
heading "Routing Rules"
|
heading "Routing Rules"
|
||||||
ip -$g_family rule list
|
ip -$g_family rule list
|
||||||
ip -$g_family rule list | while read rule; do
|
ip -$g_family rule list | find_tables | sort -u | while read table; do
|
||||||
echo ${rule##* }
|
|
||||||
done | sort -u | while read table; do
|
|
||||||
heading "Table $table:"
|
heading "Table $table:"
|
||||||
if [ $g_family -eq 6 ]; then
|
if [ $g_family -eq 6 ]; then
|
||||||
ip -$g_family -o route list table $table | fgrep -v cache
|
ip -$g_family -o route list table $table | fgrep -v cache
|
||||||
|
Loading…
Reference in New Issue
Block a user