Here's a patch that sets the gateway to the default gateway for the
interface if one is not specified in the network configuration.

Why would anyone want this?  If somebody has multiple default gateways
and wants to force one of them to be used for a particular route.  Why
not just specify the particular gateway to be used in the route config?
It might not be the same every time.  The network to which we are
attached may be prone to network changes which are propagated via DHCP
so we don't know until an interface is configured what it's default
route is.

Signed off by: Brian J. Murrell <[EMAIL PROTECTED]>

Index: package/base-files/files/etc/hotplug.d/iface/10-routes
===================================================================
--- package/base-files/files/etc/hotplug.d/iface/10-routes      (revision 10709)
+++ package/base-files/files/etc/hotplug.d/iface/10-routes      (working copy)
@@ -19,9 +19,10 @@
                echo "Missing target in route section $config"
                return 1
        }
+
+       # gateway is the default gateway of the interface if not specified
        [ -n "$gateway" ] || {
-               echo "Missing gateway in route section $config"
-               return 1
+               config_get gateway "$interface" gateway
        }
 
        netmask="${netmask:-255.255.255.255}"
@@ -51,9 +52,9 @@
                echo "Missing target in route section $config"
                return 1
        }
+       # gateway is the default gateway of the interface if not specified
        [ -n "$gateway" ] || {
-               echo "Missing gateway in route section $config"
-               return 1
+               config_get gateway "$interface" gateway
        }
 
        /sbin/route -A inet6 add $target gw "$gateway" ${dev:+dev "$dev"} 
${metric:+ metric "$metric"}

b.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to