summaryrefslogtreecommitdiff
path: root/networking/udhcp/leases.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/leases.c')
-rw-r--r--networking/udhcp/leases.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index c5b60b1..745340a 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -112,7 +112,7 @@ struct dyn_lease* FAST_FUNC find_lease_by_nip(uint32_t nip)
}
/* Check if the IP is taken; if it is, add it to the lease table */
-static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac)
+static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac, unsigned arpping_ms)
{
struct in_addr temp;
int r;
@@ -120,7 +120,8 @@ static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac)
r = arpping(nip, safe_mac,
server_config.server_nip,
server_config.server_mac,
- server_config.interface);
+ server_config.interface,
+ arpping_ms);
if (r)
return r;
@@ -132,7 +133,7 @@ static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac)
}
/* Find a new usable (we think) address */
-uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac)
+uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac, unsigned arpping_ms)
{
uint32_t addr;
struct dyn_lease *oldest_lease = NULL;
@@ -177,7 +178,7 @@ uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac)
lease = find_lease_by_nip(nip);
if (!lease) {
//TODO: DHCP servers do not always sit on the same subnet as clients: should *ping*, not arp-ping!
- if (nobody_responds_to_arp(nip, safe_mac))
+ if (nobody_responds_to_arp(nip, safe_mac, arpping_ms))
return nip;
} else {
if (!oldest_lease || lease->expires < oldest_lease->expires)
@@ -194,7 +195,7 @@ uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac)
if (oldest_lease
&& is_expired_lease(oldest_lease)
- && nobody_responds_to_arp(oldest_lease->lease_nip, safe_mac)
+ && nobody_responds_to_arp(oldest_lease->lease_nip, safe_mac, arpping_ms)
) {
return oldest_lease->lease_nip;
}