diff options
author | 2008-05-07 12:19:20 +0000 | |
---|---|---|
committer | 2008-05-07 12:19:20 +0000 | |
commit | 5f515bebfbc9b723b65ade175c407708da91f729 (patch) | |
tree | 0fa55cc0770ab12fb466af1503df536b0b0341a1 /usr.sbin/dhcpd/dhcp.c | |
parent | Ref to ripd instead of routed. (diff) | |
download | wireguard-openbsd-5f515bebfbc9b723b65ade175c407708da91f729.tar.xz wireguard-openbsd-5f515bebfbc9b723b65ade175c407708da91f729.zip |
Add synchronisation support for dhcpd - this allows for two dhcpd's
with the same configuration to be run on the same net and they will
keep their lease files/state in synch, and therefore allowing you to
run redundant dhcpd's. Synchronization code stolen from spamd, uses
an hmac key in /var/db/dhcpd.key if it exists.
ok krw@ deraadt@
Diffstat (limited to 'usr.sbin/dhcpd/dhcp.c')
-rw-r--r-- | usr.sbin/dhcpd/dhcp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c index b81e1e2330a..c3f5df5901a 100644 --- a/usr.sbin/dhcpd/dhcp.c +++ b/usr.sbin/dhcpd/dhcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcp.c,v 1.25 2006/12/15 16:03:16 stevesk Exp $ */ +/* $OpenBSD: dhcp.c,v 1.26 2008/05/07 12:19:20 beck Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -39,6 +39,7 @@ */ #include "dhcpd.h" +#include "sync.h" int outstanding_pings; @@ -334,6 +335,7 @@ dhcprequest(struct packet *packet) !memcmp(lease->hardware_addr.haddr, packet->raw->chaddr, packet->raw->hlen)))) { ack_lease(packet, lease, DHCPACK, 0); + sync_lease(lease); return; } @@ -346,8 +348,10 @@ dhcprequest(struct packet *packet) * The thing we probably should not do is to remain silent. * For now, we'll just assign the lease to the client anyway. */ - if (lease) + if (lease) { ack_lease(packet, lease, DHCPACK, 0); + sync_lease(lease); + } } void |