summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dhcpd/pfutils.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* One missing piece when I added pledge(2) to dhcpd(8) was in the code path whenmestre2019-08-081-5/+8
| | | | | | | | | | | | | | it's invoked with either -A/-C/-L, which at the time I left alone due to some forbidden ioctls by pledge(2). Now we have unveil(2) and this path can be further restricted by using it instead of chroot(2) since this "sandbox" (not sure why people call sandbox to about everything these days) can be escaped with *at(2) calls. Since no filesystem access is needed here then we can disable its access by calling unveil("/", "") unveil(NULL, NULL). added /* no filesystem visibility */ as per suggestion by and OK deraadt@
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-4/+4
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* I noticed the "pf table handler" process not going away on dhcpd restart,henning2018-12-071-7/+7
| | | | | | | | | | | | | looked at the error handling here, and.... oh my. If opening /dev/pf on startup fails, don't just warn and move on, but bail. If chroot (or the chdir after) fail, don't just warn and move on, bail. If dropping privileges fails, the last thing we want to do is to just move on with root privs, having warned or not. If the pipe to the parent process is closed, that almost certainly means that the parent process went away, and it absolutely certainly means that the table handler process has no meaningful reason to exist any more, thus bail. ok florian ccardenas krw
* Eliminate pointless'%m' (a.k.a. hand rolled strerror()) by using fatal() andkrw2017-02-131-7/+7
| | | | log_warn(). Zap a couple of explicit 'syslog()' calls.
* Do the strerror() elimination dance with log_warnx() -> log_warn(),krw2017-02-131-5/+5
| | | | fatalx() -> fatal() and even a couple of fprintf(stderr) -> log_warn().
* Switch from old errwarn.c logging to shiny new log.[ch].krw2017-02-131-11/+12
| | | | ok benno@
* Replace bzero(3) with memset(3)mestre2016-11-151-7/+7
| | | | "Looks good" to deraadt@
* Eliminate #include inside *.h files and include only needed headers inkrw2016-02-061-5/+4
| | | | | | | each *.c file. Inspired by mention of header silliness by Edgar Pettijohn and mmcc@ on tech@.
* The pf table process should die if the pipe to the dhcpd process iskrw2015-02-051-1/+4
| | | | | | closed. e.g. dhcpd has been killed. ok henning@
* Include <netinet/in.h> before <net/pfvar.h>. In a future change whenderaadt2015-01-211-2/+3
| | | | ports is ready, <net/pfvar.h> will stop including a pile of balony.
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-2/+1
| | | | | | | | | 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)
* Scattering a few bcopy()'s around source using mostly memcpy() is justkrw2013-10-181-6/+6
| | | | asking for confusion. Replace bcopy()'s with memcpy()'s.
* remove double word in comment;jmc2007-12-231-2/+2
|
* Allow the various pf table actions to operate independently. For example,ckuethe2007-10-061-16/+6
| | | | | | "-L leased" wouldn't work without "-A abandoned". testing help from merdely "i like" deraadt
* use the correct fd for poll. we're waiting on the pipe, not pftedu2007-05-151-2/+2
| | | | ok ckuethe deraadt
* indentderaadt2006-10-201-18/+18
|
* This diff allows dhcpd to put active leases into a pf table. Dhcpd will thenckuethe2006-06-141-11/+45
| | | | | | | | 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
* Move the transmission of privsep messages into its own function. Whereverckuethe2006-06-141-1/+40
| | | | | | | we might have conditionally sent a message, we now just call the pfmsg() function, and let it figure out whether the message should be sent or not. ok henning
* Avoid changing pf tables when table name is NULLckuethe2006-06-141-1/+4
| | | | ok henning
* Missing $OpenBSD$ tag. Spotted by Masao Uebayashi.ckuethe2006-05-311-0/+1
| | | | ok henning@
* This diff makes dhcpd able to manipulate pf tables on certain lease events.ckuethe2006-05-311-0/+182
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