udhcpd: discard saved leases if conflicting with static_lease config

Hi All,

There's a FIXME in udhcpd which describes a small corner case when saved leases are read and honoured even if the IP or MAC of that lease overlaps a static_lease from the config file.  I found that because of this, after updating config and restarting udhcpd, a client which already had a lease can continue to renew that lease instead of either getting the IP specified in a new 'static_lease' config item, or being nak'd and assigned a new free IP.

Following is a small patch which removes the FIXME and adds a check to discard saved lease records if they would conflict with a static_lease from the config file.

In my configuration, this added 48 bytes to the stripped executable.  I tested it by defining a /24 subnet and adding static_lease records for all but 1 on the available IP addresses, and then moving that 1 available IP around while reconnecting a single client.  After the patch, verbose logging and Wireshark show NAK and then offering of the single free address, with the client having it's IP updated each time ipconfig /renew is issued.

Please consider for inclusion to busybox.

Kind Regards,

Mike

Signed-off-by: Michael McTernan <Michael.McTernan.2001@cs.bris.ac.uk>