OpenBSD CVS

CVS log for src/usr.sbin/dhcpd/dispatch.c


[BACK] Up to [local] / src / usr.sbin / dhcpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.45 / (download) - annotate - [select for diffs], Sat Sep 2 10:18:45 2023 UTC (9 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.44: +2 -4 lines
Diff to previous 1.44 (colored)

Fix comment about skipped interfaces

After r1.44 "Start on DOWN interfaces" this sentence makes no sense
and just repeats the obvious conditions, so zap it.

With/OK stsp

Revision 1.44 / (download) - annotate - [select for diffs], Sat Nov 20 11:47:02 2021 UTC (2 years, 6 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.43: +2 -3 lines
Diff to previous 1.43 (colored)

Start on DOWN interfaces

Do not skip interfaces during startup because they're not UP.

dhcpd(8) can start listening on such interfaces just fine (given suitable
IPs on them) and interfaces may come UP later in time.

Otherwise dhcpd would fail to start completely if it didn't find any
interface that would be UP early on and administrators had to restart dhcpd.

Other daemons and nc(1)'s `-l' listen just fine on DOWN interfaces as well.

Noticed while switching a bridge(4)/vether(4) setup to veb(4)/vport(4) and
hostname.vport without explicit "up" (vport does not implicitly pulls itself
UP when configuring an address).

OK dlg florian

Revision 1.43 / (download) - annotate - [select for diffs], Wed Apr 12 19:17:30 2017 UTC (7 years, 1 month ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.42: +5 -5 lines
Diff to previous 1.42 (colored)

One 'foo' per function is enough. Rename one to eliminate shadowing.

Revision 1.42 / (download) - annotate - [select for diffs], Mon Feb 13 23:04:05 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.41: +5 -6 lines
Diff to previous 1.41 (colored)

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

Revision 1.41 / (download) - annotate - [select for diffs], Mon Feb 13 22:33:39 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.40: +8 -6 lines
Diff to previous 1.40 (colored)

Adjust some long lines.

Revision 1.40 / (download) - annotate - [select for diffs], Mon Feb 13 21:53:53 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.39: +2 -3 lines
Diff to previous 1.39 (colored)

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

Revision 1.39 / (download) - annotate - [select for diffs], Mon Feb 13 19:13:14 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.38: +21 -20 lines
Diff to previous 1.38 (colored)

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

ok benno@

Revision 1.38 / (download) - annotate - [select for diffs], Tue Nov 15 10:49:37 2016 UTC (7 years, 6 months ago) by mestre
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

Replace bzero(3) with memset(3)

"Looks good" to deraadt@

Revision 1.37 / (download) - annotate - [select for diffs], Sat Aug 27 01:26:22 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.36: +2 -1 lines
Diff to previous 1.36 (colored)

Pull in <time.h> for one or more of gmtime, strftime, strptime, time,
timegm, and tzset

ok deraadt@

Revision 1.36 / (download) - annotate - [select for diffs], Sat Feb 6 23:50:10 2016 UTC (8 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.35: +25 -5 lines
Diff to previous 1.35 (colored)

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 1.35 / (download) - annotate - [select for diffs], Thu Aug 20 22:39:29 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +4 -4 lines
Diff to previous 1.34 (colored)

stdlib.h is in scope; do not cast malloc/calloc/realloc*
ok millert krw

Revision 1.34 / (download) - annotate - [select for diffs], Wed Oct 8 04:26:07 2014 UTC (9 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

use reallocarray() to cope with multiplicative integer overflow; ok doug

Revision 1.33 / (download) - annotate - [select for diffs], Mon May 5 18:30:44 2014 UTC (10 years, 1 month ago) by pelikan
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.32: +5 -11 lines
Diff to previous 1.32 (colored)

Don't call the BOOTP handler indirectly.

ok krw

Revision 1.32 / (download) - annotate - [select for diffs], Fri Oct 18 15:19:39 2013 UTC (10 years, 7 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

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

Revision 1.31 / (download) - annotate - [select for diffs], Thu May 16 19:24:12 2013 UTC (11 years ago) by gerhard
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.30: +2 -1 lines
Diff to previous 1.30 (colored)

poll(2) might have slept for an arbitrary amount of time. We should
update 'cur_time' after poll(2) returns.

ok otto

Revision 1.30 / (download) - annotate - [select for diffs], Fri Apr 19 21:25:39 2013 UTC (11 years, 1 month ago) by sthen
Branch: MAIN
Changes since 1.29: +3 -1 lines
Diff to previous 1.29 (colored)

Log (at LOG_INFO) which interfaces dhcpd listens to and (as suggested by
krw) their address. As dhcpd uses BPF, it's not possible to find this
information out from fstat/netstat.  ok krw@

Revision 1.29 / (download) - annotate - [select for diffs], Sat Nov 12 15:39:52 2011 UTC (12 years, 6 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored)

Zero option processing stack storage to prevent stack garbage that
happens to look like options from being processed as options when
truncated packets received.

Potential problem pointed out by mikeb@, from a couple of NIST
reports (CVE-2011-2748 and CVE-2011-2749).

Revision 1.28 / (download) - annotate - [select for diffs], Fri Nov 19 08:00:56 2010 UTC (13 years, 6 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.27: +3 -2 lines
Diff to previous 1.27 (colored)

Prevent dhcpd(8) from trying to listen on interfaces that don't have a
valid broadcast (e.g. pflog0).

"no objection" krw@, ok claudio@

Revision 1.27 / (download) - annotate - [select for diffs], Sat Jul 3 04:44:51 2010 UTC (13 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains.  This changes the name of the
system calls, socket option, and ioctl.  After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me

Revision 1.26 / (download) - annotate - [select for diffs], Mon Apr 19 12:22:09 2010 UTC (14 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.25: +34 -3 lines
Diff to previous 1.25 (colored)

If interfaces are specified, get their rdomain and bind dhcpd into the same
domain with setrdomain(). This allows to run dhcpd on multiple rdomains.
OK krw@

Revision 1.25 / (download) - annotate - [select for diffs], Sat Jan 2 04:21:16 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.24: +2 -3 lines
Diff to previous 1.24 (colored)

Eliminate all uses of dmalloc() where the returned pointer
is checked for NULL and a specific error/warning issued. Add
two such manual warning/error checks and kill those dmalloc
calls. And then there were none, so kill dmalloc(). Whew.

Revision 1.24 / (download) - annotate - [select for diffs], Mon Sep 15 20:38:17 2008 UTC (15 years, 8 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

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 1.23 / (download) - annotate - [select for diffs], Wed May 7 12:19:20 2008 UTC (16 years, 1 month ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.22: +15 -1 lines
Diff to previous 1.22 (colored)

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 1.22 / (download) - annotate - [select for diffs], Tue Dec 12 19:38:55 2006 UTC (17 years, 6 months ago) by stevesk
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.21: +1 -8 lines
Diff to previous 1.21 (colored)

remove unused #defines; no binary change

Revision 1.21 / (download) - annotate - [select for diffs], Tue May 30 23:43:46 2006 UTC (18 years ago) by ckuethe
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.20: +7 -7 lines
Diff to previous 1.20 (colored)

This patch renames dhcpd's "struct timeout" to "struct dhcpd_timeout"
so as not to conflict with "struct timeout" from <sys/timeout.h>.
ok henning@

Revision 1.20 / (download) - annotate - [select for diffs], Sat May 27 19:52:23 2006 UTC (18 years ago) by krw
Branch: MAIN
Changes since 1.19: +16 -16 lines
Diff to previous 1.19 (colored)

Don't exit just because an interface has no subnet configured in
dhcpd.conf. Just don't listen on that interface.

Make warning messages textually consistant.

tested & ok beck@

Revision 1.19 / (download) - annotate - [select for diffs], Sat May 27 04:01:04 2006 UTC (18 years ago) by krw
Branch: MAIN
Changes since 1.18: +4 -4 lines
Diff to previous 1.18 (colored)

When an interface is ignored because it has no IP address, say so.
Don't just say 'not found". And always complain, not just when
specific interfaces were requested.

requested by and ok uwe@

Revision 1.18 / (download) - annotate - [select for diffs], Thu May 11 01:19:08 2006 UTC (18 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.17: +23 -30 lines
Diff to previous 1.17 (colored)

If a list of interfaces is supplied via the command line or
dhcpd.interfaces then

a) don't bother looking up information on interfaces that were not
requested;

b) don't exit if a requested interface is not found, just issue a
warning message;

c) exit if none of the interfaces were found.

The command line for dhcpd shown in ps will continue to show requested
but ignored interfaces.

As usual with dhc* code, whack a bunch of unused states, constants,
flags, etc. Since we only invoke discover_interfaces() with
DISCOVER_SERVER, there is no need to keep track of other
possibilities.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Mar 16 15:44:40 2006 UTC (18 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

KNF. No binary change.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Jan 31 18:27:38 2005 UTC (19 years, 4 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.15: +26 -34 lines
Diff to previous 1.15 (colored)

Don't malloc fds each time, just realloc() as needed.
There's no need to clear revents -- poll() does that for us.
Move setting of cur_time to the top of the loop for better accuracy.
When poll returns 0, don't check revents since we know none were set.

Revision 1.15 / (download) - annotate - [select for diffs], Sun Oct 31 10:43:38 2004 UTC (19 years, 7 months ago) by canacar
Branch: MAIN
Changes since 1.14: +1 -3 lines
Diff to previous 1.14 (colored)

change the undocumented -t flag to -n used for configuration testing
and document it. cleanup some unused/unneeded variables while there.
idea & ok henning@

Revision 1.14 / (download) - annotate - [select for diffs], Tue Sep 21 04:07:04 2004 UTC (19 years, 8 months ago) by david
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

spelling fixes; ok jmc@ henning@

Revision 1.13 / (download) - annotate - [select for diffs], Thu Sep 16 18:35:43 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +8 -8 lines
Diff to previous 1.12 (colored)

avoid aliasing with libc functions; ok henning

Revision 1.12 / (download) - annotate - [select for diffs], Thu Sep 16 09:35:24 2004 UTC (19 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.11: +2 -6 lines
Diff to previous 1.11 (colored)

Remove the not initialized fallback_interface code and use the normal bpf
interface for that. Also store the hardware (ethernet) address in the state
so that relayed dhcp request are sent to the correct destination.
OK henning@ requested by deraadt@ tested otto@

Revision 1.11 / (download) - annotate - [select for diffs], Wed Sep 15 22:12:50 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

size_t vs ssize_t confusion

Revision 1.10 / (download) - annotate - [select for diffs], Tue May 25 17:41:54 2004 UTC (20 years ago) by canacar
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

handle interface removals gracefully. reported by Oliver J. Morais
ok henning@, tedu@

Revision 1.9 / (download) - annotate - [select for diffs], Tue May 4 20:28:40 2004 UTC (20 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.8: +1 -27 lines
Diff to previous 1.8 (colored)

remove things not used, spotted by lint mostly; ok henning

Revision 1.8 / (download) - annotate - [select for diffs], Tue Apr 20 05:35:33 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.7: +1 -3 lines
Diff to previous 1.7 (colored)

$OpenBSD$

Revision 1.7 / (download) - annotate - [select for diffs], Sun Apr 18 01:19:07 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.6: +8 -6 lines
Diff to previous 1.6 (colored)

more KNF

Revision 1.6 / (download) - annotate - [select for diffs], Sun Apr 18 00:43:27 2004 UTC (20 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.5: +9 -10 lines
Diff to previous 1.5 (colored)

various knf; henning ok

Revision 1.5 / (download) - annotate - [select for diffs], Fri Apr 16 04:30:09 2004 UTC (20 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.4: +220 -233 lines
Diff to previous 1.4 (colored)

a bunch of knf, ok henning

Revision 1.4 / (download) - annotate - [select for diffs], Wed Apr 14 04:34:19 2004 UTC (20 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +14 -16 lines
Diff to previous 1.3 (colored)

spaces

Revision 1.3 / (download) - annotate - [select for diffs], Wed Apr 14 00:56:02 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.2: +5 -6 lines
Diff to previous 1.2 (colored)

more crap bites the dust

Revision 1.2 / (download) - annotate - [select for diffs], Tue Apr 13 23:57:49 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

time_t and kill a few dumb defines

Revision 1.1 / (download) - annotate - [select for diffs], Tue Apr 13 23:41:48 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN

may the whacking begin

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.