mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-03 12:09:14 +01:00
Sort IPv6 routing tables.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
0387b16983
commit
d0e03bb03a
@ -436,21 +436,42 @@ save_config() {
|
|||||||
#
|
#
|
||||||
sort_routes() {
|
sort_routes() {
|
||||||
local dest
|
local dest
|
||||||
|
local second
|
||||||
local rest
|
local rest
|
||||||
local vlsm
|
local vlsm
|
||||||
|
local maxvlsm
|
||||||
|
local rule
|
||||||
|
|
||||||
while read dest rest; do
|
if [ $g_family -eq 4 ]; then
|
||||||
|
maxvlsm=032
|
||||||
|
else
|
||||||
|
maxvlsm=128
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read dest second rest; do
|
||||||
if [ -n "$dest" ]; then
|
if [ -n "$dest" ]; then
|
||||||
|
rule="$dest $second $rest"
|
||||||
case "$dest" in
|
case "$dest" in
|
||||||
default)
|
default)
|
||||||
echo "00 $dest $rest"
|
echo "000 $rule"
|
||||||
|
;;
|
||||||
|
blackhole|local)
|
||||||
|
case "$second" in
|
||||||
|
*/*)
|
||||||
|
vlsm=${second#*/}
|
||||||
|
printf "%03d %s\n" $vlsm "$rule"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$maxvlsm $rule"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
*/*)
|
*/*)
|
||||||
vlsm=${dest#*/}
|
vlsm=${dest#*/}
|
||||||
printf "%02d %s\n" $vlsm "$dest $rest"
|
printf "%03d %s\n" $vlsm "$rule"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "32 $dest $rest"
|
echo "$maxvlsm $rule"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -481,7 +502,7 @@ show_routing() {
|
|||||||
ip -$g_family rule list | find_tables | sort -u | while read table; do
|
ip -$g_family rule list | find_tables | 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 | sort_routes
|
||||||
else
|
else
|
||||||
ip -4 -o route list table $table | sort_routes
|
ip -4 -o route list table $table | sort_routes
|
||||||
fi
|
fi
|
||||||
@ -494,7 +515,7 @@ show_routing() {
|
|||||||
else
|
else
|
||||||
heading "Routing Table"
|
heading "Routing Table"
|
||||||
if [ $g_family -eq 6 ]; then
|
if [ $g_family -eq 6 ]; then
|
||||||
ip -$g_family -o route list | fgrep -v cache
|
ip -$g_family -o route list | fgrep -v cache | sort_routes
|
||||||
else
|
else
|
||||||
ip -4 -o route list table $table | sort_routes
|
ip -4 -o route list table $table | sort_routes
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user