Commit Graph

33 Commits

Author SHA1 Message Date
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
Roy Marples
c39cf2100b Add alternative building method to save around 500 bytes. 2008-03-24 20:09:30 +00:00
Roy Marples
a9819bfb1f Split interface and socket out into OS bpf, if-bsd and if-linux. 2008-03-24 01:29:33 +00:00
Roy Marples
8d21242476 Change code style to match the BSDs in the hope the might adpot it instead of dhclient. 2008-03-20 16:47:51 +00:00
Roy Marples
7fc53ef794 Use tailq from queue.h instead of rolling our down linked lists. 2008-02-20 17:04:56 +00:00
Roy Marples
61a22947ab Move clientid generation to client.c and put it on the interface object inplace of duid. Always save the ClientID as a hex string. This reduces our binary size. 2008-01-31 11:19:17 +00:00
Roy Marples
dc9be8a47f Quiet some lint warnings. 2008-01-21 21:19:53 +00:00
Roy Marples
8dffa4bc13 We should use ssize_t here. 2008-01-21 15:12:31 +00:00
Roy Marples
4a0a186b5e More formatting fixes. 2008-01-16 17:34:36 +00:00
Roy Marples
398ac8be8a uptime should return time_t 2008-01-16 13:16:11 +00:00
Roy Marples
0642e6be9e Add -S to optionally request a Microsoft CSR. -SS only request a Microsoft CSR and not a normal. 2008-01-15 14:34:28 +00:00
Roy Marples
3cea28afc8 Default all int entries in the dhcp header to unsigned. 2008-01-09 10:12:59 +00:00
Roy Marples
782830eb5d Belatedly into 2008 :) 2008-01-08 09:51:23 +00:00
Roy Marples
b6057d10d2 Re-license as 2-clause BSD as I've re-written everything from the old dhcpcd-2 code base now. 2007-11-15 11:35:53 +00:00
Roy Marples
1f8f3dbdc1 Reword the headers to just say we use the GPLv2. 2007-11-07 16:26:41 +00:00
Roy Marples
cfe160119d Update my e-mail address as I have retired from Gentoo. 2007-11-06 15:03:38 +00:00
Roy Marples
3e120d46a8 Many thanks to Michael Durrant for testing the below changes.
Compile and work on OSX/Darwin.
If we have no fork then we re-exec ourselves with --daemonised.
Improved the build system so we automatically detect if we need
librt or libresolv and if fork() works or not.
Move back to using librt for clock_gettime on Linux systems.
2007-09-04 12:48:40 +00:00
Roy Marples
fc3617fbf1 Support RFC 3361 SIP Servers. 2007-07-18 14:22:02 +00:00
Roy Marples
ff711cf766 Suport DHCP option (52) overload. 2007-07-17 08:34:59 +00:00
Roy Marples
4549f7a4dd config.h now has the compile time options, instead of being dotted around.
Added -E option, which reads the last info file and uses the information there
if we timeout and the lease is still valid, thanks to Roberto Angelino.
2007-05-10 09:39:26 +00:00
Roy Marples
7cbb81afc3 Style updates 2007-04-12 13:12:25 +00:00
Roy Marples
854f4d91ef Redfine the variable and add a comment 2007-04-12 06:52:51 +00:00
Roy Marples
750bc1d4f8 Minimum message size is now 300 bytes for crappy DHCP servers :/ 2007-04-11 19:44:37 +00:00
Roy Marples
378dcbd5d5 Cuddle up to LKML style C 2007-04-11 13:18:33 +00:00
Roy Marples
70689e9f9f RFC 2131 is full of confusion regarding MTU it seems as the effective minimum MTU is really 576 or DHCP requests stop working. 2007-03-02 12:11:46 +00:00
Roy Marples
092592331f Add DHCP over FireWire 1394 (RFC 2855) and InfiniBand (RFC 4390) support. 2007-02-12 16:12:50 +00:00
Roy Marples
3d19de577b For infinite timeout, we now resent the last request at TIMEOUT_MINI
intervals like we do otherwise.
We now return a non zero exit code on SIGTERM and SIGINT if we have not
forked into the background.
When NIS and/or NTP servers are updated, we restart the service for them
if we can.
2007-01-16 17:54:07 +00:00
Roy Marples
a2d14c214c Fix cleanmetas function and fix FreeBSD again 2006-12-15 14:47:01 +00:00
Roy Marples
d3e2c11ab4 Make the consts sane 2006-12-14 23:47:56 +00:00
Roy Marples
24c57f1305 Set the rfds correctly so we can get a reply after re-sending a request.
Set the seconds elasped and maximum message size correctly in DHCP messages.
Now compiles on Linux 2.4 kernels.
2006-12-01 12:50:53 +00:00
Roy Marples
479225b66b Quote all vars in the info file.
-n and -G options now work as stated in the man page.
Handle select loops with large timeouts and infinite lease times.
Correctly set the broadcast flag.
make_dhcp_packet already has byte ordered addresses, thanks to TGL
for the fix.
If we get a NAK then always re-enter the INIT state.
2006-11-30 13:04:23 +00:00
Roy Marples
cced195e70 Add dhcpcd-3 re-write 2006-11-27 20:23:22 +00:00