aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/config/netifd/files
diff options
context:
space:
mode:
authorMogula Pranay <mogula.pranay@nxp.com>2018-01-09 11:43:29 +0530
committerHans Dedecker <dedeckeh@gmail.com>2018-01-10 09:19:08 +0100
commit012d20eebe3aec0818aa949eb7b14754640df797 (patch)
treefcac7d9d90081878d4930ea01c5cc76095dab4de /package/network/config/netifd/files
parent18f49449b0f5438ddf643e0473f35382e09ea4cb (diff)
downloadupstream-012d20eebe3aec0818aa949eb7b14754640df797.tar.gz
upstream-012d20eebe3aec0818aa949eb7b14754640df797.tar.bz2
upstream-012d20eebe3aec0818aa949eb7b14754640df797.zip
netifd: update dhcp.script to handle dynamic routing
Certain DHCP servers push a gateway outside of the assigned interface subnet, to support those situations, install a host route towards the gateway. If Gateway and IP are served in same network, openwrt quagga cannot learn routes (rip routes are not getting added, showing inactive) whereas working fine when Gateway and IP are in different network. Signed-off-by: Mogula Pranay <mogula.pranay@nxp.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'package/network/config/netifd/files')
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/dhcp.script8
1 files changed, 7 insertions, 1 deletions
diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script
index 24f243c2c7..00604f40e7 100755
--- a/package/network/config/netifd/files/lib/netifd/dhcp.script
+++ b/package/network/config/netifd/files/lib/netifd/dhcp.script
@@ -18,9 +18,15 @@ setup_interface () {
proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
# TODO: apply $broadcast
+ local ip_net
+ eval "$(ipcalc.sh "$ip/$mask")";ip_net="$NETWORK"
+
local i
for i in $router; do
- proto_add_ipv4_route "$i" 32 "" "$ip"
+ local gw_net
+ eval "$(ipcalc.sh "$i/$mask")";gw_net="$NETWORK"
+
+ [ "$ip_net" != "$gw_net" ] && proto_add_ipv4_route "$i" 32 "" "$ip"
proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
local r