X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/8c019c3a5308a8e6dfc1ec4359443432e0673550..e713ba8d94869c77f944429988bb6edc8556a4f5:/package/base-files/files/etc/hotplug.d/iface/10-routes diff --git a/package/base-files/files/etc/hotplug.d/iface/10-routes b/package/base-files/files/etc/hotplug.d/iface/10-routes index 7e957f7f1..0eb92870f 100644 --- a/package/base-files/files/etc/hotplug.d/iface/10-routes +++ b/package/base-files/files/etc/hotplug.d/iface/10-routes @@ -20,15 +20,15 @@ add_route() { return 1 } [ -n "$gateway" ] || { - echo "Missing gateway in route section $config" - return 1 + config_get gateway "$interface" gateway } netmask="${netmask:-255.255.255.255}" dest="${netmask:+-net "$target" netmask "$netmask"}" dest="${dest:--host "$target"}" - /sbin/route add $dest gw "$gateway" ${dev:+dev "$dev"} ${metric:+ metric "$metric"} + /sbin/route add $dest ${gateway:+gw "$gateway"} \ + ${dev:+dev "$dev"} ${metric:+ metric "$metric"} } add_route6() { @@ -52,18 +52,17 @@ add_route6() { return 1 } [ -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"} + /sbin/route -A inet6 add $target ${gateway:+gw "$gateway"} \ + ${dev:+dev "$dev"} ${metric:+ metric "$metric"} } case "$ACTION" in ifup) include /lib/network scan_interfaces - . /var/state/network config_foreach "add_route" route config_foreach "add_route6" route6 ;;