History log of /openbsd-current/usr.sbin/dhcpd/sync.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.24 05-Jan-2022 tb

dhcpd: straightforward conversion to HMAC_CTX on the heap, similar
to what was done in spamd a while back.

ok florian


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.23 13-Feb-2017 krw

Eliminate pointless'%m' (a.k.a. hand rolled strerror()) by using fatal() and
log_warn(). Zap a couple of explicit 'syslog()' calls.


# 1.22 13-Feb-2017 krw

Adjust some long lines.


# 1.21 13-Feb-2017 krw

Do the strerror() elimination dance with log_warnx() -> log_warn(),
fatalx() -> fatal() and even a couple of fprintf(stderr) -> log_warn().


# 1.20 13-Feb-2017 krw

Switch from old errwarn.c logging to shiny new log.[ch].

ok benno@


# 1.19 21-Oct-2016 mestre

- Use memset(*b, 0, len) instead of bzero(*b, len)
- Use explicit_bzero(3) instead of bzero(3) to clean temporary HMAC

OK krw@


# 1.18 04-Oct-2016 krw

Zap stray whitespace.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Feb-2016 krw

Eliminate #include inside *.h files and include only needed headers in
each *.c file.

Inspired by mention of header silliness by Edgar Pettijohn and mmcc@
on tech@.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.15 18-Oct-2013 krw

Scattering a few bcopy()'s around source using mostly memcpy() is just
asking for confusion. Replace bcopy()'s with memcpy()'s.


# 1.14 18-Oct-2013 krw

%d -> %lld, add (long long) cast to time_t variables. Make guenther
and gcc happier. Found while looking at something else for dlg@.


Revision tags: OPENBSD_5_4_BASE
# 1.13 22-Apr-2013 krw

When sync'ing, look for lease by hwaddr and then ipaddr. Not hwaddr
twice. Simplify logic. Fixes loops while sync'ing for sthen@.

Spotted by & fixed tested by sthen@.


# 1.12 13-Apr-2013 krw

Give struct dhcp_synctlv_lease fields a prefix (lv_) as the fields
in other structs have. Reduces potential for confusion with fields
of same name but different types in leases. Use consistent variable
name. No change to executable.


# 1.11 12-Apr-2013 krw

Unbreak lease synchronization by making the sync header contain the
correct packet length even when paddding is present. Previously the
HMAC calculated by the receiver would not be based on the whole
packet.

Problem noted and essentially identical diffs from Kapetanakis Giannis
via misc@ and then Johan Ymerson via bugs@.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.10 23-Dec-2010 claudio

Use the provided note() and warning() functions of dhcpd instead of
calling syslog_r() directly -- this make -d work as expected.
OK reyk@, stsp@, deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.9 27-Mar-2010 krw

malloc/strlcpy -> strdup. Use consistent idiom.

ok (as part of larger diff) blambert@ kettenis@ stsp@ zinovik@


Revision tags: OPENBSD_4_7_BASE
# 1.8 03-Jan-2010 deraadt

unused prototype


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.7 15-Sep-2008 claudio

When checking if a syscall like open(), ioctl() or writev() failed compare
directly against -1 and do not use a < 0 test. OK henning@


Revision tags: OPENBSD_4_4_BASE
# 1.6 30-May-2008 deraadt

correct size of iov[]; ralf.horstmann@gmx.de


# 1.5 11-May-2008 beck

fix sync.c to not puke if sync_lease called without sync_init.
from henric.


# 1.4 08-May-2008 deraadt

Insert pad blocks after sub-messages to keep the structures aligned to
16 byte boundaries for maximum portability (somewhat similar to CMSG's)
ok beck


# 1.3 08-May-2008 beck

this should really only be in one file.


# 1.2 08-May-2008 beck

don't break dhcpd when not using synch mechanisms..


# 1.1 07-May-2008 beck

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@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.23 13-Feb-2017 krw

Eliminate pointless'%m' (a.k.a. hand rolled strerror()) by using fatal() and
log_warn(). Zap a couple of explicit 'syslog()' calls.


# 1.22 13-Feb-2017 krw

Adjust some long lines.


# 1.21 13-Feb-2017 krw

Do the strerror() elimination dance with log_warnx() -> log_warn(),
fatalx() -> fatal() and even a couple of fprintf(stderr) -> log_warn().


# 1.20 13-Feb-2017 krw

Switch from old errwarn.c logging to shiny new log.[ch].

ok benno@


# 1.19 21-Oct-2016 mestre

- Use memset(*b, 0, len) instead of bzero(*b, len)
- Use explicit_bzero(3) instead of bzero(3) to clean temporary HMAC

OK krw@


# 1.18 04-Oct-2016 krw

Zap stray whitespace.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 06-Feb-2016 krw

Eliminate #include inside *.h files and include only needed headers in
each *.c file.

Inspired by mention of header silliness by Edgar Pettijohn and mmcc@
on tech@.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.15 18-Oct-2013 krw

Scattering a few bcopy()'s around source using mostly memcpy() is just
asking for confusion. Replace bcopy()'s with memcpy()'s.


# 1.14 18-Oct-2013 krw

%d -> %lld, add (long long) cast to time_t variables. Make guenther
and gcc happier. Found while looking at something else for dlg@.


Revision tags: OPENBSD_5_4_BASE
# 1.13 22-Apr-2013 krw

When sync'ing, look for lease by hwaddr and then ipaddr. Not hwaddr
twice. Simplify logic. Fixes loops while sync'ing for sthen@.

Spotted by & fixed tested by sthen@.


# 1.12 13-Apr-2013 krw

Give struct dhcp_synctlv_lease fields a prefix (lv_) as the fields
in other structs have. Reduces potential for confusion with fields
of same name but different types in leases. Use consistent variable
name. No change to executable.


# 1.11 12-Apr-2013 krw

Unbreak lease synchronization by making the sync header contain the
correct packet length even when paddding is present. Previously the
HMAC calculated by the receiver would not be based on the whole
packet.

Problem noted and essentially identical diffs from Kapetanakis Giannis
via misc@ and then Johan Ymerson via bugs@.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.10 23-Dec-2010 claudio

Use the provided note() and warning() functions of dhcpd instead of
calling syslog_r() directly -- this make -d work as expected.
OK reyk@, stsp@, deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.9 27-Mar-2010 krw

malloc/strlcpy -> strdup. Use consistent idiom.

ok (as part of larger diff) blambert@ kettenis@ stsp@ zinovik@


Revision tags: OPENBSD_4_7_BASE
# 1.8 03-Jan-2010 deraadt

unused prototype


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.7 15-Sep-2008 claudio

When checking if a syscall like open(), ioctl() or writev() failed compare
directly against -1 and do not use a < 0 test. OK henning@


Revision tags: OPENBSD_4_4_BASE
# 1.6 30-May-2008 deraadt

correct size of iov[]; ralf.horstmann@gmx.de


# 1.5 11-May-2008 beck

fix sync.c to not puke if sync_lease called without sync_init.
from henric.


# 1.4 08-May-2008 deraadt

Insert pad blocks after sub-messages to keep the structures aligned to
16 byte boundaries for maximum portability (somewhat similar to CMSG's)
ok beck


# 1.3 08-May-2008 beck

this should really only be in one file.


# 1.2 08-May-2008 beck

don't break dhcpd when not using synch mechanisms..


# 1.1 07-May-2008 beck

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@