if [ "$(routing_db_get ${zone} ${proto} active)" = "1" ]; then
gateway=$(routing_db_get ${zone} ${proto} remote-ip-address)
- assert device_exists ${zone}
+ # Go on if the device is not there anymore.
+ device_exists ${zone} || continue
- # If we have got a PPP device, we will directly send all
+ # If we have got a Point-to-Point device, we will directly send all
# packets into the pipe.
- if device_is_ppp ${zone}; then
+ if device_is_ptp ${zone}; then
routes="${routes} dev ${zone}"
# On other devices, we will use the gateway if we got one.
done
}
+# XXX deprecated function
function routing_table_exists() {
- local zone=${1}
-
- grep -q "${zone}$" < /etc/iproute2/rt_tables
+ route_table_exists $@
}
+# XXX deprecated function
function routing_table_create() {
- local zone=${1}
-
- if routing_table_exists ${zone}; then
- return ${EXIT_OK}
- fi
-
- log INFO "Creating routing table for zone '${zone}'"
-
- local id=$(( ${zone#red} + 1 ))
-
- echo "${id} ${zone}" >> /etc/iproute2/rt_tables
-}
-
-function routing_table_remove() {
- : # XXX do we need this?
+ route_table_create $@
}
function routing_db_path() {
log DEBUG "Flushing routing table ${table}"
cmd ${ip_cmd} route flush table ${table}
+ # Exit here if there is no routing information.
+ if ! routing_db_exists ${zone} ${proto}; then
+ return ${EXIT_OK}
+ fi
+
local local_ip_address=$(routing_db_get ${zone} ${proto} local-ip-address)
local remote_ip_address=$(routing_db_get ${zone} ${proto} remote-ip-address)