]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
7 years agoTest for ENOMEM as well.
Roy Marples [Mon, 19 Mar 2018 17:26:15 +0000 (17:26 +0000)] 
Test for ENOMEM as well.

7 years agolink: detect buffer overflow / desync and relearn interface state
Roy Marples [Mon, 19 Mar 2018 15:39:05 +0000 (15:39 +0000)] 
link: detect buffer overflow / desync and relearn interface state

It's possible for the internal kernel buffer that reports network
events to overflow.
On Linux and NetBSD* this is handled by ENOBUFS being returned
by recv(2). On OpenBSD there is a special route(4) message RTM_DESYNC.
All other OS's don't seem to report this error, so dhcpcd cannot
detect it.

* I will commit a patch to NetBSD soon for this and will request a
pullup to NetBSD-8.

7 years agoipv6nd: simplify reachable
Roy Marples [Thu, 15 Mar 2018 20:31:14 +0000 (20:31 +0000)] 
ipv6nd: simplify reachable

7 years agodhcp6: deny unicast in non master mode
Roy Marples [Sat, 10 Mar 2018 11:50:08 +0000 (11:50 +0000)] 
dhcp6: deny unicast in non master mode

It seems that some DHCP6 servers or firewalls really insist on the
client sending from the correct source port.
This is the safest thing for the time being.

7 years agoLog the pid of the process deleting an assigned address.
Roy Marples [Tue, 6 Mar 2018 08:55:11 +0000 (08:55 +0000)] 
Log the pid of the process deleting an assigned address.

This should make debugging easier with third party software.

7 years agoipv6nd: drop DHCPv6 when RA fully expires
Roy Marples [Fri, 2 Mar 2018 15:00:07 +0000 (15:00 +0000)] 
ipv6nd: drop DHCPv6 when RA fully expires

Fixes an error where RA addresses would expire but the DHCPv6
lease still persisted.

7 years agodhcp6: don't drop when still asking for delegation
Roy Marples [Fri, 2 Mar 2018 13:58:52 +0000 (13:58 +0000)] 
dhcp6: don't drop when still asking for delegation

7 years agoinet6: remove references to the crazies.
Roy Marples [Sun, 25 Feb 2018 16:31:23 +0000 (16:31 +0000)] 
inet6: remove references to the crazies.

And add a comment that if we do this again to add a new knob for it.

7 years agoSpelling
Roy Marples [Tue, 20 Feb 2018 09:08:02 +0000 (09:08 +0000)] 
Spelling

7 years agohooks: document that hooks are not run within their own process
Roy Marples [Tue, 20 Feb 2018 09:06:38 +0000 (09:06 +0000)] 
hooks: document that hooks are not run within their own process

7 years agodhcpcd: Don't report errno when aborting here.
Roy Marples [Tue, 20 Feb 2018 08:36:53 +0000 (08:36 +0000)] 
dhcpcd: Don't report errno when aborting here.

7 years agoif-linux: if_setup_inet6 is called once so remove local ifname
Roy Marples [Tue, 20 Feb 2018 08:25:59 +0000 (08:25 +0000)] 
if-linux: if_setup_inet6 is called once so remove local ifname

7 years agodhcp: reset interval during init
Roy Marples [Tue, 13 Feb 2018 10:33:06 +0000 (10:33 +0000)] 
dhcp: reset interval during init

This fixes NetBSD where the lease is persisted at carrier down.
When the carrier comes back up again we need the interval
to reset to zero so that DHCP happens quicker.

7 years agoAdd support for setproctitle(3).
Roy Marples [Tue, 13 Feb 2018 10:22:31 +0000 (10:22 +0000)] 
Add support for setproctitle(3).

7 years agoWhitespace.
Roy Marples [Sat, 10 Feb 2018 20:52:31 +0000 (20:52 +0000)] 
Whitespace.

7 years agoFix compile on IllumOS.
Roy Marples [Fri, 2 Feb 2018 16:39:03 +0000 (16:39 +0000)] 
Fix compile on IllumOS.

7 years agoSatisfy FreeBSD and NetBSD.
Roy Marples [Fri, 2 Feb 2018 16:35:38 +0000 (16:35 +0000)] 
Satisfy FreeBSD and NetBSD.

7 years agoFix compile on FreeBSD.
Roy Marples [Fri, 2 Feb 2018 16:28:31 +0000 (16:28 +0000)] 
Fix compile on FreeBSD.

7 years agoinet6: simplify setup of kernel
Roy Marples [Fri, 2 Feb 2018 11:24:58 +0000 (11:24 +0000)] 
inet6: simplify setup of kernel

Rename if_checkipv6 to if_setup_inet6 so it's more descriptive.
simpify code as we don't really care about the result.
Restore the prior behavior of not disabling kernel RA handling
if dhcpcd is not doing it.

7 years agoRelease dhcpcd-7.0.1 v7.0.1
Roy Marples [Mon, 29 Jan 2018 10:53:05 +0000 (10:53 +0000)] 
Release dhcpcd-7.0.1

7 years agodhcpcd-run-hooks: set vars to blank
Roy Marples [Sat, 20 Jan 2018 20:37:48 +0000 (20:37 +0000)] 
dhcpcd-run-hooks: set vars to blank

7 years agodhcpcd-run-hooks: POSIX shell does not require the local builtin
Roy Marples [Sat, 20 Jan 2018 20:28:20 +0000 (20:28 +0000)] 
dhcpcd-run-hooks: POSIX shell does not require the local builtin

And sadly some ksh variants don't support it.
As dhcpcd strives to be portable, stop using local.

7 years agoRemove unused variable.
Roy Marples [Sat, 20 Jan 2018 17:16:25 +0000 (17:16 +0000)] 
Remove unused variable.

7 years agoRemove now unused sysloglike define.
Roy Marples [Tue, 16 Jan 2018 17:27:49 +0000 (17:27 +0000)] 
Remove now unused sysloglike define.

7 years agoMerge pull request #1 from chathhorn/patch-1
Roy Marples [Tue, 16 Jan 2018 17:17:47 +0000 (17:17 +0000)] 
Merge pull request #1 from chathhorn/patch-1

Fix build issue when `__GNUC__ <= 2`

7 years agoFix build issue when `__GNUC__ <= 2`
Chris Hathhorn [Tue, 16 Jan 2018 16:45:04 +0000 (10:45 -0600)] 
Fix build issue when `__GNUC__ <= 2`

The `__printflike` macro appears to take two arguments.

7 years agodhcpcd: don't log errors working out carrier for departed interfaces
Roy Marples [Thu, 11 Jan 2018 11:21:08 +0000 (11:21 +0000)] 
dhcpcd: don't log errors working out carrier for departed interfaces

7 years agoBump date for man updates.
Roy Marples [Mon, 8 Jan 2018 10:24:16 +0000 (10:24 +0000)] 
Bump date for man updates.

7 years agoRemove no longer needed active check from prior commit.
Roy Marples [Mon, 8 Jan 2018 09:29:51 +0000 (09:29 +0000)] 
Remove no longer needed active check from prior commit.

7 years agoipv4: allow configuration of static broadcast address
Roy Marples [Mon, 8 Jan 2018 09:25:31 +0000 (09:25 +0000)] 
ipv4: allow configuration of static broadcast address

7 years agoif: don't set MTU during interface discovery
Roy Marples [Sun, 7 Jan 2018 18:37:50 +0000 (18:37 +0000)] 
if: don't set MTU during interface discovery

7 years agodhcp: don't loop needlessly when handling an interface
Roy Marples [Sun, 7 Jan 2018 17:46:56 +0000 (17:46 +0000)] 
dhcp: don't loop needlessly when handling an interface

7 years agoif: don't activate non matching interfaces to commandline ones
Roy Marples [Sun, 7 Jan 2018 17:41:27 +0000 (17:41 +0000)] 
if: don't activate non matching interfaces to commandline ones

7 years agoconfigure: make --includedir=/usr/src/foo work
Roy Marples [Sun, 7 Jan 2018 13:24:21 +0000 (13:24 +0000)] 
configure: make --includedir=/usr/src/foo work

7 years agoeloop-bench: use calloc
Roy Marples [Fri, 5 Jan 2018 19:07:35 +0000 (19:07 +0000)] 
eloop-bench: use calloc

7 years agoeloop-bench: fix reading the last write
Roy Marples [Fri, 5 Jan 2018 17:29:27 +0000 (17:29 +0000)] 
eloop-bench: fix reading the last write

The last write was never read from the pipe in the run, so many
runs filled the kernel buffer causing an error which was not seen
because the pipe was blocking.

Set the pipes to non blocking and improve the exit conditions,
also ensuring the bench returns any error back.
While here add more timings and run critera.

Thanks to Christos Zoulas for helping.

7 years agodhcp: don't bind when we've just probed an address to inform
Roy Marples [Tue, 2 Jan 2018 16:36:04 +0000 (16:36 +0000)] 
dhcp: don't bind when we've just probed an address to inform

This fixes an early fork issue.

7 years agoRelease dhcpcd-7.0.0 v7.0.0
Roy Marples [Mon, 1 Jan 2018 11:17:56 +0000 (11:17 +0000)] 
Release dhcpcd-7.0.0

7 years agoWelcome to 2018.
Roy Marples [Mon, 1 Jan 2018 11:17:24 +0000 (11:17 +0000)] 
Welcome to 2018.

7 years agohooks: set protocol to link for link layer events
Roy Marples [Tue, 12 Dec 2017 14:32:48 +0000 (14:32 +0000)] 
hooks: set protocol to link for link layer events

7 years agoipv6: disable kernel RA if interface is active
Roy Marples [Tue, 12 Dec 2017 13:38:43 +0000 (13:38 +0000)] 
ipv6: disable kernel RA if interface is active

7 years agolinux: use IFA_F_NOPREFIXROUTE for ipv4 addresses
Roy Marples [Sun, 10 Dec 2017 18:49:20 +0000 (18:49 +0000)] 
linux: use IFA_F_NOPREFIXROUTE for ipv4 addresses

7 years agodhcp6: fix prefix delegations from spamming syslog
Roy Marples [Fri, 8 Dec 2017 10:29:49 +0000 (10:29 +0000)] 
dhcp6: fix prefix delegations from spamming syslog

This test was broken because pdp.vltime was already converted from
network order to host order.

7 years agobsd: set sa_len
Roy Marples [Thu, 7 Dec 2017 21:12:43 +0000 (21:12 +0000)] 
bsd: set sa_len

7 years agodhcp: set probe state only when probing.
Roy Marples [Thu, 7 Dec 2017 20:44:13 +0000 (20:44 +0000)] 
dhcp: set probe state only when probing.

This fixes the REBIND reason.

7 years agodhcp6: Free any existing new state
Roy Marples [Thu, 7 Dec 2017 18:33:20 +0000 (18:33 +0000)] 
dhcp6: Free any existing new state

This can happen on any OS in the case of an ARP conflict which
triggers dhcpcd to potentially change profile and DHCP6 options.

7 years agodhcp6: don't listen on IPv6 addresses when not using DHCP6
Roy Marples [Thu, 7 Dec 2017 17:01:39 +0000 (17:01 +0000)] 
dhcp6: don't listen on IPv6 addresses when not using DHCP6

To achieve this we need to learn the addresses AFTER the interface
configuration has been loaded.

7 years agodhcp: Don't set ciaddr or unicast if the address we have is faked.
Roy Marples [Thu, 7 Dec 2017 15:15:45 +0000 (15:15 +0000)] 
dhcp: Don't set ciaddr or unicast if the address we have is faked.

7 years agodhcp: when unicasting, don't use a L2 broadcast
Roy Marples [Thu, 7 Dec 2017 15:12:18 +0000 (15:12 +0000)] 
dhcp: when unicasting, don't use a L2 broadcast

This relies change now relies on the kernel supporting IP_PKTINFO
to select the correct outbound interface which may not
always be the case due to routing.

7 years agoRelease dhcpcd-7.0.0-rc4 v7.0.0-rc4
Roy Marples [Wed, 6 Dec 2017 09:44:26 +0000 (09:44 +0000)] 
Release dhcpcd-7.0.0-rc4

7 years agoeloop: set _eloop in signal setup rather than start
Roy Marples [Wed, 15 Nov 2017 15:14:24 +0000 (15:14 +0000)] 
eloop: set _eloop in signal setup rather than start

This fixes a potential issue where a signal could be received
before eloop_start is called.

7 years agoInit the signal handler ASAP so random stuff can be cleaned up.
Roy Marples [Wed, 15 Nov 2017 14:51:48 +0000 (14:51 +0000)] 
Init the signal handler ASAP so random stuff can be cleaned up.

7 years agoDHCPv6: confirm lease on carrier up
Roy Marples [Tue, 14 Nov 2017 16:41:59 +0000 (16:41 +0000)] 
DHCPv6: confirm lease on carrier up

On some platforms which preserve state when carrier goes down,
such as NetBSD-8, the state does not enter the CONFIRM state.
Add more logic to dhcp6_start so that we can better control this
from the various call points.

7 years agoIPv6ND: Fix lifetime overflow on carrier up
Roy Marples [Tue, 14 Nov 2017 15:37:23 +0000 (15:37 +0000)] 
IPv6ND: Fix lifetime overflow on carrier up

Set the acquired time of the address to now as we're forcing short
vltime and pltime.

7 years agoBSD: Strip scope from link-local addresses for KAME stacks
Roy Marples [Tue, 14 Nov 2017 12:16:26 +0000 (12:16 +0000)] 
BSD: Strip scope from link-local addresses for KAME stacks

This fixes DHCPv6 and IPv6ND trying to send messages from
DETACHED or TENTATIVE addresses when carrier comes back.

7 years agoif-linux: fix a potential NULL de-reference
Roy Marples [Mon, 6 Nov 2017 21:51:34 +0000 (21:51 +0000)] 
if-linux: fix a potential NULL de-reference

7 years agodhcp6: don't make delegated addresses stale
Roy Marples [Mon, 6 Nov 2017 12:37:02 +0000 (12:37 +0000)] 
dhcp6: don't make delegated addresses stale

7 years agodhcp6: redirect message to interface with matching xid
Roy Marples [Mon, 6 Nov 2017 12:15:53 +0000 (12:15 +0000)] 
dhcp6: redirect message to interface with matching xid

When unicasting and receiving unicasted messages, it's possible
that the outgoing and incoming interfaces don't match where the
address and/or prefix are.
To solve this, don't dictate the outgoing interface when unicasting
and match the incoming xid to one we have sent on another interface.

7 years agoEnsure that xid is unique across all interfaces.
Roy Marples [Mon, 6 Nov 2017 12:10:02 +0000 (12:10 +0000)] 
Ensure that xid is unique across all interfaces.

7 years agodhcpcd-run-hooks(8) should not attempt to guess the protocol.
Roy Marples [Fri, 3 Nov 2017 16:38:18 +0000 (16:38 +0000)] 
dhcpcd-run-hooks(8) should not attempt to guess the protocol.

7 years agoDHCPv6: listen on all IPv6 addresses for active interface
Roy Marples [Wed, 25 Oct 2017 13:56:23 +0000 (14:56 +0100)] 
DHCPv6: listen on all IPv6 addresses for active interface

Simplify the process of selecting addresses to listen for DHCPv6
replies on by listening on all addresses for active interfaces
when not in master mode.

Always send from a socket not bound to an address to ensure
unicast in non master mode works fine. The downside of this approach
is that we no longer send from the DHCPv6 client port, but this
seems to work fine, at least with ISC DHCPd.

7 years agoipv6nd: don't handle NA or RA if not active interface
Roy Marples [Wed, 25 Oct 2017 10:45:25 +0000 (11:45 +0100)] 
ipv6nd: don't handle NA or RA if not active interface

This stops interfaces activated only for delegating to from
receiving these messages by default.

7 years agobpf: remove the BPF_FREE flag
Roy Marples [Wed, 25 Oct 2017 08:15:10 +0000 (09:15 +0100)] 
bpf: remove the BPF_FREE flag

ARP code can just try and free the istate if no astates left
after finishing the read loop.

7 years agoarp: fix memory leak
Roy Marples [Tue, 24 Oct 2017 23:23:29 +0000 (00:23 +0100)] 
arp: fix memory leak

Prior patch introduced a memory leak if a new ARP state was
added after BPF_FREE was set. Cater for this.

7 years agoFix prior patches by using correct bitmasks for flags.
Roy Marples [Tue, 24 Oct 2017 23:04:44 +0000 (00:04 +0100)] 
Fix prior patches by using correct bitmasks for flags.
Add BPF_READING and BPF_FREE so that arp can free the state
after finishing the read loop.

7 years agoFix a boo boo
Roy Marples [Tue, 24 Oct 2017 22:33:27 +0000 (23:33 +0100)] 
Fix a boo boo

7 years agobpf: store flags in state for a better abort
Roy Marples [Tue, 24 Oct 2017 22:11:15 +0000 (23:11 +0100)] 
bpf: store flags in state for a better abort

There are cases when dhcp may close and open an ARP socket
during an ARP read. This means the fd will not be -1, so we need
to set BPF_EOF when closing the socket.

7 years agodhcp: arp announce existing address before reboot
Roy Marples [Mon, 23 Oct 2017 23:13:09 +0000 (00:13 +0100)] 
dhcp: arp announce existing address before reboot

This updates upstream ARP tables to send their ACK to the
interface we want to receive the message on and not one
which is not in use but has the same IP address.

Doing this means we no longer need to open DHCP sockets for
interfaces we're not interested in.

7 years agodhcp: improve error logging about UDP checksum failure
Roy Marples [Mon, 23 Oct 2017 09:55:28 +0000 (10:55 +0100)] 
dhcp: improve error logging about UDP checksum failure

7 years agoMake this more readable.
Roy Marples [Sat, 21 Oct 2017 13:10:02 +0000 (14:10 +0100)] 
Make this more readable.

7 years agoOpenBSD: Remove route labelling support
Roy Marples [Tue, 10 Oct 2017 20:51:55 +0000 (21:51 +0100)] 
OpenBSD: Remove route labelling support

It was only added because OpenBSD dhclient did similar .... that
was removed so dhcpcd is following suit.

7 years agoDon't attempt to flush IPv6 routers or prefixes if the kernel
Roy Marples [Tue, 10 Oct 2017 20:04:27 +0000 (21:04 +0100)] 
Don't attempt to flush IPv6 routers or prefixes if the kernel
does not support setting them.

7 years agoDon't mark statically configured IPv4 routes as DHCP.
Roy Marples [Mon, 9 Oct 2017 19:21:05 +0000 (20:21 +0100)] 
Don't mark statically configured IPv4 routes as DHCP.

7 years agoSet DHCP routes as DHCP in supported OS's.
Roy Marples [Mon, 9 Oct 2017 19:11:36 +0000 (20:11 +0100)] 
Set DHCP routes as DHCP in supported OS's.

7 years agoSet RA routes as RA in supported OS's.
Roy Marples [Mon, 9 Oct 2017 18:57:09 +0000 (19:57 +0100)] 
Set RA routes as RA in supported OS's.

7 years agoUpdate README from dhcpcd.conf
Roy Marples [Mon, 9 Oct 2017 09:28:03 +0000 (10:28 +0100)] 
Update README from dhcpcd.conf

7 years agoRelease dhcpcd-7.0.0-rc3 v7.0.0-rc3
Roy Marples [Sat, 7 Oct 2017 13:47:11 +0000 (14:47 +0100)] 
Release dhcpcd-7.0.0-rc3

7 years agoState it's a SLAAC address
Roy Marples [Sat, 7 Oct 2017 12:48:41 +0000 (13:48 +0100)] 
State it's a SLAAC address

7 years agoDocument that -r and -s require the address on the command line.
Roy Marples [Sat, 7 Oct 2017 12:36:24 +0000 (13:36 +0100)] 
Document that -r and -s require the address on the command line.
They are still optional in dhcpcd.conf.

7 years agoDocument slaac hwaddr in the default dhcpcd.conf
Roy Marples [Sat, 7 Oct 2017 12:33:00 +0000 (13:33 +0100)] 
Document slaac hwaddr in the default dhcpcd.conf

7 years agoDon't re-define what crypt sources we need.
Roy Marples [Thu, 5 Oct 2017 13:03:35 +0000 (14:03 +0100)] 
Don't re-define what crypt sources we need.

7 years agoFix compile on Illumos.
Roy Marples [Thu, 5 Oct 2017 13:53:11 +0000 (14:53 +0100)] 
Fix compile on Illumos.

7 years agoSupply __arraycount if not present.
Roy Marples [Thu, 5 Oct 2017 13:34:05 +0000 (14:34 +0100)] 
Supply __arraycount if not present.

7 years agoFix prior on stricter shells.
Roy Marples [Thu, 5 Oct 2017 13:33:48 +0000 (14:33 +0100)] 
Fix prior on stricter shells.

7 years agoDetect hmac(3) in libc or the library containing MD5.
Roy Marples [Thu, 5 Oct 2017 13:13:02 +0000 (14:13 +0100)] 
Detect hmac(3) in libc or the library containing MD5.
If not found, a compat function is provided, taken from NetBSD.

7 years agoWe don't actually care about the number of added routes, just
Roy Marples [Thu, 5 Oct 2017 07:05:08 +0000 (08:05 +0100)] 
We don't actually care about the number of added routes, just
it we failed or not.
So just return 0 on success and -1 on failure to work around
a gcc check where signed int could overflow.
This should be impossible anyway due to the protocol limits of
DHCP and RA.

7 years agoFree any allocated routes if we failed to allocate some.
Roy Marples [Thu, 5 Oct 2017 06:35:16 +0000 (07:35 +0100)] 
Free any allocated routes if we failed to allocate some.

7 years agoAdd compat/strlcpy.c from OpenBSD libc to use instead of
Roy Marples [Wed, 4 Oct 2017 15:07:49 +0000 (16:07 +0100)] 
Add compat/strlcpy.c from OpenBSD libc to use instead of
defining strlcpy to snprintf.
This makes dhcpcd smaller on platforms lacking strlcpy(3).

7 years agoComment out IPoIB broadcast address with a comment.
Roy Marples [Tue, 3 Oct 2017 23:11:14 +0000 (00:11 +0100)] 
Comment out IPoIB broadcast address with a comment.

7 years agoSpecify MD5_BLOCK_LENGTH as ULL to try and work around a compiler issue.
Roy Marples [Tue, 3 Oct 2017 22:51:17 +0000 (23:51 +0100)] 
Specify MD5_BLOCK_LENGTH as ULL to try and work around a compiler issue.

7 years agoCompare tv_sec to uint32_t correctly.
Roy Marples [Tue, 3 Oct 2017 22:40:50 +0000 (23:40 +0100)] 
Compare tv_sec to uint32_t correctly.

7 years agoCompile eloop with config.h by default and bring in compat modules.
Roy Marples [Tue, 3 Oct 2017 14:50:27 +0000 (15:50 +0100)] 
Compile eloop with config.h by default and bring in compat modules.
This allows us to build this test AND dhcpcd exactly the same,
which is important as they build eloop.o in the same place.

7 years agoDon't special case not deleteing the IPv6 default route.
Roy Marples [Tue, 3 Oct 2017 11:00:52 +0000 (12:00 +0100)] 
Don't special case not deleteing the IPv6 default route.
dhcpcd now manages this the same as any other route as dhcpcd is
either in charge of IPv6 or it's not.

7 years agoFix checking gateways in route comparison.
Roy Marples [Tue, 3 Oct 2017 10:44:39 +0000 (11:44 +0100)] 
Fix checking gateways in route comparison.

7 years agoEnsure that all RA's are actually dropped when dropping an interface.
Roy Marples [Tue, 3 Oct 2017 10:38:39 +0000 (11:38 +0100)] 
Ensure that all RA's are actually dropped when dropping an interface.

7 years agoipv6nd_freedrop is no longer public.
Roy Marples [Tue, 3 Oct 2017 10:17:21 +0000 (11:17 +0100)] 
ipv6nd_freedrop is no longer public.

7 years agoRelease dhcpcd-7.0.0-rc2 v7.0.0-rc2
Roy Marples [Tue, 19 Sep 2017 18:57:15 +0000 (19:57 +0100)] 
Release dhcpcd-7.0.0-rc2

7 years agodhcp: don't log wrong xid when there is no state
Roy Marples [Mon, 18 Sep 2017 09:07:24 +0000 (10:07 +0100)] 
dhcp: don't log wrong xid when there is no state

7 years agoAdd a FALLTHROUGH comment to appease coverity.
Roy Marples [Fri, 15 Sep 2017 19:32:12 +0000 (20:32 +0100)] 
Add a FALLTHROUGH comment to appease coverity.

7 years agoFix compile warning with ARP disabled.
Roy Marples [Fri, 15 Sep 2017 15:59:20 +0000 (16:59 +0100)] 
Fix compile warning with ARP disabled.