[OpenWrt-Devel] Patch to fix broken DHCP renewals with metric for AA
Joseph Marlin
jmarlin at saucontech.com
Fri Mar 13 13:51:04 EDT 2015
Below is a patch to fix a bug I ran into on Attitude Adjustment.
When a DHCP interface with a metric assigned to it attempted to renew its lease, the default route was removed and not re-added. However, removing the metric from the interface would result in the default route correctly being re-added after a lease.
I found that the metric was not being passed to the netifd-proto function "proto_add_ipv4_route" that creates the string that "_proto_push_route" uses to create the JSON sent to ubus.
--- netifd_original/dhcp.script 2015-03-13 12:02:59.253887867 -0400
+++ netifd/dhcp.script 2015-03-13 11:58:23.706166086 -0400
@@ -19,8 +19,11 @@
proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
# TODO: apply $broadcast
+ #Fix missing metric parameter
+ metric="$(uci -q get network.$INTERFACE.metric)"
+
for i in $router; do
- proto_add_ipv4_route 0.0.0.0 0 "$i"
+ proto_add_ipv4_route 0.0.0.0 0 "$i" "$metric"
done
# CIDR STATIC ROUTES (rfc3442)
--- netifd_original/netifd-proto.sh 2015-03-13 12:03:14.342091592 -0400
+++ netifd/netifd-proto.sh 2015-03-13 11:47:10.585079439 -0400
@@ -134,7 +134,10 @@
local mask="$2"
local gw="$3"
- append PROTO_ROUTE "$target/$mask/$gw//"
+ #Fix missing metric parameter
+ local metric="$4"
+
+ append PROTO_ROUTE "$target/$mask/$gw/$metric/"
}
proto_add_ipv6_route() {
Thanks,
Joseph Marlin
Saucon Technologies
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list