dhcp: add option specifying overriding custom-routes
authorSteven Barth <cyrus@openwrt.org>
Sat, 2 May 2015 07:44:55 +0000 (07:44 +0000)
committerSteven Barth <cyrus@openwrt.org>
Sat, 2 May 2015 07:44:55 +0000 (07:44 +0000)
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 45594

package/network/config/netifd/Makefile
package/network/config/netifd/files/lib/netifd/dhcp.script
package/network/config/netifd/files/lib/netifd/proto/dhcp.sh

index 6604cc7535a1c794407262aac7471be8dd2c58de..33db1816c3cd45a391be8e57e910d74bca117ecc 100644 (file)
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=netifd
-PKG_VERSION:=2015-04-21
+PKG_VERSION:=2015-05-02
 PKG_RELEASE=$(PKG_SOURCE_VERSION)
 
 PKG_SOURCE_PROTO:=git
index fb9f95a5176ceba9b5251fe6d84d0e8ce58d94a9..5b77f306f762fe7ff4e8979638f9dafd3d4ec531 100755 (executable)
@@ -21,6 +21,10 @@ setup_interface () {
        for i in $router; do
                proto_add_ipv4_route "$i" 32 "" "$ip"
                proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
+
+               for r in $CUSTOMROUTES; do
+                       proto_add_ipv4_route "${r%%/*}" "${r##*/}" "$i" "$ip"
+               done
        done
 
        # CIDR STATIC ROUTES (rfc3442)
index d4c483d69055a88c6a676b82921986d95880bed9..0e88af9e96ad85e7c51ff0b497ce71342d2d1568 100755 (executable)
@@ -19,14 +19,15 @@ proto_dhcp_init_config() {
        proto_config_add_string zone6rd
        proto_config_add_string zone
        proto_config_add_string mtu6rd
+       proto_config_add_string customroutes
 }
 
 proto_dhcp_setup() {
        local config="$1"
        local iface="$2"
 
-       local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd
-       json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd
+       local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
+       json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
 
        local opt dhcpopts
        for opt in $reqopts; do
@@ -44,6 +45,7 @@ proto_dhcp_setup() {
        [ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
        [ -n "$zone" ] && proto_export "ZONE=$zone"
        [ -n "$mtu6rd" ] && proto_export "MTU6RD=$mtu6rd"
+       [ -n "$customroutes" ] && proto_export "CUSTOMROUTES=$customroutes"
        [ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
 
        proto_export "INTERFACE=$config"