Re: NetComm modems/routers reject unrecognised leases in a way that confuses 'dhcpcd'
Roy Marples
Wed Mar 23 02:01:48 2011On Wed, 2011-03-23 at 11:34 +1100, Xavion wrote: > Just to be clear, I wasn't requesting that you make '-k' the default > within 'dhcpcd'. I was simply quoting a request I'd made to the > NetworkManager and Arch Linux bug trackers in the hope that they would > terminate 'dhcpcd' differently. I also disagree with that :) > Thanks for making a patch that'll fix this problem at your end. There > would be plenty of other affected users, most of whom probably don't > understand what's causing it. For the sake of privacy, I'll send the > TCP dump to you in a separate email. Thanks for the trace. Attached is a patch which should fix this for you. We can't treat it as a NAK though, so what happens is that the reboot will timeout and we'll drop into discover again. Let me know if it works or not, ideally soon as I'd like to get this into the next release. Thanks Roy
diff --git a/dhcpcd.c b/dhcpcd.c
index a367202..ade5e62 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -528,7 +528,17 @@ handle_dhcp(struct interface *iface, struct dhcp_message **dhcpp, const struct i
log_dhcp(LOG_WARNING, "reject DHCP", iface, dhcp, from);
return;
}
- }
+ }
+
+ /* Ensure that the address offered is valid */
+ if ((type == 0 || type == DHCP_OFFER || type == DHCP_ACK) &&
+ (dhcp->ciaddr == INADDR_ANY || dhcp->ciaddr == INADDR_BROADCAST) &&
+ (dhcp->yiaddr == INADDR_ANY || dhcp->yiaddr == INADDR_BROADCAST))
+ {
+ log_dhcp(LOG_WARNING, "reject invalid address",
+ iface, dhcp, from);
+ return;
+ }
/* No NAK, so reset the backoff */
state->nakoff = 1;
Archive administrator: postmaster@marples.name