Commit Graph

70 Commits

Author SHA1 Message Date
Nicholas J. Kain
712c8446d6 Update README. 2010-12-01 12:24:47 -05:00
Nicholas J. Kain
f2b4527179 Use epoll() and signalfd() in ifchd. 2010-12-01 12:22:08 -05:00
Nicholas J. Kain
fb56a9cb2b Make sure to #include <stddef.h> when using offsetof(). 2010-11-16 17:41:46 -05:00
Nicholas J. Kain
9dce1a0378 Make sure our assigned address is unique on our segment by using arp. 2010-11-15 20:06:50 -05:00
Nicholas J. Kain
5eb3c18b01 Indentation fix. 2010-11-14 08:49:58 -05:00
Nicholas J. Kain
ba553e5d94 Clean up end_option(), and fix a possible off-by-one in the bound check. 2010-11-14 07:50:21 -05:00
Nicholas J. Kain
5a38e49a81 Update get_option() to use the function from busybox's udhcp variant;
it's much easier to read.  The original one is indecipherable, and thus
it is difficult to verify correctness.
2010-11-14 03:41:36 -05:00
Nicholas J. Kain
1ffd1d9df3 Replace 308 with DHCP_OPTIONS_BUFSIZE in options.c. 2010-11-14 02:02:32 -05:00
Nicholas J. Kain
4ce4323d00 Replace sizeof(struct dhcpMessage) with DHCP_SIZE. 2010-11-14 02:01:17 -05:00
Nicholas J. Kain
9421da3157 Don't zero-pad kernel-packet sent dhcp packets. 2010-11-14 01:56:54 -05:00
Nicholas J. Kain
f8d856cc0a Don't zero-pad sent raw dhcp packets and clean up packet.c. 2010-11-14 01:53:23 -05:00
Nicholas J. Kain
8401d175a1 Remove a Win98 DHCP client bug workaround from get_packet(). 2010-11-14 01:12:32 -05:00
Nicholas J. Kain
0661f4371b Untabify and reindent packet.h. 2010-11-14 00:54:05 -05:00
Nicholas J. Kain
6a3b004eee Specialize init_header() to only handle client packets, move it to
clientpacket.c, and make it static.
2010-11-14 00:52:32 -05:00
Nicholas J. Kain
1cc648b5ad Clean up and comment listen_socket(). 2010-11-14 00:46:02 -05:00
Nicholas J. Kain
86ef084835 Clean up parameter names and comment read_interface(). 2010-11-14 00:41:32 -05:00
Nicholas J. Kain
987ba12982 Enforce upper and lower sanity bounds on lease times.
Add some comments.
2010-11-13 19:37:08 -05:00
Nicholas J. Kain
aaca1ab6ef Formatting fixes. 2010-11-13 19:14:16 -05:00
Nicholas J. Kain
675b527aac Remove some unnecessary memset() and an unused buffer in bound_if(). 2010-11-13 19:07:00 -05:00
Nicholas J. Kain
00ec886737 Ident fix. 2010-11-13 19:04:28 -05:00
Nicholas J. Kain
ef3a69e00e Clean up an unnecessary buffer in perform_release(). 2010-11-13 18:49:46 -05:00
Nicholas J. Kain
f34fac92bd Remove bashism from the gentoo net script. 2010-11-13 16:12:17 -05:00
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