]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
8 years agologerr: errx with logging
Roy Marples [Sun, 9 Apr 2017 07:44:16 +0000 (08:44 +0100)] 
logerr: errx with logging

Had a few complaints that the lastlog option was dropped.
It's now been restored, but with a new way of logging which is
the same as errx(3) as found on the BSD platforms but the output
also goes to the logging option of choice.

This allows the function to define the log priority for syslog
and there is no more need to specify %m.
In turn, this makes the code needed to write error messages
a lot shorter than before.

loginfo and logdebug have no optional x suffix because they are not
meant to record errors, unlike logerr and logwarn.

8 years agoFit in 80
Roy Marples [Sat, 8 Apr 2017 10:15:52 +0000 (11:15 +0100)] 
Fit in 80

8 years agoDon't open sockets if just sending a signal.
Roy Marples [Sat, 8 Apr 2017 10:08:44 +0000 (11:08 +0100)] 
Don't open sockets if just sending a signal.

8 years agoUse more reallocarray(3).
Roy Marples [Sat, 8 Apr 2017 10:05:54 +0000 (11:05 +0100)] 
Use more reallocarray(3).

8 years agoThe last stderr message felt lonely and committed suicide.
Roy Marples [Thu, 6 Apr 2017 14:50:02 +0000 (15:50 +0100)] 
The last stderr message felt lonely and committed suicide.

8 years agotransposition police!
Roy Marples [Thu, 6 Apr 2017 14:23:30 +0000 (15:23 +0100)] 
transposition police!

8 years agoMove ROUTER_FILTER assignments to variable declaration.
Roy Marples [Thu, 6 Apr 2017 12:16:15 +0000 (13:16 +0100)] 
Move ROUTER_FILTER assignments to variable declaration.

8 years agoif-bsd: support ROUTE_MSGFILTER socket option
Roy Marples [Wed, 5 Apr 2017 15:31:16 +0000 (16:31 +0100)] 
if-bsd: support ROUTE_MSGFILTER socket option

This reduces needless context switching just to discard route(4)
message types we're not interested in.

8 years agobpf: rewind the buffer on close
Roy Marples [Tue, 4 Apr 2017 10:49:24 +0000 (11:49 +0100)] 
bpf: rewind the buffer on close

BPF reads the whole BPF buffer in for processing.
We might close the BPF socket during processing and because the
buffer is shared between ARP and DHCP we need to re-wind it
when closing.

8 years agobpf: trim ARP payload in the BPF filter.
Roy Marples [Tue, 4 Apr 2017 08:55:33 +0000 (09:55 +0100)] 
bpf: trim ARP payload in the BPF filter.

ARP is a fixed sized packet, the size varies only on the type of
datalink. As such, instruct the BPF filter to trim the payload
to this size so any extra data such as FCS or even junk, is discarded.

8 years agobpf: don't check caplen == datalen
Roy Marples [Tue, 4 Apr 2017 08:45:27 +0000 (09:45 +0100)] 
bpf: don't check caplen == datalen

Some drivers return FCS at the end of the payload to BPF.
AFAIK, we have no way of knowing this in userland.
We can guess that FCS is there because the BPF filter trims the
DHCP payload to the Frame and IP lengths, but equally the data
could be anything.

As such removing the check that caplen == datalen makes sense.

8 years agoRevert prior and just use __func__. Do same for arp bpf.
Roy Marples [Mon, 3 Apr 2017 12:18:36 +0000 (13:18 +0100)] 
Revert prior and just use __func__. Do same for arp bpf.

8 years agoFix diagnostic to use correct function name.
Roy Marples [Mon, 3 Apr 2017 11:44:54 +0000 (12:44 +0100)] 
Fix diagnostic to use correct function name.

8 years agoMakefile should build and install the dev subdirectory if needed
Roy Marples [Mon, 3 Apr 2017 10:37:22 +0000 (11:37 +0100)] 
Makefile should build and install the dev subdirectory if needed

Summary: Fixes T113.

Test Plan:
Rebuild and install dhcpcd on a system which uses udev and had dhcpcd-6 installed previously.
Test dhcpcd runs without error.

Reviewers: fjaell

Reviewed By: fjaell

Maniphest Tasks: T113

Differential Revision: https://dev.marples.name/D105

8 years agoWork around gcc's limitation of SSP.
Roy Marples [Sun, 2 Apr 2017 23:10:51 +0000 (00:10 +0100)] 
Work around gcc's limitation of SSP.

8 years agoFix my silly mistake in a prior commit.
Roy Marples [Sun, 2 Apr 2017 20:03:53 +0000 (21:03 +0100)] 
Fix my silly mistake in a prior commit.
Thanks again to Peter Colberg.

8 years agoRecapitalise
Roy Marples [Sun, 2 Apr 2017 19:25:32 +0000 (20:25 +0100)] 
Recapitalise

8 years agoPrepare dhcpcd-7.0.0-beta2 v7.0.0-beta2
Roy Marples [Sun, 2 Apr 2017 18:42:07 +0000 (19:42 +0100)] 
Prepare dhcpcd-7.0.0-beta2

8 years agoStop being fancy .... just import everything.
Roy Marples [Sun, 2 Apr 2017 11:40:27 +0000 (12:40 +0100)] 
Stop being fancy .... just import everything.

8 years agoCorrect prior to size from hwaddr.
Roy Marples [Sun, 2 Apr 2017 11:39:35 +0000 (12:39 +0100)] 
Correct prior to size from hwaddr.

8 years agoDon't use a variable length buffer.
Roy Marples [Sun, 2 Apr 2017 10:09:16 +0000 (11:09 +0100)] 
Don't use a variable length buffer.

8 years agoIf auth is disabled, then disable FORCERENEW and RECONFIGURE_ACCEPT
Roy Marples [Sun, 2 Apr 2017 09:55:52 +0000 (10:55 +0100)] 
If auth is disabled, then disable FORCERENEW and RECONFIGURE_ACCEPT
entirely.

8 years agoFix ipv4ll_*route prototypes for builds without IPv4LL support.
Roy Marples [Sun, 2 Apr 2017 09:53:24 +0000 (10:53 +0100)] 
Fix ipv4ll_*route prototypes for builds without IPv4LL support.
Thanks to Joerg Sonnenberger.

8 years agoFix duid location, thanks to Peter Colberg.
Roy Marples [Sun, 2 Apr 2017 09:41:18 +0000 (10:41 +0100)] 
Fix duid location, thanks to Peter Colberg.

8 years agoWith the logger removed, we no longer need to test for printf %m support.
Roy Marples [Sun, 2 Apr 2017 08:53:17 +0000 (09:53 +0100)] 
With the logger removed, we no longer need to test for printf %m support.

8 years agoPrepare dhcpcd-7.0.0-beta1 v7.0.0-beta1
Roy Marples [Fri, 31 Mar 2017 19:23:09 +0000 (20:23 +0100)] 
Prepare dhcpcd-7.0.0-beta1

8 years agoGuard this with #ifdef INET so we can compile INET6 only.
Roy Marples [Fri, 31 Mar 2017 18:59:01 +0000 (19:59 +0100)] 
Guard this with #ifdef INET so we can compile INET6 only.

8 years agoThese functions are AF agnostic now.
Roy Marples [Fri, 31 Mar 2017 18:58:44 +0000 (19:58 +0100)] 
These functions are AF agnostic now.

8 years agoOnly disable kernel IPv6RA if we're sending IPv6RS.
Roy Marples [Fri, 31 Mar 2017 18:58:10 +0000 (19:58 +0100)] 
Only disable kernel IPv6RA if we're sending IPv6RS.

8 years agoCall posix_spawnattr_destroy after calling posix_spawn so that
Roy Marples [Fri, 31 Mar 2017 11:04:09 +0000 (12:04 +0100)] 
Call posix_spawnattr_destroy after calling posix_spawn so that
any memory allocated by posix_spawnattr_init is reclaimed.

Fixes a memory leak on FreeBSD and OpenBSD.

8 years agoInitialise the whole rt msg buffer to avoid valgrind errors.
Roy Marples [Fri, 31 Mar 2017 10:45:36 +0000 (11:45 +0100)] 
Initialise the whole rt msg buffer to avoid valgrind errors.

8 years agoFix make proginstall target.
Roy Marples [Fri, 31 Mar 2017 09:48:42 +0000 (10:48 +0100)] 
Fix make proginstall target.

8 years agoUpdate copyrights and headers to better credit the sources.
Roy Marples [Thu, 30 Mar 2017 20:53:45 +0000 (21:53 +0100)] 
Update copyrights and headers to better credit the sources.

8 years agoRemove this syslog entry .... it's just noise really as it's
Roy Marples [Thu, 30 Mar 2017 20:32:04 +0000 (21:32 +0100)] 
Remove this syslog entry .... it's just noise really as it's
only triggered by a command or signal with is already logged.

8 years agodhcpcd: fix crash forcing lease renewals on inactive interfaces.
Roy Marples [Thu, 30 Mar 2017 10:57:49 +0000 (11:57 +0100)] 
dhcpcd: fix crash forcing lease renewals on inactive interfaces.

Summary:
Forcing a lease renewal on an interface assumes all interfaces
will have options. This is no longer the case because dhcpcd now
lists every interface on the system and the active flag indicates
whether dhcpcd is controlling it or not, so we need to check this
before blindly renewing.

While here, add a syslog entry to note the forced renew and make
the code a little more readable by returning early rather than
enclosing in if blocks.

Fixes T111.

Test Plan:
Start dhcpcd and send it SIGUSR1.
Check it does not crash and review renewal notice in syslog.

Reviewers: eiN5too0

Reviewed By: eiN5too0

Maniphest Tasks: T111

Differential Revision: https://dev.marples.name/D104

8 years agoDHCPCD_DOMAIN isn't used anymore.
Roy Marples [Wed, 29 Mar 2017 14:51:07 +0000 (15:51 +0100)] 
DHCPCD_DOMAIN isn't used anymore.

8 years agoDefine htonll a macro as it's only used once.
Roy Marples [Tue, 28 Mar 2017 21:29:24 +0000 (22:29 +0100)] 
Define htonll a macro as it's only used once.

8 years agoRemove the gateway and nogateway options.
Roy Marples [Tue, 28 Mar 2017 21:08:59 +0000 (22:08 +0100)] 
Remove the gateway and nogateway options.
These can be controlled via the nooption directives instead.

8 years agoFix a potential crash where the DHCP state could be freed during processing.
Roy Marples [Mon, 27 Mar 2017 15:01:52 +0000 (16:01 +0100)] 
Fix a potential crash where the DHCP state could be freed during processing.

8 years agoFix a potential crash where the ARP state could be freed during processing.
Roy Marples [Mon, 27 Mar 2017 14:56:34 +0000 (15:56 +0100)] 
Fix a potential crash where the ARP state could be freed during processing.

8 years agoFix compile on OpenBSD.
Roy Marples [Fri, 24 Mar 2017 21:57:25 +0000 (21:57 +0000)] 
Fix compile on OpenBSD.

8 years agoFix compile on NetBSD.
Roy Marples [Fri, 24 Mar 2017 21:36:56 +0000 (21:36 +0000)] 
Fix compile on NetBSD.

8 years agoRemove ipv6ra_own and ipv6ra_own_default options.
Roy Marples [Fri, 24 Mar 2017 21:34:12 +0000 (21:34 +0000)] 
Remove ipv6ra_own and ipv6ra_own_default options.
This is controllable via noipv6 and noipv6rs options.

8 years agoAdd LICENSE.
Roy Marples [Fri, 24 Mar 2017 16:23:42 +0000 (16:23 +0000)] 
Add LICENSE.

8 years agoRemove documentation for --logfile.
Roy Marples [Fri, 24 Mar 2017 13:31:29 +0000 (13:31 +0000)] 
Remove documentation for --logfile.

8 years agoFix compile on Linux for dev support.
Roy Marples [Fri, 24 Mar 2017 13:29:50 +0000 (13:29 +0000)] 
Fix compile on Linux for dev support.

8 years agoAdd an .arcconfig file to hook arcanist with phabricator.
Roy Marples [Fri, 24 Mar 2017 12:47:16 +0000 (12:47 +0000)] 
Add an .arcconfig file to hook arcanist with phabricator.

8 years agoRemove custom logger and output all diagnostics via syslog(3).
Roy Marples [Fri, 24 Mar 2017 09:13:02 +0000 (09:13 +0000)] 
Remove custom logger and output all diagnostics via syslog(3).
Remove the --logfile option.
Support LOG_PTRIM and LOG_NLOG if available.

This reduces the binary size by almost 5k.
If you don't like how the diagnostics look on your screen, speak
with your libc vendor about implementing the above NetBSD extensions.

8 years agoFix warnings by including the strtoi header.
Roy Marples [Wed, 22 Mar 2017 15:34:06 +0000 (15:34 +0000)] 
Fix warnings by including the strtoi header.

8 years agoUse new strtoi changes.
Roy Marples [Wed, 22 Mar 2017 15:27:45 +0000 (15:27 +0000)] 
Use new strtoi changes.

8 years agoUpdate strtoi from latest NetBSD.
Roy Marples [Wed, 22 Mar 2017 15:24:22 +0000 (15:24 +0000)] 
Update strtoi from latest NetBSD.

8 years agoFix compile with bpf on OpenBSD.
Roy Marples [Wed, 22 Mar 2017 12:25:25 +0000 (12:25 +0000)] 
Fix compile with bpf on OpenBSD.

8 years agoFix compile with posix_spawn now being required.
Roy Marples [Wed, 22 Mar 2017 12:24:51 +0000 (12:24 +0000)] 
Fix compile with posix_spawn now being required.

8 years agoReport correct config test for arc4random_uniform
Roy Marples [Wed, 22 Mar 2017 11:27:59 +0000 (11:27 +0000)] 
Report correct config test for arc4random_uniform

8 years agoRemove configure opts for prior.
Roy Marples [Tue, 21 Mar 2017 20:58:35 +0000 (20:58 +0000)] 
Remove configure opts for prior.

8 years agoRemove posix_spawn(3) compat code.
Roy Marples [Tue, 21 Mar 2017 20:56:59 +0000 (20:56 +0000)] 
Remove posix_spawn(3) compat code.
All supported OS's have this in libc now.

8 years agoRemove getline(3) compat code.
Roy Marples [Tue, 21 Mar 2017 20:30:49 +0000 (20:30 +0000)] 
Remove getline(3) compat code.
All supported OS's have this in libc now.

8 years agoRemove the strlcpy compat code and just #define it to snprintf(3).
Roy Marples [Tue, 21 Mar 2017 20:16:47 +0000 (20:16 +0000)] 
Remove the strlcpy compat code and just #define it to snprintf(3).
This is the same and reduces code size.

8 years agoPlace correct license in compat headers.
Roy Marples [Tue, 21 Mar 2017 17:04:52 +0000 (17:04 +0000)] 
Place correct license in compat headers.

8 years agoRemove the cov-int dir when cleaning.
Roy Marples [Tue, 21 Mar 2017 16:18:40 +0000 (16:18 +0000)] 
Remove the cov-int dir when cleaning.

8 years agoFix man page paths.
Roy Marples [Tue, 21 Mar 2017 15:28:03 +0000 (15:28 +0000)] 
Fix man page paths.

8 years agoIgnore distribution and Coverity files.
Roy Marples [Tue, 21 Mar 2017 14:12:55 +0000 (14:12 +0000)] 
Ignore distribution and Coverity files.

8 years agoClean up some definitions.
Roy Marples [Tue, 21 Mar 2017 14:08:10 +0000 (14:08 +0000)] 
Clean up some definitions.

8 years agoUse fstat to work out the lease file size and read in one go rather than
Roy Marples [Mon, 20 Mar 2017 17:23:51 +0000 (17:23 +0000)] 
Use fstat to work out the lease file size and read in one go rather than
use a loop with a small growing buffer.

8 years agoTest address family to test the correct address flags.
Roy Marples [Mon, 20 Mar 2017 10:24:49 +0000 (10:24 +0000)] 
Test address family to test the correct address flags.

8 years agoConfigure correct hook dir.
Roy Marples [Mon, 20 Mar 2017 00:44:57 +0000 (00:44 +0000)] 
Configure correct hook dir.

8 years agoMove md5 and sha256 out to compat.
Roy Marples [Sun, 19 Mar 2017 20:21:18 +0000 (20:21 +0000)] 
Move md5 and sha256 out to compat.
Stop using .. to find config.h.

8 years agoMove compat out of src.
Roy Marples [Sun, 19 Mar 2017 15:00:45 +0000 (15:00 +0000)] 
Move compat out of src.

8 years agoIf the kernel isn't doing DAD for our newly added address, let it pass so we can...
Roy Marples [Fri, 17 Mar 2017 17:38:42 +0000 (17:38 +0000)] 
If the kernel isn't doing DAD for our newly added address, let it pass so we can mark it as DAD complete.

8 years agoFix building the distribution.
Roy Marples [Thu, 16 Mar 2017 10:01:12 +0000 (10:01 +0000)] 
Fix building the distribution.

8 years agoFix .gitignore
Roy Marples [Thu, 16 Mar 2017 09:55:41 +0000 (09:55 +0000)] 
Fix .gitignore

8 years agoMove dhcpcd-hooks dir to hooks
Roy Marples [Thu, 16 Mar 2017 09:54:30 +0000 (09:54 +0000)] 
Move dhcpcd-hooks dir to hooks

8 years agoMove dhcpcd-hooks outside of src
Roy Marples [Thu, 16 Mar 2017 09:50:11 +0000 (09:50 +0000)] 
Move dhcpcd-hooks outside of src

8 years agoDisable NTP in the default config.
Roy Marples [Wed, 15 Mar 2017 22:16:18 +0000 (22:16 +0000)] 
Disable NTP in the default config.

8 years agoDisable NTP in the default config.
Roy Marples [Wed, 15 Mar 2017 22:15:01 +0000 (22:15 +0000)] 
Disable NTP in the default config.

8 years agoMove the source files along with dev, crypt and comapt into src dir.
Roy Marples [Wed, 15 Mar 2017 22:06:12 +0000 (22:06 +0000)] 
Move the source files along with dev, crypt and comapt into src dir.
This makes the toplevel directory more manageable.

8 years agoMarkdown improvements.
Roy Marples [Tue, 14 Mar 2017 23:08:19 +0000 (23:08 +0000)] 
Markdown improvements.

8 years agoUse some markdown loving.
Roy Marples [Tue, 14 Mar 2017 23:02:40 +0000 (23:02 +0000)] 
Use some markdown loving.

8 years agoIf the ARP socket open when starting to probe, re-apply the filter so we capture...
Roy Marples [Fri, 10 Mar 2017 21:32:55 +0000 (21:32 +0000)] 
If the ARP socket open when starting to probe, re-apply the filter so we capture any changed addresses.

8 years agoIf we get DAD using IPv4LL on NetBSD, delete the address.
Roy Marples [Fri, 10 Mar 2017 16:11:24 +0000 (16:11 +0000)] 
If we get DAD using IPv4LL on NetBSD, delete the address.

8 years agoDon't crash when calling IPv4LL without an address in state
Roy Marples [Fri, 10 Mar 2017 14:44:26 +0000 (14:44 +0000)] 
Don't crash when calling IPv4LL without an address in state

8 years agoOnly conflict on ARP when sip matches OR sip is INADDR_ANY and
Roy Marples [Fri, 10 Mar 2017 11:05:02 +0000 (11:05 +0000)] 
Only conflict on ARP when sip matches OR sip is INADDR_ANY and
tip matches and we haven't added the address yet.

8 years agoOnly run ARP conflicts for the state if either sip or tip
Roy Marples [Fri, 10 Mar 2017 10:10:44 +0000 (10:10 +0000)] 
Only run ARP conflicts for the state if either sip or tip
match the ARP state address.

8 years agoWe're no longer interested in Unicast Poll.
Roy Marples [Fri, 10 Mar 2017 08:37:04 +0000 (08:37 +0000)] 
We're no longer interested in Unicast Poll.

8 years agobpf: only interested in direct conflict (sender) or ARP probes.
Roy Marples [Fri, 10 Mar 2017 08:36:26 +0000 (08:36 +0000)] 
bpf: only interested in direct conflict (sender) or ARP probes.

8 years agoFix compile warnings on NetBSD ERLITE.
Roy Marples [Wed, 8 Mar 2017 22:55:59 +0000 (22:55 +0000)] 
Fix compile warnings on NetBSD ERLITE.

8 years agoReading BPF works fine on SunOS as well.
Roy Marples [Wed, 8 Mar 2017 12:05:57 +0000 (12:05 +0000)] 
Reading BPF works fine on SunOS as well.
However, sending BPF appears to go nowhere even though the man page
indicates it should work.
So remove the if_*raw functions from if-sun.c and add a small bpf_send
function which uses DLPI.

8 years agoWorkaround a SunOS bug with reading more than 2^31 bytes of data.
Roy Marples [Wed, 8 Mar 2017 10:48:38 +0000 (10:48 +0000)] 
Workaround a SunOS bug with reading more than 2^31 bytes of data.

8 years agoInclude paths.h for _PATH_BPF
Roy Marples [Wed, 8 Mar 2017 09:00:51 +0000 (09:00 +0000)] 
Include paths.h for _PATH_BPF

8 years agoRename if_*raw functions to bpf_* so it's more descriptive and move
Roy Marples [Wed, 8 Mar 2017 08:41:07 +0000 (08:41 +0000)] 
Rename if_*raw functions to bpf_* so it's more descriptive and move
them from if-bsd.c to bpf.c so they can be re-used on SunOS in the future.
Linux is a special snowflake, so the BPF functions for opening, reading and
attaching remain in if-linux.c.
On Linux, open PF_PACKET as SOCK_RAW so we see the datalink frame header
just as BPF elsewhere so we don't have to mess around with offsets.

The BPF filters themselves have been improved to filter out more gunk such
as ensuring BOOTP messages are in an IPv4 packet and from the BOOTPS port.
ARP messages now check protocol family as well.

More improvements to T101.

8 years agoMore welcomes to 2017.
Roy Marples [Mon, 6 Mar 2017 10:18:10 +0000 (10:18 +0000)] 
More welcomes to 2017.

8 years agoBelated welcome to 2017.
Roy Marples [Mon, 6 Mar 2017 10:06:01 +0000 (10:06 +0000)] 
Belated welcome to 2017.

8 years agobpf: match ip_dst to to lease address when bound
Roy Marples [Sun, 5 Mar 2017 21:33:45 +0000 (21:33 +0000)] 
bpf: match ip_dst to to lease address when bound

Because we can't filter on xid as the only message we expect
is FORCERENEW.
Fixes T101.

8 years agobpf: ARP and BOOTP filter improvements
Roy Marples [Sun, 5 Mar 2017 21:05:24 +0000 (21:05 +0000)] 
bpf: ARP and BOOTP filter improvements

The ARP filter now checks hardware and protocol length matches
the interface, it's not from the interface itself and either the
source ip or target ip is one of our addresses of interest.

The BOOTP filter now checks for BOOTREPLY and matching xid.
If the interface hardware address fits inside chaddr then
that is checked as well.

8 years ago30-hostname: set to localhost when hostname is reqlinquished
Paul Walrath [Mon, 27 Feb 2017 22:41:46 +0000 (22:41 +0000)] 
30-hostname: set to localhost when hostname is reqlinquished

Summary:
If the DHCP controlled hostname is relinquished,
set it to a default value of localhost.
This allows a future lease to set it again.

Fixes T106.

Reviewers: pwalrath, test

Reviewed By: pwalrath

Maniphest Tasks: T106

Differential Revision: https://dev.marples.name/D101

8 years agoIf a new hostname is set, log it.
Roy Marples [Mon, 27 Feb 2017 22:06:11 +0000 (22:06 +0000)] 
If a new hostname is set, log it.

8 years agoRe-work the BPF filters so they are early return.
Roy Marples [Sun, 26 Feb 2017 20:33:33 +0000 (20:33 +0000)] 
Re-work the BPF filters so they are early return.
This will allow us to insert addresses of interest in the future.

8 years agoIgnore dhcpcd-hooks/50-ypbind
Roy Marples [Sun, 26 Feb 2017 10:29:30 +0000 (10:29 +0000)] 
Ignore dhcpcd-hooks/50-ypbind

8 years agoMark the message property of the DHCPv6 Status code as optional.
Roy Marples [Sun, 26 Feb 2017 10:25:41 +0000 (10:25 +0000)] 
Mark the message property of the DHCPv6 Status code as optional.
Fixes T104.

8 years agoFix a sign warning.
Roy Marples [Sun, 26 Feb 2017 00:23:31 +0000 (00:23 +0000)] 
Fix a sign warning.