2 # SPDX-License-Identifier: GPL-2.0
5 # Script created by: Stephen R. van den Berg <srb@cuci.nl>, 1999/04/18
6 # Donated to the public domain.
8 # This script transforms the output of "ip" into more readable text.
9 # "ip" is the Linux-advanced-routing configuration tool part of the
13 test "X-h" = "X$1" && echo "Usage: $0 [tablenr [raw ip args...]]" && exit 64
17 ip route list table
"$@" |
18 while read network rest
28 broadcast|
local|unreachable
) via
=$network
36 proto|via|dev|scope|src|table
)
42 dead|onlink|pervasive|offload|notify|linkdown|unresolved
)
46 # avoid infinite loop on unknown keyword without value at line end
52 echo "$network $via $src $proto $scope $dev $table"
55 format="%15s%-3s %15s %15s %8s %8s%7s %s\n";
56 printf(format,"target","","gateway","source","proto","scope","dev","tbl");
60 if(match(network,"/"))
61 { mask=" "substr(network,RSTART+1);
62 network=substr(network,0,RSTART);
70 printf(format,network,mask,via,src,proto,scope,dev,table);