Roy Marples
f52769ba71
Move wireless detection from net.c into if-bsd.c and if-linux.c
2008-09-17 10:32:55 +00:00
Roy Marples
43b2edaf43
Move AF_LINK discovery to if-bsd.c. Also, we only work with IFT_ETHER types currently, so skip others.
2008-09-16 09:55:46 +00:00
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
Roy Marples
9c308ff18f
Move signal.{c,h} to signals.{c.h} so we can work better in the NetBSD source tree.
2008-05-15 12:48:01 +00:00
Roy Marples
fe965fea17
Fix bpf for the correct position on new buffers.
2008-05-15 12:32:27 +00:00
Roy Marples
2eebbca565
Loop correctly for more packets.
2008-05-15 12:15:49 +00:00
Roy Marples
3581b92aa4
Fix some valgrind errors, and work on Linux again.
2008-05-15 11:12:44 +00:00
Roy Marples
b1009e62b2
Improve get_packet API and memcpy to structure instead of using union pointers.
2008-05-15 10:10:39 +00:00
Roy Marples
f409012f02
Repair whitespace damage.
2008-04-26 07:39:23 +00:00
Roy Marples
35ff0dbb35
We should send packets to a specific IP over the udp socket so we don't broadcast on layer 2 and unicast on layer 3, #64 .
2008-04-20 19:02:19 +00:00
Roy Marples
cbfa778bd6
Specify char
2008-04-17 10:08:48 +00:00
Roy Marples
f2cfcde87e
Our ctype calls should always use unsigned.
2008-04-17 09:57:19 +00:00
Roy Marples
dcab79de5e
Remove the .info file and now set environment vars in the same vein as dhclient. This allows similar scripts to be used.
2008-04-16 09:51:20 +00:00
Roy Marples
207e004634
Move MTU configuration to dhcpcd.sh. However, if the MTU is too small for dhcpcd, dhcpcd will increase it to the minimum.
2008-04-14 13:47:20 +00:00
Roy Marples
5a98646f72
Move configuration file setup to dhcpcd.sh so that it's possible for the user to change more easily. We now have enter/exit hooks similar to dhclient to make things even easier for the user. At this time, we are still 100% commandline compatible. However, we have lost the feature to lookup hostnames.
2008-04-12 23:00:23 +00:00
Roy Marples
1a60d14fa2
Normally I hate massive code drops, but heh.
...
The code has been drastically re-arranged.
Instead of populating a custom structure while parsing dhcp messages, we now pluck what we need right out of the message itself. We have custom functions and a lookup table to make this really easy.
This makes us more like dhclient and udhcpc, and will enable us to easily add (and remove!) more dhcp options without having to actually change the code (much).
We now store the real dhcp message we got in /var/db/dhcpcd-$iface.lease, the mtime of the file being used as when we got the lease. This file is read in when re-using an old lease instead of parsing the .info file.
The benefit of all of this means that we're actually ~15k smaller when compiled with the same features.
This has been tested for quite some time, and I'm pretty sure most bugs with the 3.2 branch have been fixed whilst making this. Right now, we are 99% command line compatible with the 3.2 branch.
2008-04-11 16:14:55 +00:00