diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-10-08 08:49:26 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-10-08 08:49:26 +0000 |
commit | abf58d6ba5df9bbe04c4c7008cbbc8c7dc626392 (patch) | |
tree | c64a5328d250449c9a4e3964d59a657543e06440 /networking/udhcp/leases.c | |
parent | 751750e3ee0195eef802a1554e97712285bf8fd7 (diff) | |
download | busybox-w32-abf58d6ba5df9bbe04c4c7008cbbc8c7dc626392.tar.gz busybox-w32-abf58d6ba5df9bbe04c4c7008cbbc8c7dc626392.tar.bz2 busybox-w32-abf58d6ba5df9bbe04c4c7008cbbc8c7dc626392.zip |
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
Diffstat (limited to 'networking/udhcp/leases.c')
-rw-r--r-- | networking/udhcp/leases.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c index d478880a3..4da21a23b 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include "arpping.h" | 16 | #include "arpping.h" |
17 | #include "common.h" | 17 | #include "common.h" |
18 | 18 | ||
19 | #include "static_leases.h" | ||
20 | |||
19 | 21 | ||
20 | uint8_t blank_chaddr[] = {[0 ... 15] = 0}; | 22 | uint8_t blank_chaddr[] = {[0 ... 15] = 0}; |
21 | 23 | ||
@@ -134,6 +136,10 @@ uint32_t find_address(int check_expired) | |||
134 | /* ie, 192.168.55.255 */ | 136 | /* ie, 192.168.55.255 */ |
135 | if ((addr & 0xFF) == 0xFF) continue; | 137 | if ((addr & 0xFF) == 0xFF) continue; |
136 | 138 | ||
139 | /* Only do if it isn't an assigned as a static lease */ | ||
140 | if(!reservedIp(server_config.static_leases, htonl(addr))) | ||
141 | { | ||
142 | |||
137 | /* lease is not taken */ | 143 | /* lease is not taken */ |
138 | ret = htonl(addr); | 144 | ret = htonl(addr); |
139 | if ((!(lease = find_lease_by_yiaddr(ret)) || | 145 | if ((!(lease = find_lease_by_yiaddr(ret)) || |
@@ -147,5 +153,6 @@ uint32_t find_address(int check_expired) | |||
147 | break; | 153 | break; |
148 | } | 154 | } |
149 | } | 155 | } |
156 | } | ||
150 | return 0; | 157 | return 0; |
151 | } | 158 | } |