odhcpd: don't kill static lease entries
authorSteven Barth <steven@midlink.org>
Sat, 23 Aug 2014 12:32:00 +0000 (14:32 +0200)
committerSteven Barth <steven@midlink.org>
Sat, 23 Aug 2014 12:32:00 +0000 (14:32 +0200)
src/dhcpv4.c

index 89750b23cbc3f73d77deed1b2ec35a2c5994beb8..fdf5f685189346fa99b703f7336a642a6fa29744 100644 (file)
@@ -611,10 +611,9 @@ static struct dhcpv4_assignment* dhcpv4_lease(struct interface *iface,
                if (assigned && a)
                        lease = a;
        } else if (msg == DHCPV4_MSG_RELEASE) {
-               if (a) {
+               if (a && a->valid_until != LONG_MAX)
                        a->valid_until = 0;
-               }
-       } else if (msg == DHCPV4_MSG_DECLINE) {
+       } else if (msg == DHCPV4_MSG_DECLINE && a->valid_until != LONG_MAX) {
                memset(a->hwaddr, 0, sizeof(a->hwaddr));
                a->valid_until = now + 3600; // Block address for 1h
        }