]> git.ipfire.org Git - people/stevee/network.git/blobdiff - functions.routing
Add support for pptp dialin.
[people/stevee/network.git] / functions.routing
index 7fca8ba908bbd38723f1f6922e78070997945d80..a57fa36dfde31ef6d8b79be0a1c7d42a71fa30cd 100644 (file)
@@ -50,11 +50,12 @@ function routing_default_update() {
                        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.
@@ -103,28 +104,14 @@ function routing_default_update() {
        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() {
@@ -223,6 +210,11 @@ function routing_update() {
        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)