OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.59 / (download) - annotate - [select for diffs], Fri Oct 6 05:31:54 2023 UTC (8 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

add -v to usage();

Revision 1.58 / (download) - annotate - [select for diffs], Thu Oct 5 18:46:14 2023 UTC (8 months ago) by mvs
Branch: MAIN
Changes since 1.57: +15 -12 lines
Diff to previous 1.57 (colored)

Do log output to stderr while running dhcpd(8) in foreground to make
behaviour in accordance with man page. Introduce '-v' option to make
output more verbose.

Do a little refactoring to make code more consistent with other daemons
like ospfd(8), httpd(8), relayd(8), etc.

Feedback from bluhm benno

ok bluhm

Revision 1.57 / (download) - annotate - [select for diffs], Tue Aug 6 11:07:37 2019 UTC (4 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, 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
Changes since 1.56: +3 -4 lines
Diff to previous 1.56 (colored)

Use pw->pw_dir when chroot'ing, not _PATH_VAREMPTY.

Brings various dhcp related daemons into line with
the common idiom.

ok florian@

Revision 1.56 / (download) - annotate - [select for diffs], Thu Feb 16 00:24:43 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: 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, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.55: +1 -4 lines
Diff to previous 1.55 (colored)

Bring parse_warn() into the log.[ch] 21st century and adopt the "^"
placement logic from dhclient.

Revision 1.55 / (download) - annotate - [select for diffs], Mon Feb 13 23:04:05 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.54: +7 -7 lines
Diff to previous 1.54 (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.54 / (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.53: +7 -6 lines
Diff to previous 1.53 (colored)

Adjust some long lines.

Revision 1.53 / (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.52: +20 -18 lines
Diff to previous 1.52 (colored)

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

ok benno@

Revision 1.52 / (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.51: +2 -1 lines
Diff to previous 1.51 (colored)

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

ok deraadt@

Revision 1.51 / (download) - annotate - [select for diffs], Wed Apr 27 10:16:10 2016 UTC (8 years, 1 month ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.50: +2 -6 lines
Diff to previous 1.50 (colored)

Remove pledge(2)'s that are called before chroot(2) since in the near future
this will be forbidden. The remaining pledge(2) calls after chroot(2) are still
kept.

OK semarie@ "it is time now"

Revision 1.50 / (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_5_9_BASE, OPENBSD_5_9
Changes since 1.49: +20 -3 lines
Diff to previous 1.49 (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.49 / (download) - annotate - [select for diffs], Mon Dec 14 01:08:50 2015 UTC (8 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.48: +23 -10 lines
Diff to previous 1.48 (colored)

pledge.

Diff from Ricardo Mestre. Test report from sthen@.

Revision 1.48 / (download) - annotate - [select for diffs], Tue Feb 10 23:06:13 2015 UTC (9 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.47: +6 -6 lines
Diff to previous 1.47 (colored)

Keep track of the last time we scanned the leases to find expired
ones that needed to be booted out of the pf table process. This
avoids removing the same addess over and over.

Problem report and original diff from Bertrand Provost.

Revision 1.47 / (download) - annotate - [select for diffs], Sat Feb 7 10:49:09 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.46: +3 -1 lines
Diff to previous 1.46 (colored)

Close appropriate ends of pfpipe. Lets pf table process die when dhcpd
does.

Pointed out by Bertrand Provost.

ok henning@

Revision 1.46 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:16 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.45: +5 -3 lines
Diff to previous 1.45 (colored)

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 1.45 / (download) - annotate - [select for diffs], Fri Jul 11 09:42:27 2014 UTC (9 years, 11 months ago) by yasuoka
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.44: +21 -7 lines
Diff to previous 1.44 (colored)

Add -u option to bind UDP port as a socket to answer DHCPINFORM from
the clients on non ethernet interfaces (eg. tun(4) or pppx(4)).

input krw
ok krw

Revision 1.44 / (download) - annotate - [select for diffs], Wed May 7 13:20:47 2014 UTC (10 years, 1 month ago) by pelikan
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

back out the previous ICMP simplifying diff, it caused livelocks.

reported by Mikolaj Kucharski, thanks!
ok krw

Revision 1.43 / (download) - annotate - [select for diffs], Mon May 5 18:30:44 2014 UTC (10 years, 1 month ago) by pelikan
Branch: MAIN
Changes since 1.42: +1 -2 lines
Diff to previous 1.42 (colored)

Don't call the BOOTP handler indirectly.

ok krw

Revision 1.42 / (download) - annotate - [select for diffs], Mon May 5 18:27:57 2014 UTC (10 years, 1 month ago) by pelikan
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

Don't call the ICMP handler indirectly + clean up a bit.

ok krw

Revision 1.41 / (download) - annotate - [select for diffs], Wed Dec 15 14:34:17 2010 UTC (13 years, 5 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

We run getopt() twice to know if dhcp-sync is used. To make this work
both getopt calls need the same optstring or the first getopt() call
will end before parsing all arguments.
Problem found and fixed supplied by m_athias
OK millert@, deraadt@

Revision 1.40 / (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.39: +3 -3 lines
Diff to previous 1.39 (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.39 / (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.38: +11 -7 lines
Diff to previous 1.38 (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.38 / (download) - annotate - [select for diffs], Thu May 29 19:02:47 2008 UTC (16 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

appease stupid stupid gcc; ok millert

Revision 1.37 / (download) - annotate - [select for diffs], Sun May 25 22:36:17 2008 UTC (16 years ago) by millert
Branch: MAIN
Changes since 1.36: +21 -7 lines
Diff to previous 1.36 (colored)

Don't error out if dhcpd-sync does not exist in /etc/services and no
sync options were specified.  OK deraadt@

Revision 1.36 / (download) - annotate - [select for diffs], Thu May 8 07:28:08 2008 UTC (16 years, 1 month ago) by beck
Branch: MAIN
Changes since 1.35: +1 -2 lines
Diff to previous 1.35 (colored)

this should really only be in one file.

Revision 1.35 / (download) - annotate - [select for diffs], Wed May 7 12:19:20 2008 UTC (16 years, 1 month ago) by beck
Branch: MAIN
Changes since 1.34: +34 -5 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Sun Dec 30 13:38:47 2007 UTC (16 years, 5 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

add missing space between argument names and ellipsis

ok jmc@

Revision 1.33 / (download) - annotate - [select for diffs], Tue Jul 24 15:31:04 2007 UTC (16 years, 10 months ago) by stevesk
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

use 1 vs. -1 for true; ok henning@ krw@

Revision 1.32 / (download) - annotate - [select for diffs], Sat Feb 17 18:27:38 2007 UTC (17 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.31: +2 -4 lines
Diff to previous 1.31 (colored)

-q flag is unused (old shared code from dhclient); spotted by mark@cyodesigns
ok krw

Revision 1.31 / (download) - annotate - [select for diffs], Sat Feb 17 13:32:15 2007 UTC (17 years, 3 months ago) by jmc
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

no code for -p, so remove from man page and usage();
confirmed by ckuethe;
spotted by Mark Lumsden

Revision 1.30 / (download) - annotate - [select for diffs], Wed Nov 22 19:10:39 2006 UTC (17 years, 6 months ago) by stevesk
Branch: MAIN
Changes since 1.29: +3 -2 lines
Diff to previous 1.29 (colored)

small header cleanup:
remove uneeded header
use <foo.h> not "foo.h" for system include

no binary change; ok henning@

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jun 14 20:19:20 2006 UTC (17 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

sort options;

Revision 1.28 / (download) - annotate - [select for diffs], Wed Jun 14 14:58:52 2006 UTC (17 years, 11 months ago) by ckuethe
Branch: MAIN
Changes since 1.27: +49 -5 lines
Diff to previous 1.27 (colored)

This diff allows dhcpd to put active leases into a pf table. Dhcpd will then
periodically - based on the length of the shortest lease time - walk across
all leases searching for expired leases which are then removed from the pf
table.

ok henning

Revision 1.27 / (download) - annotate - [select for diffs], Thu Jun 1 06:06:27 2006 UTC (18 years ago) by ckuethe
Branch: MAIN
Changes since 1.26: +5 -5 lines
Diff to previous 1.26 (colored)

Sort options in usage. From jmc.
ok henning@

Revision 1.26 / (download) - annotate - [select for diffs], Wed May 31 02:43:15 2006 UTC (18 years ago) by ckuethe
Branch: MAIN
Changes since 1.25: +38 -6 lines
Diff to previous 1.25 (colored)

This diff makes dhcpd able to manipulate pf tables on certain lease events.

dhcpd is now able to place abandoned addresses into a table (to offer some
protection against machines camping on an address) and remove them from the
table if they are properly leased.

When dhcpd assigns an IP to a new hardware address, it can remove that
address from a table. This is for use with the overload table in pf; newly
arrived machines will not be punished for the actions of a machine that
went away.

beck@ and krw@ liked previous versions of this, henning@ final ok

Revision 1.25 / (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.24: +2 -3 lines
Diff to previous 1.24 (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.24 / (download) - annotate - [select for diffs], Mon May 23 22:54:55 2005 UTC (19 years ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.23: +1 -2 lines
Diff to previous 1.23 (colored)

-endpwent

Revision 1.23 / (download) - annotate - [select for diffs], Mon May 2 02:29:27 2005 UTC (19 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

more setres[ug]id; ok deraadt@

Revision 1.22 / (download) - annotate - [select for diffs], Sun Oct 31 10:43:38 2004 UTC (19 years, 7 months ago) by canacar
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.21: +9 -15 lines
Diff to previous 1.21 (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.21 / (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.20: +4 -4 lines
Diff to previous 1.20 (colored)

avoid aliasing with libc functions; ok henning

Revision 1.20 / (download) - annotate - [select for diffs], Thu Sep 9 20:51:57 2004 UTC (19 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Avoid following a NULL pointer if a hostname lookup fails and
remove an extraneous "exiting" when there is a config file error.
OK henning@ and mcbride@

Revision 1.19 / (download) - annotate - [select for diffs], Wed May 12 10:20:49 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.18: +3 -1 lines
Diff to previous 1.18 (colored)

like always I missed tzset(); Ben Lovett <ben@tilderoot.com>

Revision 1.18 / (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.17: +1 -4 lines
Diff to previous 1.17 (colored)

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

Revision 1.17 / (download) - annotate - [select for diffs], Wed Apr 21 09:11:58 2004 UTC (20 years, 1 month ago) by canacar
Branch: MAIN
Changes since 1.16: +6 -5 lines
Diff to previous 1.16 (colored)

filter writes and lock bpf descriptor, ok henning@

Revision 1.16 / (download) - annotate - [select for diffs], Wed Apr 21 01:44:33 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

fix the error message in case the _dhcp user does not exist

Revision 1.15 / (download) - annotate - [select for diffs], Tue Apr 20 00:27:57 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.14: +5 -20 lines
Diff to previous 1.14 (colored)

don't allow the port to be changed here either

Revision 1.14 / (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.13: +7 -8 lines
Diff to previous 1.13 (colored)

various knf; henning ok

Revision 1.13 / (download) - annotate - [select for diffs], Sun Apr 18 00:30:33 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.12: +1 -4 lines
Diff to previous 1.12 (colored)

dhcpd may be invoked without any interface given

Revision 1.12 / (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.11: +2 -2 lines
Diff to previous 1.11 (colored)

a bunch of knf, ok henning

Revision 1.11 / (download) - annotate - [select for diffs], Thu Apr 15 23:20:42 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.10: +16 -1 lines
Diff to previous 1.10 (colored)

chroot and drop privileges after startup

Revision 1.10 / (download) - annotate - [select for diffs], Thu Apr 15 08:34:20 2004 UTC (20 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

- trim/update AUTHORS
- standard options list and correct SYNOPSIS for dhcpd(8)
- sync usage()

ok henning@

Revision 1.9 / (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.8: +3 -3 lines
Diff to previous 1.8 (colored)

spaces

Revision 1.8 / (download) - annotate - [select for diffs], Wed Apr 14 04:21:32 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.7: +43 -58 lines
Diff to previous 1.7 (colored)

KNF, ansi and such

Revision 1.7 / (download) - annotate - [select for diffs], Wed Apr 14 04:13:58 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.6: +48 -53 lines
Diff to previous 1.6 (colored)

getopt

Revision 1.6 / (download) - annotate - [select for diffs], Wed Apr 14 03:59:17 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.5: +20 -29 lines
Diff to previous 1.5 (colored)

less pathetic usage(), and I felt free to remove the helpfull
/* print usage message */

Revision 1.5 / (download) - annotate - [select for diffs], Wed Apr 14 02:18:41 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.4: +9 -89 lines
Diff to previous 1.4 (colored)

remove pidfile gunk, use daemon, and get rid of some debugging crap

Revision 1.4 / (download) - annotate - [select for diffs], Wed Apr 14 02:13:37 2004 UTC (20 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.3: +9 -38 lines
Diff to previous 1.3 (colored)

don't print half a terminal worth of vixie advertising at startup and in usage

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: +2 -2 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: +2 -2 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.