diff mbox

[OpenWrt-Devel] Patch to fix broken DHCP renewals with metric for AA

Message ID 397117601.14047954.1426269064973.JavaMail.root@saucontech.com
State Not Applicable
Headers show

Commit Message

Joseph Marlin March 13, 2015, 5:51 p.m. UTC
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. 






Thanks,
Joseph Marlin
Saucon Technologies

Comments

Felix Fietkau May 8, 2015, 12:06 p.m. UTC | #1
On 2015-03-13 18:51, Joseph Marlin wrote:
> 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. 
Is this issue still present in BB/CC?

- Felix
diff mbox

Patch

--- 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() {