Commit Graph

648 Commits

Author SHA1 Message Date
Nicholas J. Kain
75206dce13 Check for failure in creating listen sockets in change_listen_mode(). 2010-11-13 12:34:22 -05:00
Nicholas J. Kain
faa56bb616 Make change_listen_mode() create a new socket instantly rather than
waiting for select loop to cycle again.  Works better in practice
and simplifies the select loop, too.
2010-11-13 12:30:54 -05:00
Nicholas J. Kain
ccae6e4c8a Clean up unnecessary goto exit handler in raw_socket(). 2010-11-13 12:11:28 -05:00
Nicholas J. Kain
028d3b7bae Clean up send_renew() a bit. 2010-11-13 12:00:06 -05:00
Nicholas J. Kain
a79d86609b Wrap raw_packet() with specialized bcast_raw_packet(). 2010-11-13 11:42:26 -05:00
Nicholas J. Kain
9f7fe1de8b Use BPF to filter input on raw sockets. 2010-11-13 11:18:07 -05:00
Nicholas J. Kain
71a3603934 Finish cleaning up get_raw_packet(). Use offsetof() to make UDP
checksum verification a bit more compact.
2010-11-13 08:47:07 -05:00
Nicholas J. Kain
693c9256e4 Add safe_read() to ncmlib and use it in ndhc. 2010-11-13 08:37:33 -05:00
Nicholas J. Kain
a43e69c7ae Factor out safe_write() into ncmlib and use it in ndhc as well. 2010-11-13 08:18:23 -05:00
Nicholas J. Kain
edf3b02b6a Fix header include guards to not use leading underscores. 2010-11-13 06:51:57 -05:00
Nicholas J. Kain
336a54fa47 Clean dhcpd.h. 2010-11-13 06:48:50 -05:00
Nicholas J. Kain
bb5446cf02 Remove leases.h. 2010-11-13 06:45:34 -05:00
Nicholas J. Kain
a059b5bd13 Clean up 'unsigned long' used with the assumption that long == 32-bit. 2010-11-13 06:42:52 -05:00
Nicholas J. Kain
8d9cc0bdb4 Remove unused attach_option() from options.c. 2010-11-13 06:28:03 -05:00
Nicholas J. Kain
431bb5d11e Clean up paren use with sizeof and & in clientpacket.c. 2010-11-13 06:22:22 -05:00
Nicholas J. Kain
35c4c773cd Remove unnecessary casts from setsockopt().
Prevent access to initialized memory in raw_socket()'s bind() call by
using memset().
2010-11-13 06:13:10 -05:00
Nicholas J. Kain
f59ccfb5b0 In sendto() and write(), make sure all pointer arithmetic is in byte
sized units.
2010-11-13 05:59:15 -05:00
Nicholas J. Kain
502419c598 More detailed error prints in get_raw_packet(). 2010-11-13 05:53:32 -05:00
Nicholas J. Kain
ce518cc99f Properly cast read buffer to (char *) in get_raw_packet(). 2010-11-12 21:54:20 -05:00
Nicholas J. Kain
37bf851ca7 Clean up raw socket read error path a bit. 2010-11-12 21:44:28 -05:00
Nicholas J. Kain
7026a9c120 Add gentoo rc script (for /lib64/rc/net on eg amd64) 2010-11-12 21:01:05 -05:00
Nicholas J. Kain
2ae6025110 Zero length packets cannot be received now in get_raw_packet(). 2010-11-12 20:15:15 -05:00
Nicholas J. Kain
0b1a3b4c14 Create a pidfile even in the case where ndhc never backgrounds. 2010-11-12 20:08:16 -05:00
Nicholas J. Kain
ac6f60c4fe Create a pidfile that matches the daemon process id when backgrounded. 2010-11-12 20:03:55 -05:00
Nicholas J. Kain
9ce31ec4d8 Make background() idempotent in a cleaner way. 2010-11-12 19:50:04 -05:00
Nicholas J. Kain
5f55dbc3ff Fix previous commit -- handle filling empty options properly.
Clean up pidfile defaults and help message.
Clean up the write/sendto fixes to be a bit more readable.
2010-11-12 19:43:16 -05:00
Nicholas J. Kain
31d15af0fa Don't fork off subprocesses to send to ifchd. Totally unnecessary. 2010-11-12 19:04:51 -05:00
Nicholas J. Kain
c4f912a525 Fix a bug where a packet read would potentially stop before grabbing
a full sized dhcp packet if one is available.
2010-11-12 18:56:30 -05:00
Nicholas J. Kain
955031bce1 Somehow not all of ncmlib was version controlled. Fix. 2010-11-12 18:46:45 -05:00
Nicholas J. Kain
5b7a3e43e0 Rename dhcpc.c to ndhc.c. 2010-11-12 18:46:02 -05: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
Nicholas J. Kain
e781322b4d Add defines for toggling packet send count before timeout and timeout length. 2010-11-12 18:19:19 -05:00
Nicholas J. Kain
c0703fc8c9 Handle option lists properly in script.c. 2010-11-12 18:04:54 -05:00
Nicholas J. Kain
9d7ad2f11c Fix some strlcpy() misuse that cuts off the last character of the copied
string.
Clean up some log messages.
2010-11-12 17:24:54 -05:00
Nicholas J. Kain
f4a00f3826 Whitespace and indentation normalization. 2010-11-12 14:33:17 -05:00
Nicholas J. Kain
2262845be6 Robustify get_raw_packet(). Error messages are now more specific, and
read() properly handles short reads and EINTR/EAGAIN/EWOULDBLOCK.
Update documentation.
2010-11-12 13:24:07 -05:00
Nicholas J. Kain
81398c79fb Fix strlcpy to not truncate in ndhc.
Length check cleanups.
Use xmalloc() rather than malloc().
2010-11-12 12:19:52 -05:00
Nicholas J. Kain
8aa6d9a320 Fix file_exists() to deal with modern variant.
Update README.
2010-11-12 12:05:37 -05:00
Nicholas J. Kain
15f6bb66ee Move DESIGN and README to root directory. 2010-11-12 09:39:33 -05:00
Nicholas J. Kain
b2daf09c10 Move set_cap() to ncmlib/cap.[ch]. 2010-11-12 09:04:43 -05:00
Nicholas J. Kain
a7ea0dd378 Fix typos in README. 2010-11-12 08:43:46 -05:00
Nicholas J. Kain
2bc86fad4e Clean whitespace in ifchd.c. 2010-11-12 06:05:46 -05:00
Nicholas J. Kain
b882669f85 Convert to using shared ncmlib. 2010-11-12 05:42:07 -05:00
Nicholas J. Kain
b42eeb8847 Move ifchd files to a subdirectory. 2010-11-12 04:51:49 -05:00
Nicholas J. Kain
c999fee9f5 Initial CMake support.
Fix an off-by-one array initialization.
Clean up VERSION a bit.
2010-11-12 04:44:25 -05:00
Nicholas J. Kain
5bea46a071 Check return values of write(), ftruncate(), and fsync(). 2010-11-12 04:29:38 -05:00
Nicholas J. Kain
3d871e612a Open with create flag needs to specify the fs mode for the file. 2010-11-12 04:11:15 -05:00
Nicholas J. Kain
7a09ba2cf7 Initial commit. 2010-11-12 04:02:18 -05:00