Wade Berrier writes:
Hello, Here's a patch for a first attempt at static leases for udhcpd. Included in the tarball are 2 files (static_leases.c, static_leases.h) and a patch against the latest cvs. In the config file you can configure static leases with the following format: static_lease 00:60:08:11:CE:4E 192.168.0.54 static_lease 00:60:08:11:CE:3E 192.168.0.44 Comments/suggestions/improvements are welcome. Wade
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
#include "arpping.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "static_leases.h"
|
||||
|
||||
|
||||
uint8_t blank_chaddr[] = {[0 ... 15] = 0};
|
||||
|
||||
@@ -134,6 +136,10 @@ uint32_t find_address(int check_expired)
|
||||
/* ie, 192.168.55.255 */
|
||||
if ((addr & 0xFF) == 0xFF) continue;
|
||||
|
||||
/* Only do if it isn't an assigned as a static lease */
|
||||
if(!reservedIp(server_config.static_leases, htonl(addr)))
|
||||
{
|
||||
|
||||
/* lease is not taken */
|
||||
ret = htonl(addr);
|
||||
if ((!(lease = find_lease_by_yiaddr(ret)) ||
|
||||
@@ -147,5 +153,6 @@ uint32_t find_address(int check_expired)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user