aboutsummaryrefslogtreecommitdiff
path: root/lease.c
diff options
context:
space:
mode:
authorSUZUKI, Shinsuke <suz@kame.net>2007-03-22 05:26:21 +0000
committerBjørn Mork <bjorn@mork.no>2010-08-06 15:37:36 +0200
commitfe3d6ca944917ec34247e029218f8ca11975cc30 (patch)
treebd57455abdc29aaa0ebf02039e1985d8ca45a8be /lease.c
parent484766b9467ac3a3e35eb465da6bfd825f749bd5 (diff)
implemented DHCPv6 Decline message processing on DHCPv6 server.
Diffstat (limited to 'lease.c')
-rw-r--r--lease.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lease.c b/lease.c
index fdf3d37..d46ddfd 100644
--- a/lease.c
+++ b/lease.c
@@ -56,8 +56,12 @@
struct hash_entry {
LIST_ENTRY(hash_entry) list;
char *val;
+ char flag; /* 0x01: DHCP6_LEASE_DECLINED */
};
+/* marked as declined (e.g. someone has been using the same address) */
+#define DHCP6_LEASE_DECLINED 0x01
+
LIST_HEAD(hash_head, hash_entry);
typedef unsigned int (*pfn_hash_t)(void *val) ;
@@ -141,6 +145,27 @@ release_address(addr)
}
}
+void
+decline_address(addr)
+ struct in6_addr *addr;
+{
+ struct hash_entry *entry;
+
+ if (!addr)
+ return;
+
+ dprintf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
+
+ entry = hash_table_find(&dhcp6_lease_table, addr);
+ if (entry == NULL) {
+ dprintf(LOG_WARNING, FNAME, "not found: %s",
+ in6addr2str(addr, 0));
+ return;
+ }
+
+ entry->flag |= DHCP6_LEASE_DECLINED;
+}
+
int
is_leased(addr)
struct in6_addr *addr;