parent
ca752a5a2d
commit
22e2a4f0a1
@ -1,2 +1,5 @@
|
|||||||
# Example static route. See route(8) for syntax.
|
# Example static route. See route(8) for syntax.
|
||||||
#staticroute="net 192.168.0.0 netmask 255.255.0.0 gw 10.73.1.1"
|
#staticroute="net 192.168.0.0 netmask 255.255.0.0 gw 10.73.1.1"
|
||||||
|
|
||||||
|
# Example static route using iproute2. See ip(8) for syntax.
|
||||||
|
#staticiproute="192.168.0.0/24 via 10.73.1.1"
|
||||||
|
@ -15,11 +15,24 @@ depend()
|
|||||||
keyword -jail -prefix -vserver
|
keyword -jail -prefix -vserver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre_flight_checks()
|
||||||
|
{
|
||||||
|
route=route
|
||||||
|
[ -s /etc/route.conf ] && return 0
|
||||||
|
|
||||||
|
if [ -n "$staticiproute" ]; then
|
||||||
|
route="ip route"
|
||||||
|
staticroute="$staticiproute"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
dump_args()
|
dump_args()
|
||||||
{
|
{
|
||||||
if [ -s /etc/route.conf ]; then
|
if [ -s /etc/route.conf ]; then
|
||||||
cat /etc/route.conf
|
cat /etc/route.conf
|
||||||
else
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
case "$staticroute" in
|
case "$staticroute" in
|
||||||
*"$__nl"*)
|
*"$__nl"*)
|
||||||
echo "$staticroute"
|
echo "$staticroute"
|
||||||
@ -32,7 +45,6 @@ dump_args()
|
|||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_routes()
|
do_routes()
|
||||||
@ -41,6 +53,8 @@ do_routes()
|
|||||||
[ "$RC_UNAME" != Linux ] && xtra=-q
|
[ "$RC_UNAME" != Linux ] && xtra=-q
|
||||||
|
|
||||||
ebegin "$1 static routes"
|
ebegin "$1 static routes"
|
||||||
|
eindent
|
||||||
|
pre_flight_checks
|
||||||
dump_args | while read args; do
|
dump_args | while read args; do
|
||||||
[ -z "$args" ] && continue
|
[ -z "$args" ] && continue
|
||||||
case "$args" in
|
case "$args" in
|
||||||
@ -52,11 +66,20 @@ do_routes()
|
|||||||
"-"*)
|
"-"*)
|
||||||
[ $2 = "del" -o $2 = "delete" ] && eval ${args#*-}
|
[ $2 = "del" -o $2 = "delete" ] && eval ${args#*-}
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
veinfo "$args"
|
||||||
|
case "$route" in
|
||||||
|
"ip route")
|
||||||
|
ip route $2 $args
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
route $xtra $2 -$args
|
route $xtra $2 -$args
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
veend $?
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
eoutdent
|
||||||
eend 0
|
eend 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user