Commit Graph

730 Commits

Author SHA1 Message Date
Roy Marples
9b72ef1ca1 Add an unprivileged control socket so that normal users can
obtain dhcpcd running state.
2014-09-14 19:12:57 +00:00
Roy Marples
d0e347ff57 Improve the waitip test. 2014-09-11 13:29:56 +00:00
Roy Marples
71650ebcde Allow SSIDs with non printable characters to be used in ssid selection in
dhcpcd.conf and generate more accurate stable private addresses.
2014-09-10 10:00:08 +00:00
Roy Marples
67ed6c5fdc Use the nl80211 interface on Linux to get the wireless SSID.
If this is not found in the system headers, fall back to assuming WEXT.
This has been done because the WEXT module has been marked as deprecated
for a while now and I'm getting bored of people asking me why their
wireless wasn't working. Bloated dhcpcd by another 600 bytes as a result.
2014-09-10 01:46:58 +00:00
Roy Marples
2f4d126e24 Add variables if_oneup and if_ipwaited so hook scripts know the overall state of dhcpcd better. 2014-09-07 19:03:41 +00:00
Roy Marples
923e118097 Implement a send queue for each control fd.
Only one call to write(2) should be performed for each POLLOUT check
via poll(2) so we should never see EAGAIN when writing to control
sockets ever again.
Each fd queue is limited to 100 entries so we don't OOM with badly
written control subscribers.
2014-09-05 12:28:05 +00:00
Roy Marples
a0011b9933 Only send DHCPv6 and RA to control sockets when DAD has been completed. 2014-09-04 19:55:37 +00:00
Roy Marples
23f9d8b4ce Add a write callback to eloop so we know when we can write to the socket.
This seems to be important for our control socket as sometimes, we fail to
write with EAGAIN and dhcpcd should not block on users of this socket.
2014-09-04 19:30:47 +00:00
Roy Marples
6dcd7daee5 --getinterfaces no longer supports an option interface list. 2014-09-04 16:23:36 +00:00
Roy Marples
41e9ebebbd Fix the number of interfaces we actually send 2014-09-02 23:41:52 +00:00
Roy Marples
9725266492 With an unknown link, test carrier manually and loop 100ms. 2014-07-25 12:49:53 +00:00
Roy Marples
bfeb5ecd10 When starting an interface and the carrier is UNKNOWN, wait 100ms before trying to start again.
UNKNOWN should only be reported for BSD systems where the carrier medium reports an error or is
not valid. In this case the carrier is only UP when IFF_RUNNING is set.
2014-07-22 18:03:34 +00:00
Roy Marples
b60a3b68ed Don't report DUID or IAID or the pseudo interface. 2014-07-07 17:23:16 +00:00
Roy Marples
9d5cb9f924 When requesting a IA_PD and another IA type, create a psuedo interface
to handle the IA_PD.
ia_pd_mix config option disables this and mixes IA_PD in the single session as
per draft-ietf-dhc-dhcpv6-stateful-issues-06.
2014-07-07 14:41:18 +00:00
Roy Marples
fb8a0db7c0 Add --pfxdlgonly and --nopfxdlg options to spawn separate dhcpcd instances
to allow for RFC conformance when you need to configure a Prefix Delegation
and a Normal Address for DHCPv6 on the same interface.
2014-07-04 11:53:56 +00:00
Roy Marples
ee8a3b3428 Print user defined options via -V 2014-07-03 23:11:00 +00:00
Roy Marples
a0bbca2d3c Fix a potential segfault when reloading configurations.
Thanks to Eelco Dolstra for the patch.
2014-07-03 10:07:35 +00:00
Roy Marples
39e51da4e7 Fix dumping DHCPv6 leases. This broke when we ignored IAIDs we didn't ask for. 2014-07-03 09:47:42 +00:00
Roy Marples
e17496222a Stop restoring kernel flags to their state before dhcpcd ran.
As multiple dhcpcd daemons could be in use to facilitate separate sessions
per DHCPv6 IA resetting them at exist could break the others.
2014-07-02 13:15:18 +00:00
Roy Marples
a7b76e0622 Fix some more compiler errors 2014-07-02 11:42:08 +00:00
Roy Marples
555e4ee545 Set addr to zero if unset. 2014-07-01 21:14:59 +00:00
Roy Marples
fa4cf79ee1 Fix link handling where kernel reported flags in LINK_UP may not be valid
when we actually process them.
2014-07-01 21:06:07 +00:00
Roy Marples
b0ca9ae9b1 Support http://datatracker.ietf.org/doc/draft-ietf-dhc-dhcpv6-stateful-issues.
It's not an RFC yet, but it seems it's needed for Prefix Delegation to work
on ComCast where a IA_NA is required as well.
2014-07-01 20:34:19 +00:00
Roy Marples
3070a5c95b Start the correct interface reference for added devices. 2014-06-30 15:55:28 +00:00
Roy Marples
bce64b1524 Improve startup with regards to carrier checking and adding a link-local
IPv6 address.
2014-06-30 15:43:58 +00:00
Roy Marples
942a8ffcf7 Add debugging messages for interface arrival/departure.
Only init state and run preinit for new interfaces.
2014-06-30 11:28:14 +00:00
Roy Marples
bf7db9eced Add the ability to dump DHCPv6 leases.
Control DHCPv4 vs DHCPv6 dumping via the family option.
2014-06-22 13:05:05 +00:00
Roy Marples
c9ce5cc4ff Ensure we init before forking, but run the preinit scripts afterwards 2014-06-05 13:03:49 +00:00
Roy Marples
2612c7f005 Ensure OWN is set by SLAAC private before initing.
Add a link-local address before running any PREINIT script
as well as at start incase a 3rd party removed it.
Move kernel tweaks to RA to DEBUG messages.
2014-06-05 11:38:04 +00:00
Roy Marples
d05215aa28 Add an IPv6 link-local address before upping the interface if needed.
Bring an interface up when we start it and not during discovery.
As such, stop waiting on carrier for a second if we did.
2014-06-04 23:54:15 +00:00
Roy Marples
1aeaf0e751 Default SLAAC to use RFC7271 addresses.
Create an IPv6 link-local address if non exists at startup using the
configured SLAAC method.
2014-06-04 20:27:40 +00:00
Roy Marples
c85baeae3e -4 and -6 are now mutually exclusive and when running on a single interface
per protocol pidfiles are created.
This means that other control options suchs as -x and -n will require the
-4 or -6 option as well.
2014-05-29 12:52:27 +00:00
Roy Marples
eb33667132 Add a compat syslog function if the libc syslog does not support LOG_PERROR.
Add a non working if-sun.c stub.
Define IN6_IFF_TENTATIVE and friends to zero so IPv6 at least compiles on Solaris.
Warn that Solaris support presently does not work.
2014-05-24 13:08:29 +00:00
Roy Marples
26c177737e Source now compiles on Solaris, just missing the if-sun.c support so
linking fails.
2014-05-21 23:07:52 +00:00
Roy Marples
047235d751 If a DHCPv6 lease expires as well as all IPv6 routers who want DHCPv6, don't restart discover. 2014-05-19 00:49:14 +00:00
Roy Marples
0b32a745d3 Only remove the interface from the list once all callouts have been
completed.
2014-05-16 15:03:28 +00:00
Roy Marples
4afb9c4336 Run NOCARRIER before dropping protocols. 2014-05-07 09:22:26 +00:00
Roy Marples
67616a589a Add the interface to our list before initing state. 2014-05-06 18:14:43 +00:00
Roy Marples
b4304101ee Always send a carrier as it's no longer encapsulated in the IPv4 stack.
When stopping and not departed, run with the STOPPED reason but do
not process it in hooks.
2014-05-06 14:42:24 +00:00
Roy Marples
e61b2a429f Fix writing interfaces to control socket. 2014-05-04 22:48:43 +00:00
Roy Marples
68e672702b Change the readrawsocket API a little so that we know when EOF is reached.
This allows us to remove the non blocking option from our sockets due to the way BPF works.
2014-05-02 23:54:29 +00:00
Roy Marples
94cb985a8e Log any errors sending the interface afer a getinterfaces call. 2014-05-02 20:57:21 +00:00
Roy Marples
c68ed24a38 Remove debug 2014-04-30 14:14:03 +00:00
Roy Marples
7cf6ba7ec3 Support ND6_IFF_OVERRIDE_RTADV 2014-04-30 14:13:22 +00:00
Roy Marples
7ec6b74bea Sorting interfaces is an IPv4 specific task, so move it into ipv4.c 2014-04-28 12:47:33 +00:00
Roy Marples
94bec97280 Namespace all public dhcpcd.c functions.
Add ipv4, ipv6, dhcp and dhcp6 options to re-enable if disabled globally.
Try and load a delegated interface if not running on all interfaces.
Fix delegated interfaces without a prefix set.
2014-04-28 12:02:12 +00:00
Roy Marples
1a7ff10050 Move net.c to if.c.
Ensure that if.c and if-KERNEL.c are namespaced correctly.
2014-04-25 10:42:37 +00:00
Roy Marples
0e2177c64e Fix compat/queue.h 2014-04-23 20:29:03 +00:00
Roy Marples
fbc3019cc1 Work with older libc's without O_CLOEXEC. 2014-04-18 13:17:42 +00:00
Roy Marples
34457fe661 Add -Wconversion to debug CFLAGS and fix fallout. 2014-03-27 22:14:52 +00:00
Roy Marples
9cf6e1039b More fixes to dhcp dumping leases.
When running dump and test hooks, exit early to allow as non root.
2014-03-11 22:37:10 +00:00
Roy Marples
f970fb668e Ensure that -M -x ifname does the right thing. 2014-03-11 10:41:27 +00:00
Roy Marples
af975e6853 Only check for carrier if state is still unknown. 2014-03-07 22:14:13 +00:00
Roy Marples
b317418153 Add -M, --master to force dhcpcd into master mode. 2014-03-07 10:22:37 +00:00
Roy Marples
7af0ae84c2 Rationalise signal handling - HUP now rebinds, ALRM now releases, USR1 reapplies config. 2014-03-07 10:08:58 +00:00
Roy Marples
9f30172bd6 Deleting IPv4 subnet routes and IPv6 prefixes now works on OpenBSD. 2014-03-06 22:29:26 +00:00
Roy Marples
ad6a36d4f3 Initial support for OpenBSD interface and routing priority. 2014-03-06 14:41:58 +00:00
Roy Marples
c8b42ae14d Compile and work on OpenBSD.
However, there is a problem deleting both IPv4 and IPv6 subnet routes.
Also, there is a problem opening a BPF fd in non blocking mode directly and
posix_spawn(3) fails to work so we block that in configure.
2014-03-05 18:11:22 +00:00
Roy Marples
4145d2b68a Expire DHCP lease and then run no carrier as a seperate operation.
Instead of waiting the maximum amount of time to report DAD failure/completion, poll the address flags periodically.
2014-03-03 12:10:58 +00:00
Roy Marples
8fc52ced6f Fix all errors reported by clang static analyser. 2014-02-27 20:00:39 +00:00
Roy Marples
2e0740acd3 Report interface carrier state to the dhcpcd-run-hooks as ifcarrier.
If ifcarrier is up, don't start wpa_supplicant.
2014-02-27 10:52:11 +00:00
Roy Marples
1989cad379 Don't use a variable length buffer 2014-02-25 14:11:35 +00:00
Roy Marples
929895ed29 Respect initial commandline arguments when rebooting via a signal. 2014-02-25 10:24:01 +00:00
Roy Marples
658bfd5e0c Fix arping moving to the next test if we find the IP address
but do not have a profile for it.
Thanks to David McGurty for the analysis.
2014-02-24 14:40:29 +00:00
Roy Marples
6618e7ea8b Add a USE_SIGNALS define.
If we're not using signals then we also create a control socket in the
non MASTER case. We then use this to communicate instead of signals.
2014-02-21 16:10:55 +00:00
Roy Marples
0d033d1791 Fix FreeBSD compile warnings. 2014-02-13 13:23:43 +00:00
Roy Marples
2433e54dc8 Ensure we close the contol socket if we fail to connect.
Don't crash when closing IPv6ND or DHCPv6 when not the IPv6 protocol is
not started.
2014-02-12 20:51:57 +00:00
Roy Marples
d733d75a89 No need to malloc pidfile. 2014-02-12 11:55:43 +00:00
Roy Marples
e9882fb08a Ensure we remove the socket from the eloop event queue before closing it. 2014-02-12 10:29:06 +00:00
Roy Marples
63d4472589 Fix compile on BSD 2014-02-12 09:25:58 +00:00
Roy Marples
4eb7b4896f Move all global variables into contexts, with a small exception for
signal handling.
This allows dhcpcd to work better in a threaded environment such as rtems.
2014-02-12 00:39:46 +00:00
Roy Marples
59a555cd3d Fix writing the pidfile and cleaning up a bit better. 2014-02-08 10:36:38 +00:00
Roy Marples
d074b2494f Move vendor out of global scope. 2014-02-08 00:29:02 +00:00
Roy Marples
c1b54b57cb get_line is now static inside of if-options.c and is a simple wrapper around getline(3). 2014-02-07 21:48:24 +00:00
Roy Marples
faaa132c33 Use fscanf instead of get_line when parsing /proc/cpuinfo 2014-02-07 20:31:29 +00:00
Roy Marples
ebc8827ae5 writepid is now a static inline function 2014-02-07 17:48:13 +00:00
Roy Marples
cc0502023e Remove custom set_cloexec and set_nonblock functions.
Instead pass O_CLOEXEC or SOCK_CLOEXEC to open, socket, etc.
This requires a fairly modern system.
2014-02-07 17:32:08 +00:00
Roy Marples
159ebbcf18 Use our own signal structure instead of siginfo_t to save space. 2014-02-07 15:49:33 +00:00
Roy Marples
01096a4f63 Copy the siginfo_t structure onto a global copy and pass that as an
argument to eloop_timeout_add_now so that every actionis async signal safe.
2014-02-07 14:39:22 +00:00
Roy Marples
c7c1e4112a Don't hold onto an AF_INET socket for the duration of the program,
open and close it as required.
2014-02-07 11:03:39 +00:00
Roy Marples
1f2c54e008 Exit correctly if no interfaces have a carrier. 2014-02-07 09:33:32 +00:00
Roy Marples
623e5af396 pidfd can be static now. 2014-02-05 13:18:58 +00:00
Roy Marples
9c8b417d8a Move control globals into a context. 2014-02-05 12:01:09 +00:00
Roy Marples
cff708ad3b Only return 0 from daemonise if we have forked successfully, otherwise the pid of the child. 2014-02-04 15:53:56 +00:00
Roy Marples
b5b066a566 Fork correctly from RA and DAD. 2014-02-04 15:46:38 +00:00
Roy Marples
a9d78def54 Remove DEBUG_MEMORY guard and always free memory and resources.
Remove all atexit(3) and exit(3) calls, instead exiting via the eloop.
2014-02-04 14:39:26 +00:00
Roy Marples
c6eb161be2 Implement support for RFC 3203, FORCERENEW message. 2014-01-31 11:47:27 +00:00
Roy Marples
c73ed17160 Implement RFC 1321 MD5 Message-Digest if not provided in libc.
Implement RFC 2104 HMAC Keyed Hashing.

Implement RFC 3118 Authentication for DHCP Messages
and RFC 3315 Authentication options.
2014-01-25 01:35:53 +00:00
Roy Marples
322ebc208b Ensure that config.h or common.h is the first included local header.
Thanks to Sebastian Huber.
2014-01-24 11:09:39 +00:00
Roy Marples
3582c56dcd Add prefix to copyright constant.
Thanks to Sebastian Huber.
2014-01-24 11:00:38 +00:00
Roy Marples
9ff636a5c7 IAID must be used within an interface block.
IA_PD must be used within an interface block.
You cannot assign a delegated prefix to the requesting interface.
2014-01-18 14:49:29 +00:00
Roy Marples
d1c384a686 Welcome to 2014! Relese dhcpcd-6.2.0. 2014-01-03 21:12:19 +00:00
Roy Marples
7a911e57cb Add support for RFC3925 Vendor-Identifying Vendor Options 2013-12-06 17:47:53 +00:00
Roy Marples
b7f5d1db5b Fix a few memory leaks, DHCPv6 prefix definition and the -V option. 2013-12-03 23:10:21 +00:00
Roy Marples
d9fbb11875 Fix a crash freeing our embedded config 2013-12-02 20:45:19 +00:00
Roy Marples
ae4e592fa2 Remove hard coded DHCP/DHCPv6 options and then to dhcpcd-definitions.conf
This file replaces dhcpcd-embedded.conf
This actually results in a slightly smaller binary than before and has the
added advantage that the option definitions are now all held within one file.
2013-12-02 16:42:09 +00:00
Roy Marples
1cd05a96d5 Read the embedded config into global values rather than each time
per interface.

Add config toggles to build dhcpcd-embedded.conf into dhcpcd or
to read it at runtime. The build process will now build .c and .h
files based on dhcpcd-embedded.conf and provide defines to reduce
the number or re-allocs if it grows (ie has the full DHCP option list).
2013-11-29 11:15:03 +00:00
Roy Marples
42c638c5d6 When running for a single interface, don't set WAITIP if we are
backgrounding immediatley.
2013-11-20 17:36:41 +00:00
Roy Marples
4873594f06 When releasing, we need to de-configure the interface as well. 2013-11-20 11:37:25 +00:00
Roy Marples
6f66c6c93f Change IAID to default from the last 4 bytes of the MAC address.
Rationale in the commit, but in a nutshell it allows for a stable
IAID between reboots without persistent storage and across
different OS's who name or number it differently to each other.
2013-11-15 16:44:46 +00:00
Roy Marples
ebc9d360fa Allow IAID to be configured in DHCPv4 clientid.
Use this as the default for DHCPv6 IA's as well.
Rename if_iaid to if_ia as it's really an IA containing an IAID.
2013-11-15 13:43:41 +00:00
Roy Marples
f796465a67 If we timeout, remove any waitip config so that we daemonise
correctly.
2013-10-05 16:28:33 +00:00
Roy Marples
7910de3282 We should abort if no specified interfaces are found. 2013-09-27 06:23:31 +00:00
Roy Marples
7e011222be Don't stop dev management on fork 2013-09-27 06:15:32 +00:00
Roy Marples
81ff1cbf91 Start dev after link for a more sane interface rename.
Only start dev in master mode.
2013-09-12 21:35:33 +00:00
Roy Marples
413652c1b3 Instead of linking directly to libudev, create a plugin system for /dev
management. This allows dhcpcd to work even if udev removed and adds the
ability to change from udev to something else in the future.
2013-09-12 15:43:20 +00:00
Roy Marples
7c3225083f Instead of just renaming the interface on Linux, take the FreeBSD
approach and remove the old and create a new one.
This simple change allows the the allow/deny rules to be followed.
2013-09-10 09:56:11 +00:00
Roy Marples
670118ad7f Fix compile warning on BSD 2013-09-09 23:09:29 +00:00
Roy Marples
1f88304a4e Fix interface renaming and carrier reporting when using udev 2013-09-09 20:22:12 +00:00
Roy Marples
50b52a2400 Fix initial carrier status 2013-09-05 13:27:52 +00:00
Roy Marples
7013b07382 Add 4 and 6 arguments to the waitip command so that you can specify
which protocols to wait for.
2013-08-31 16:48:39 +00:00
Roy Marples
15fc1181d5 Fix the persistent option. 2013-08-25 10:22:48 +00:00
Roy Marples
e82129a42c Reduce code size by merging IPv6 ND with RS. 2013-08-20 10:29:43 +00:00
Roy Marples
302025a6b9 Fix prior patch 2013-07-01 19:34:54 +00:00
Roy Marples
3566eb3cb5 Fix dhcpcd owning the RA if the kernel has disabled RA but there
is no directive in dhcpcd.conf
2013-07-01 19:23:19 +00:00
Roy Marples
ecf297d6c7 Detect link address changes on Linux.
Only NetBSD emits RTM_CHGADDR for link address changes.
Sadly no other BSD emits anything for link address changes so we have
to do a full discovery on carrier up.

When a link address does change, simply carry on as we are, no need
to drop any existing lease as the carrier change will do that for us.
2013-06-25 08:31:11 +00:00
Roy Marples
f164d58639 Arrived interfaces should share the same commandline options. 2013-06-19 10:06:54 +00:00
Roy Marples
a945c63ad9 Add a delay to initial Rebind IA_PD message.
Delay initial DHCPv6 messages a futher 2 seconds for POINTOPOINT links to
try and ensure dhcpcd receives a reply.
Process link events last so that dhcpcd can process any rejection messages.
When a delegating interface stops, the delegates addresses will be removed.
2013-06-18 09:17:28 +00:00
Roy Marples
6fb316a668 Fix a crash with departing interfaces.
Fix more needless spam when an interface departs.
2013-06-12 18:24:16 +00:00
Roy Marples
f127375eee Add a wpa_supplicant hook script.
This script starts wpa_supplicant on a wireless interface if not
already running and /etc/wpa_supplicant.conf exists, stops it
when the interface departs and sends wpa_supplicant a reconfigure
command.

If dhcpcd is running in master mode, you can use `dhcpcd -n eth0'
it instruct wpa_supplicant to reload its configuration file.
2013-06-07 20:03:28 +00:00
Roy Marples
336dd1b83b Move signal handling into dhcpcd.c
Log the PID of the signal caller
Move syslog functions out of the signal handler if we're not
exiting as it's not safe.
Close existing IPv4 sockets when restarting an interface.
Fix control handling keeping current flags and accepting new ones.
2013-06-07 12:44:19 +00:00
Roy Marples
f2e8e5175d Don't log carrier lost if carrier was UNKNOWN. 2013-06-06 18:39:12 +00:00
Roy Marples
ce289a66fa Add DEPARTED reason for when an interface is removed. 2013-06-06 12:38:15 +00:00
Roy Marples
2bf02a2b0b Don't assume the kernel will remove or mark tentative LL addresses.
This isn't a problem as we listen to IPv6 address changes.
2013-06-03 06:49:34 +00:00
Roy Marples
e74fdc60d4 In the event DHCPv6 is started without IPv6RS, we should wait for
a LL address to appear.
Also, use DH6S_INIT or DH6S_INFORM to dhcp6_start instead of 0 or
1 for clarity.
2013-05-30 22:39:17 +00:00
Roy Marples
fefc5353f3 Use LINK_UP/DOWN instead of magic numbers 2013-05-30 07:51:02 +00:00
Roy Marples
c5d2e393a5 Move SIOCGIFAFLAG_IN6 into if-bsd as in6_addr_flags
Add pfx_flush to flush ND6 entries when changing routes.
Both these functions only work for BSD, just stubs on Linux.

This tidies the code a little and fixes changing IPv6 routes on BSD,
although the kernel may complain network is down for a few moments.
2013-05-30 05:38:21 +00:00
Roy Marples
7afd1fdfb0 Comment on why we don't solicit dhcpv6 without an RA to instruct us. 2013-05-24 09:08:23 +00:00
Roy Marples
6e7265d527 Don't directly close stderr 2013-05-23 18:58:28 +00:00
Roy Marples
5331b839c9 Store IPv6 link local addresses per interface.
Listen to kernel messages to account them.
If we don't have a local link address, delay IPv6RS as it just
won#t work until we have a local link address.
2013-05-17 23:09:36 +00:00
Roy Marples
a8df1b28fb Use the kernel DAD for IPv6 addresses and finish the action once each
address DAD completes. BSD kernels will require a patch as noted within
the README. The linux netlink part still needs to be written.
2013-05-15 10:27:36 +00:00
Roy Marples
3491ea4d56 Change from _unused to __unused to match NetBSD cdefs and avoid
a compiler failure on linux-headers-3.7
2013-04-24 09:38:18 +00:00
Roy Marples
b3d908a6b0 Move dhcp_release into dhcp_drop 2013-04-04 23:57:12 +00:00
Roy Marples
66cf1d5db5 Don't crash when disabling IPv6 2013-04-04 23:25:31 +00:00
Roy Marples
8cc47ba26d White space police 2013-04-04 20:31:04 +00:00
Roy Marples
673e81e5b7 White space brigade 2013-04-02 07:01:11 +00:00
Roy Marples
00ababe4a0 Add DHCPv6 Prefix Delegation support, RFC3633.
Add DHCPv6 Temporary Address support, RFC3315.
2013-04-01 12:15:47 +00:00
Roy Marples
891ca6fad3 Fix rebooting. 2013-03-26 10:42:30 +00:00
Roy Marples
51a9a12419 Avoid a potential malloc when handling signals. 2013-03-26 08:51:34 +00:00
Roy Marples
92398db794 Move IPv6 RA checking and disabling kernel RA higher up the chain. 2013-02-19 16:05:12 +00:00
Roy Marples
53dae786ec Fix a crash. 2013-02-19 15:43:29 +00:00
Roy Marples
4c9c4b3ea0 Use TAILQ macros for IPv4 routes. 2013-02-19 15:23:53 +00:00
Roy Marples
4b0cbc8974 Use a TAILQ macro for our interface list. 2013-02-19 13:37:42 +00:00
Roy Marples
e6d2517562 Rework our signal setup and event loop around ppoll(2).
ppoll is mapped to pollts(2) for supporting systems.
If pselect(2) is available then we provide a compat shim for that, otherwise
we provide a non race free shim based on poll(2).
2013-02-18 20:56:55 +00:00
Roy Marples
cf6d21215b Restore our signal pipe so that we process signals in our event loop
as we use a lot of functions which are not safe according to signal(7).
2013-02-18 15:40:56 +00:00
Roy Marples
a54116c1c6 Move the signal reboot code into it's own function which is fired by
and eloop timeout of 0 seconds. We do this because we shouldn't modify
variables in a signal handler.
2013-02-18 10:35:47 +00:00
Roy Marples
28382337e1 Remove the xmalloc function.
Now we have removed all our xmalloc like functions dhcpcd can still
try to operate as best it can in low memory conditions.
2013-02-16 13:21:35 +00:00
Roy Marples
10e17e3f63 Remove xzalloc function 2013-02-15 21:45:08 +00:00
Roy Marples
fbbb0875dd Instead of opening link, ipv6, ipv6rs and ipv6ns sockets globally,
only open when the first link wanting this features needs it.
Hopefully fixes #263 and #264.
2013-02-15 20:33:13 +00:00
Roy Marples
68ceb7004a Fix compile on BSD 2013-02-04 14:12:48 +00:00
Roy Marples
aae24feb3d It's now possible to compile out IPv4 and IPv6 support by passing
--disable-ipv4 or --disable-ipv6 to configure.
2013-02-04 13:30:35 +00:00
Roy Marples
e88c525f50 Move ipv4 specific code out of net.c and into ipv4.c 2013-02-04 11:03:08 +00:00
Roy Marples
95fdd136ae Move if_state into interface->if_data as dhcp_state.
This should reduce memory usage for non IPv4 interfaces.
2013-02-03 22:55:45 +00:00
Roy Marples
5dc65f77b3 Move ipv4 specific infos from interface to if_state. 2013-02-03 14:52:24 +00:00
Roy Marples
875979f614 Move options away from ipv4 state to the interface. 2013-02-03 10:35:59 +00:00
Roy Marples
294eff4df4 Remove IPv4 and DHCP4 specific setup from dhcpcd.c and move into ipv4.c
and dhcp.c
Split configure.c into script.c and move the rest into dhcp.c

This starts the goal of making the base of dhcpcd protocol agnostic and
working towards building IPv4 and/or IPv6 code only to reduce size and
allow growing any future new protocol easier.
2013-02-02 14:05:55 +00:00
Roy Marples
3083087ccb Log error whe starting DHCPv6 without RA. 2012-12-07 09:46:49 +00:00
Roy Marples
dcec32683d If no IPv6 proc or sysctl entries exist for RA or forward, assume it's OK. 2012-12-07 09:43:56 +00:00
Roy Marples
4123fdf910 Normalise timing 2012-11-13 20:40:04 +00:00
Roy Marples
760780dd5c Use a proper namespace for IPv4LL 2012-11-13 11:44:20 +00:00
Roy Marples
9eb6e8dc94 Use a proper namespace for eloop 2012-11-13 11:25:51 +00:00
Roy Marples
e749a9ee95 Use a proper namespace for control 2012-11-13 10:17:19 +00:00
Roy Marples
94582a4d23 Expire the DHCPv6 lease when carrier drops. 2012-11-11 19:56:01 +00:00
Roy Marples
5c08c0c4ca Replace poll(2) with pselect(2) and vfork(2)+execve(2) with
posix_spawn(3).
Now we block all our signals at startup and allow pselect to
unblock them for the duration of the call. This allows us to
manage interrupts in a fashion to guarantee a consistent
internal state.

I have added a posix_spawn compat shim for systems that lack
that call. pselect(2) has been supported on target for some time
so there is no need for a compat shim there.
2012-11-10 16:38:52 +00:00
Roy Marples
599c9aeb6b Add a message to indicate dhcpcd exited cleanly. 2012-11-10 08:44:48 +00:00
Roy Marples
e54dee19ba Implement the core DHCPv6 client for SOLICIT, REQUEST, RENEW, CONFIRM. 2012-11-06 23:40:15 +00:00
root@uberpc.marples.name
930c51ad33 Fix some more potential leaks and allow full build with dmalloc. 2012-11-01 17:02:01 +00:00
Roy Marples
fccffbd9cf Plug some memory leaks. 2012-11-01 14:46:05 +00:00
Roy Marples
225624555b Improve reported timings. 2012-10-27 12:11:04 +00:00
Roy Marples
8c48758ad5 Show renew and rebind times when debugging is enabled.
Trying to help #259.
2012-10-27 11:38:17 +00:00
Roy Marples
652b80c8a9 Drop DHCPv6 on carrier down.
Send DHCPv6 interface information.
2012-10-12 19:10:04 +00:00
Roy Marples
f29cbe614f Fix code for -Wstrict-overflow 2012-10-12 11:26:20 +00:00
Roy Marples
d7555c1259 Add DHCPv6 INFORM support.
This is automatically started when RA flags O is set.
If no DHCPv6 request options are configured in dhcpcd.conf then we
request domain servers and search lists.
2012-10-12 10:31:51 +00:00
Roy Marples
27805e96f6 Move the default vendor string to a global variable.
When an interface starts, it assigns this by default instead of
generating it each time.
2012-10-09 13:20:50 +00:00
Roy Marples
56e106a774 Fix DUID support.
In the case where we cannot write a DUID file, then create a LL ID
instead of a LLT ID.
2012-10-09 13:14:56 +00:00
Roy Marples
f7d18e2ceb xid should be treated in network byte order 2012-10-08 16:13:47 +00:00
Roy Marples
0b0b417782 Restart the interface immediately after a NAK instead of
waiting one second.
2012-09-22 13:28:34 +00:00
Roy Marples
701b840fc4 Remove -v from --version in usage. 2012-08-18 13:58:53 +00:00
Roy Marples
8ce6389572 If we fail to open sockets, don't bother sending the request. 2012-08-06 10:24:13 +00:00
Roy Marples
bde566f574 Disable kernel interface RA as early as possible on Linux.
Don't add duplicate interfaces to the restore kernel RA on Linux.
2012-07-13 08:22:04 +00:00
Roy Marples
eebe9a1887 Improve IPv6 RA support by allowing dhcpcd to manage the address and routes
instead of the kernel. dhcpcd will only do this if RA is disabled in the kernel
or dhcpcd has been instructed to do this via dhcpcd.conf(5) ipv6ra_own and
ipv6ra_own_default directives.

Send and process IPv6 Neighbor Solicitions and Adverts to prove router
reachability. If a router cannot be reached in this way then it is expired.

When debugging, all ND messages are displayed which will create a lot of log
spam.

To ease packaging, ./configure now accepts LDFLAGS and --enable-static.
2012-07-05 16:37:41 +00:00
Roy Marples
248cf0d859 Remove unused variables 2012-04-01 07:38:52 +00:00
Roy Marples
2c77247bd0 Interface index should persist and be unique for the interface lifetime.
As such, store it at discover and stop using if_nametoindex(3).
2012-03-30 09:37:21 +00:00
roy@uberlaptop.marples.name
6b2a61c053 When sending signals, respect the interface it was started on. 2012-03-27 16:47:43 +00:00
Roy Marples
b5de3cec6a Fix Dd and Dt arguments.
New sentence, new line.
Sort options and option descriptions.
Sort SEE ALSO.
Use Fl Fl for long options.
Sync the usage output by the program with the one from the man page.
Thanks to Thomas Klausner.
2012-03-24 10:41:40 +00:00
Roy Marples
5e084fac90 If no ClientID or hardware address, don't report a blank hardware address. 2012-03-20 09:18:20 +00:00
Roy Marples
61dd6cf9ab Add an option to control dhcpcd forking or not if the RA does not contain
a RDNSS option.
This involves changing our options to an unsigned long long so we can use
more than 32 bits.
2012-03-07 10:06:45 +00:00
Roy Marples
d705c979f0 Respect an accept_ra setting of 2, fixes #240.
Detect IPv6 settings per interface if the platform allows, fixed #241.
2012-03-05 10:04:26 +00:00
Roy Marples
832efb4abf Stop checking for IFF_RUNNING in handle_carrier as it is invalid for BSD
and should already have been checked for Linux.
2012-02-05 19:32:17 +00:00
roy@uberlaptop.marples.name
441b06bc38 If the kernel is not configured to accept IPv6 or RA's then don't
needless attempt to solicit an IPv6 RA.
2012-02-04 15:15:25 +00:00
Roy Marples
449df9c859 Fix some more copyrights
RA expiry timers now trigger off options as well
Stop prefixing new_ for RA options
if_up and if_down are now set by dhcpcd itself
Correctly prefer a DHCP lease over an IPv4LL entry
2012-02-02 16:22:40 +00:00
Roy Marples
7ae411d942 Fix more copyright 2012-01-31 09:51:12 +00:00
Roy Marples
e0c4d1587d Allow dhcpcd to run on a read-only filesystem.
You'll get a lot of errors, but you will get a working address and routing.
2012-01-29 17:28:05 +00:00
Roy Marples
70b967d7d7 Remove the RA's before reporting no carrier. 2012-01-29 16:49:04 +00:00
Roy Marples
0c6ad78288 Don't start IPv6 if it's disabled globally. 2012-01-29 16:32:06 +00:00
Roy Marples
29fe5ed6a4 Just log the fact that the leased IP address was removed instead of
expiring the lease. This allows --reconfigure, -g to fully work as
intended.
2011-12-18 12:12:08 +00:00
Roy Marples
1c657b0883 Stop the --reconfigure, -g option from spinning needlessly.
Thanks to Mike Crowe.
2011-12-18 12:11:08 +00:00
Roy Marples
f36522c53f Fix hook for non RA's.
Remove RA's before the DHCP lease.
Correctly send 3 RA solicitations.
2011-12-16 12:20:04 +00:00
Roy Marples
d522b92049 Disable IPv6RS on p2p, lo and mcast interfaces. 2011-12-15 03:37:27 +00:00
Roy Marples
91cd732493 Add an implementation of an IPv6 Router Solicitor as specified in
RFC6016 with regards to RDNSS and DNSSL.
2011-12-15 02:35:47 +00:00