diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-04-22 15:02:43 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-04-22 15:02:43 +0000 |
commit | 92c3a6b185c40b1334c4d5734428d2f3d1e9fa2a (patch) | |
tree | 0131f9d71c2e18b28c1c376681de9c61a7f19cd0 /usr.sbin | |
parent | 9a6987bd55f65c729603d2018fa5b964c5dffa02 (diff) |
When sync'ing, look for lease by hwaddr and then ipaddr. Not hwaddr
twice. Simplify logic. Fixes loops while sync'ing for sthen@.
Spotted by & fixed tested by sthen@.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dhcpd/sync.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/usr.sbin/dhcpd/sync.c b/usr.sbin/dhcpd/sync.c index 6890dd24410..e436d848e7c 100644 --- a/usr.sbin/dhcpd/sync.c +++ b/usr.sbin/dhcpd/sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sync.c,v 1.12 2013/04/13 18:08:47 krw Exp $ */ +/* $OpenBSD: sync.c,v 1.13 2013/04/22 15:02:42 krw Exp $ */ /* * Copyright (c) 2008 Bob Beck <beck@openbsd.org> @@ -299,19 +299,11 @@ sync_recv(void) lv = (struct dhcp_synctlv_lease *)tlv; if (sizeof(*lv) > ntohs(tlv->st_length)) goto trunc; - if ((lease = find_lease_by_hw_addr( - lv->lv_hardware_addr.haddr, - lv->lv_hardware_addr.hlen)) == NULL) { - if ((lease = find_lease_by_hw_addr( - lv->lv_hardware_addr.haddr, - lv->lv_hardware_addr.hlen)) == NULL) - { - lp = &l; - memset(lp, 0, sizeof(*lp)); - } else - lp = lease; - } else - lp = lease; + lease = find_lease_by_hw_addr( + lv->lv_hardware_addr.haddr, + lv->lv_hardware_addr.hlen); + if (lease == NULL) + lease = find_lease_by_ip_addr(lv->lv_ip_addr); lp = &l; memset(lp, 0, sizeof(*lp)); |