diff options
-rw-r--r-- | apps/ChangeLog.txt | 2 | ||||
-rw-r--r-- | apps/netutils/dhcpd/dhcpd.c | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 72db3df36..7a4441591 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -626,4 +626,6 @@ * apps/examples/usbmsc: apps/examples/usbstorage renamed usbmsc. Change submitted by CCTSAO (2013-6-5). * apps/examples/pwm: Clean-up some configuration confusion (2013-9-5). + * apps/netutils/dhcpd/dhcpd.c: Fix calculation of the next lease + address. SourceForge bug #21 from Paolo Messina (2013-9-6). diff --git a/apps/netutils/dhcpd/dhcpd.c b/apps/netutils/dhcpd/dhcpd.c index d9143288d..ce11ee248 100644 --- a/apps/netutils/dhcpd/dhcpd.c +++ b/apps/netutils/dhcpd/dhcpd.c @@ -1,7 +1,7 @@ /**************************************************************************** * netutils/dhcpd/dhcpd.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -363,11 +363,11 @@ struct lease_s *dhcpd_setlease(const uint8_t *mac, in_addr_t ipaddr, time_t expi * Name: dhcp_leaseipaddr ****************************************************************************/ -static inline in_addr_t dhcp_leaseipaddr( struct lease_s *lease) +static inline in_addr_t dhcp_leaseipaddr(struct lease_s *lease) { /* Return IP address in host order */ - return (g_state.ds_leases - lease)/sizeof(struct lease_s) + CONFIG_NETUTILS_DHCPD_STARTIP; + return (in_addr_t)(lease - g_state.ds_leases) + CONFIG_NETUTILS_DHCPD_STARTIP; } /**************************************************************************** |