Commit Graph

63 Commits

Author SHA1 Message Date
Roy Marples
1993f8f997 Don't overflow the buffer. 2008-09-15 09:02:56 +00:00
Roy Marples
9bb03ee181 We may change size of hwaddr_buffer, so just use sizeof. 2008-09-14 09:06:22 +00:00
Roy Marples
ba97e49417 Add allowinterfaces and denyinterfaces options to dhcpcd.conf for better multiple interface support. 2008-09-11 09:38:02 +00:00
Roy Marples
2b60ecb71e Sort interfaces according to preference and pass this to dhcpcd-run-hooks so we can prefer configs. 2008-09-09 17:07:48 +00:00
Roy Marples
765fbf7db0 Remove logger and exclusively uses syslog instead. This saves almost 2K on NetBSD/amd64 from before changing strerror to %m. 2008-09-05 18:24:34 +00:00
Roy Marples
f25f3fb214 Don't spam on startup about unsupported interfaces if quiet. 2008-09-05 15:46:02 +00:00
Roy Marples
f0f4b8b6df Use static buffers for ARP and move the send code to arp.c. Also, move the hwaddr buffer to the top of the file for clarity. 2008-09-04 08:31:00 +00:00
Roy Marples
b332752859 Work around broken linux headers when including wireless.h 2008-09-03 23:36:46 +00:00
Roy Marples
948eea38e5 Don't need this. 2008-09-02 15:35:02 +00:00
Roy Marples
ccf0a5f559 Fix compile and wireless test on FreeBSD. 2008-09-02 15:25:14 +00:00
Roy Marples
274abdf80b Add wireless detection to NetBSD (tested) and FreeBSD (untested). 2008-09-02 15:11:01 +00:00
Roy Marples
b24e474272 strncpy -> strlcpy. 2008-09-02 15:07:01 +00:00
Roy Marples
fd05b7dcfc Add an event loop.
Split client.c into smaller files and functions and
recode around the event loop.
Add multiple interface support using the new event loop.
Document changes and outstanding bugs.
2008-09-02 13:28:11 +00:00
Roy Marples
ca07508a27 Style 2008-08-26 13:27:07 +00:00
Roy Marples
5d5323f084 Style. 2008-08-22 09:48:25 +00:00
Roy Marples
fb8a5f9817 If a device is not found, report it. 2008-08-14 16:15:45 +00:00
Roy Marples
5c6909c055 Don't cast needlessly. 2008-08-13 12:35:33 +00:00
Roy Marples
1c34afb04d Fix an buffer overflow leading to random bytes in the hardware address. 2008-08-13 12:29:32 +00:00
Roy Marples
f4e3746739 Prefer signal to poll so we avoid any possibilty of a timeval -> int/msecs overflow. We could of course loop msecs / INT_MAX times, but it then gets messy. It also saves around 200 bytes of binary size :) 2008-07-31 09:30:42 +00:00
Roy Marples
0fc7ff3ed6 We should bind to the interface if we can - for the case where we renew and there are two interfaces on the same subnet and the default subnet route goes via the wrong interface. 2008-07-30 11:05:45 +00:00
Roy Marples
b8b4be9a39 Remove #ifdefs to disable specific bits of code. We now build everything - we're small enough :) 2008-07-23 17:06:42 +00:00
Roy Marples
4cce18b824 Style. 2008-07-19 20:11:03 +00:00
Roy Marples
a26af49123 Add support for link carrier detection. For Linux this involved a big change to the netlink code to add callbacks, for BSD just an extra function. We also have an option not to wait for a DHCP lease and fork right away - useful for startup scripts. 2008-07-16 22:23:07 +00:00
Roy Marples
c4d4ee1358 fd -> raw_fd 2008-07-16 08:10:41 +00:00
Roy Marples
9cb2d1e701 It seems that every arp application does not pad to 60 bytes. So either they are all not RFC conformant (doubtful) or their leaving it to something else. As such, dhcpcd will not pad either, so it's less code :) 2008-07-12 12:51:04 +00:00
Roy Marples
a6c4cbb9c1 We should use ETHERMIN. 2008-07-12 00:49:34 +00:00
Roy Marples
0e94b2aca5 Save a few bytes here. Also, fill with 0 so that we mirror the BSD gratuitous ARP when adding an address. 2008-07-11 10:13:23 +00:00
Roy Marples
6c738c7f9e Style. 2008-07-10 15:31:37 +00:00
Roy Marples
f5f8e22383 Save a few bytes by avoiding memset. 2008-07-09 23:26:36 +00:00
Roy Marples
23d8d9ce8a Ensure that our ARP messages are at least 64 bytes so we're RFC compliant. 2008-07-09 22:41:49 +00:00
Roy Marples
d31af5110f Add more error checking if the link was taken down or ip addresses removed - if this happens we reset to the init state. 2008-07-09 06:50:31 +00:00
Roy Marples
a30b3a9fbd Optimize. 2008-07-08 20:56:15 +00:00
Roy Marples
0364eaca26 Ensure that we have at least 2 ocets. 2008-07-02 10:29:24 +00:00
Roy Marples
3aa5b6ed1a Fix ClientID parsing. 2008-07-02 09:48:53 +00:00
Roy Marples
1f96a7d73e Fix hwaddr_aton 2008-06-29 10:55:21 +00:00
Roy Marples
eb942e0abc Remove the signal array stack as our pipe handling should be secure enough now. Also, move the normalize close_on_exec and setting non block. 2008-06-10 22:23:57 +00:00
Roy Marples
5fb580a771 Re-write the client state engine around a simple timer instead of complex loops. Use the re-transmission times as per RFC 2131. Integrate the ARP handling code in the new engine so we are able to defend our IPV4LL address whilst negotiating a DHCP lease. This also means we're able to bind the address and fork BEFORE waiting to send announcements which makes us appear faster on the commandline. 2008-06-08 20:07:54 +00:00
Roy Marples
dc7fc61240 We should not be setting IFF_RUNNING - that's the job of the interface driver. 2008-06-03 22:21:51 +00:00
Roy Marples
7fa019426f Kernel will send the 2nd annoucemnent when we add the address. 2008-05-30 10:27:15 +00:00
Roy Marples
855c5820e7 Parse the ARP packet better. 2008-05-30 09:52:09 +00:00
Roy Marples
3c02568a28 Make the timings more random by using the full range of poll timeout. 2008-05-29 19:26:16 +00:00
Roy Marples
0dc15f70d5 Check size of arp reply vs what we need. Also, no need to copy out the hardware addresses. 2008-05-29 13:21:58 +00:00
Roy Marples
3cf0d215a5 Respect RFC 3927 more, regarding times and conflicts. 2008-05-29 11:58:25 +00:00
Roy Marples
1fd83d79e8 We should inspect our signal fd before processing ARP replies. 2008-05-28 12:02:04 +00:00
Roy Marples
acf37f8de9 Use the write length. 2008-05-27 09:14:33 +00:00
Roy Marples
fa52b46047 Fix pointer. 2008-05-26 20:43:34 +00:00
Roy Marples
f2d3069dec Pull ARP replies correctly. 2008-05-26 09:58:36 +00:00
Roy Marples
a265106090 Try a new checksum routine. 2008-05-15 20:58:31 +00:00
Roy Marples
fba865f71d Fix checksum on Sparc64. 2008-05-15 20:45:45 +00:00
Roy Marples
57220ee062 get_packet 0 means no more buffer, so loops don't need to know the bpf/socket buffering. 2008-05-15 13:34:31 +00:00