Commit Graph

7 Commits

Author SHA1 Message Date
Nicholas J. Kain
b7e6f59fc7 Use a Ragel-generated DFA parser for ifchd command dispatch. 2013-05-08 06:27:22 -04:00
Nicholas J. Kain
2bf7306bb9 Add some more syscalls to the ndhc permit filter. Netlink sockets were
broken before because of too-strict filters.

Move setup_signals under the seccomp filter to give it more testing coverage.

Make the UDP datagram length check much more strict.  If the read buffer
does not match up with the header lengths exactly, it is discarded.

Print a warning to syslog/stdout when ifchd execute_buffer() returns an
error.

Fix a regression introduced in ifchd that would cause the epoll handler to
spin when a client connection closed.
2012-07-20 18:48:26 -04:00
Nicholas J. Kain
f9c2059d37 Quit using malloc entirely in ifchd and reduce buffer copies.
This change also modifies the ndhc/ifchd wire protocol slightly.  The
new protocol doesn't overload the ':' character as a key:value separator
and a statement separator.  Instead ';' is now used as a statement separator.
The new format allows for more robust error-checking and reporting, and it
greatly simplifies the parser.  Old versions of ndhc/ifchd will not work
properly with ones compiled after this commit.

The 'domain' and 'search' keywords in resolv.conf updates are now used
more precisely.  The first domain in an update is the 'domain', and the
subsequent 5 domains are 'search' domains.

There are also supporting cleanups that pass struct ifchd_client pointers
to functions instead of passing index values.

This commit is large, but it cannot really be broken up into smaller
chunks since the changes are dependent on each other.
2012-07-20 17:31:15 -04:00
Nicholas J. Kain
a60a5fddb1 Remove use of dynamic memory (strlist_t) from linux.c. 2012-07-20 15:17:44 -04:00
Nicholas J. Kain
6e9d856a9d Code cleanup. Create struct ifchd_client and pull all of the global
static arrays that are indexed by the socket slot index into an array
of struct ifchd_clients.
2012-07-20 14:56:17 -04:00
Nicholas J. Kain
59beb159d3 Place the ifchange socket in /var/state/ifchange within the chroot
jail and change configuration instructions as well.

Change default configuration instructions to specify setting root
of the chroot jail as owned by root.root.
2011-05-01 20:43:29 -04:00
Nicholas J. Kain
eb6009a5ee Make write() and sendto() properly handle short writes and errors in ndhc.
Make ndhc write a pidfile.
Clean up defines.h and split out ifchd and ndhc specifics.
2010-11-12 18:44:49 -05:00