Commit Graph

617 Commits

Author SHA1 Message Date
Roy Marples
7329549972 Guard against failure in if_discover. Thanks to Will Miles. 2014-12-20 14:09:26 +00:00
Roy Marples
2d965ccde4 Don't set RA ownership in test mode. 2014-12-18 10:09:54 +00:00
Roy Marples
12d20a042c If we get another carrier event during the poll for IFF_UP, cancel the poll. 2014-12-09 09:45:56 +00:00
Roy Marples
0ddc18a90d Instead if giving up if we receive a LINK_UP event before the kernel has set
IFF_UP, poll for it until it's set or carrier goes down.
2014-12-09 09:39:30 +00:00
Roy Marples
24b0516e31 Fix a coverity warning. 2014-12-02 09:25:14 +00:00
Roy Marples
465083d9e0 When not daemonising, don't exit on timeout. 2014-11-24 11:03:28 +00:00
Roy Marples
4d91c2e720 If allowinterfaces is not specified, allow all configured interfaces
to work, such as loopback and ppp.
2014-11-18 12:06:08 +00:00
Roy Marples
0b626d5c0e Disable IPv6RS if a loopback, pointopoint or not a multicast interface. 2014-11-18 11:47:45 +00:00
Roy Marples
e80baca56a If we don't have a hwlen and no clientid has been set,
force a DUID based ClientID.
2014-11-18 11:28:14 +00:00
Roy Marples
efd2409a85 If we don't have a hardware address, fallback to creating
a default IAID from the interface name and index as we used to.
2014-11-18 10:51:00 +00:00
Roy Marples
5d1238a7aa Reload global config when running per interface commands.
This matches the signal behaviour.
2014-11-18 04:23:40 +00:00
Roy Marples
354ad1f0aa Remove all interface timers when stopping. 2014-11-10 19:23:22 +00:00
Roy Marples
bc09d81de2 TAILQ is now inlcuded via config.h either via sys/queue.h or compat/queue.h.
This allows dhcpcd to compile on systems that do not even supply sys/queue.h,
such as the musl C library.

Thanks to Juan RP.
2014-11-10 16:56:32 +00:00
Roy Marples
f29061fe96 When stopping interfaces, skip past pseudo interfaces instead of finding
the master as only the masters are sorted correctly.
2014-11-07 18:57:35 +00:00
Roy Marples
7a1ae5f5e0 Fix disabling IPv6 on start error. 2014-11-03 11:50:11 +00:00
Roy Marples
4765fefb36 Close arp explicity as well. 2014-10-24 12:24:27 +00:00
Roy Marples
4c8486abdf Fix timeout 2014-10-23 19:50:37 +00:00
Roy Marples
1d5d236a81 Rework the ARP code so that we can have multiple ARP states.
Split the ARP resolution code to dhcp or ipv4ll where it belongs.
This allows us to probe IPv4LL while still DISCOVERing a DHCP lease.
2014-10-23 19:07:35 +00:00
Roy Marples
d9b80fcda0 If not doing DHCP or DHCP6, disable the DNS requirement in the RA to fork. 2014-10-22 08:54:09 +00:00
Roy Marples
878a75fdb6 Delay IPv4LL by a potential DHCP delay as well. 2014-10-17 20:56:21 +00:00
Roy Marples
e11a3c1cfa Always find delegates regardless of IPv6RS. 2014-10-17 13:46:19 +00:00
Roy Marples
f30470407c Allow the same IP address to be leased for different interfaces.
The interface with the lowest metric gets the address.
When that interfaces loses the address, the next valid interface with the
lowest metric gets it.
2014-10-09 18:59:30 +00:00
Roy Marples
559da5b05d Re-introduce our loop to poll interface flags when the interface does
not support link states, but this time ensure we don't call IFF_UP inside
the loop. This now works nicely with PPP interfaces on NetBSD at least.
2014-10-08 12:30:27 +00:00
Roy Marples
fb30935e5b Use RTF_PINNED if available.
Allows us to delete in-use subnet routes on FreeBSD.
2014-10-07 12:27:46 +00:00
Roy Marples
f9f9bc4a4e Callout to handlecarrier when we don't have real carrier support
and rely on looking at IFF_UP and IFF_RUNNING.
This allows our hooks to know that dhcpcd thinks we have a carrier or not.
2014-10-06 12:34:59 +00:00
Roy Marples
da4c896051 Improve the dev API a little. 2014-10-04 08:26:15 +00:00
Roy Marples
1ef1d5b92e Free control memory on fork 2014-10-04 08:22:09 +00:00
Roy Marples
8f008ca7f5 Remove vis based encoding - instead expand the DHCP option encoding to a
natural string based on content except as noted:
  *  domain (RFC3397)/dname (string) is strict domain name allowance
     (ie, [alnum] with _- (but not at the start or end))
  *  string is now printable ascii (1-127) until invalid
  *  ascii is all ascii (1-127) until invalid
  *  raw is all chars (1-255) until NUL
  *  binhex is a hex representation of the option including embedded NULs
  *  ssid is still escpaed octal because it's expected to be human readable
     AND can technically be all NUL
  *  everything else has strict option -> value encoding

This removes all shell escaped encoding - dhcpcd will assume that IF the
--script option is a shell, it will quote variables correctly.
The stock dhcpcd-run-hooks does.

dhcpcd -V now prints how the variables will be decoded.

Changed some options in dhcpcd-definitions.conf to more sensible defaults.
2014-10-01 18:32:03 +00:00
Roy Marples
b41d8098ae Remove the fast loop trying to up an interface which does not report
carrier.
2014-09-29 18:32:15 +00:00
Roy Marples
bc51f492ad Some strings don't need to be shell escaped - for example when sending to
syslog(2), so just use vis(3).
2014-09-28 20:26:49 +00:00
Roy Marples
f05b59c5f2 Fix an impossible clang analyser warning. 2014-09-27 02:22:34 +00:00
Roy Marples
06fd488ca1 Fix a memory error when ia_* config exists but IPv6 is disabled. 2014-09-26 21:50:52 +00:00
Roy Marples
58550cda79 We don't need to pass a signal handling function. 2014-09-23 09:08:17 +00:00
Roy Marples
2743ccc06c Remove some inline keywords, let the compiler work it out better. 2014-09-18 15:12:45 +00:00
Roy Marples
08af3cf1ed Remove all instances of if_indextoname and add a replacement
if_findindex as we should already have the interface at this point.
2014-09-18 00:35:03 +00:00
Roy Marples
48cb85bd25 This fix is wrong, real fix in libdhcpcd. 2014-09-16 10:22:24 +00:00
Roy Marples
f49ebfb640 The args sent from control socket do not include a program in argv[0]
so we need to adjustem them to pretend that they do.
Tests show that getopt(3) doesn't look at argv[0] so it's safe(ish).
2014-09-15 22:35:00 +00:00
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