]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
6 years agoBSD: Address some coverity issues
Roy Marples [Tue, 20 Aug 2019 08:34:19 +0000 (09:34 +0100)] 
BSD: Address some coverity issues

6 years agoscript: Rework assert to pass coverity.
Roy Marples [Fri, 16 Aug 2019 21:29:58 +0000 (22:29 +0100)] 
script: Rework assert to pass coverity.

It does work differently for non debug builds, but we don't care
because we reset the value anyway.
This way maybe more descriptive and does avoid a write.

6 years agoprint_option: restore dhcpcd-7 behaviour on invalid env option
Roy Marples [Fri, 16 Aug 2019 20:26:34 +0000 (21:26 +0100)] 
print_option: restore dhcpcd-7 behaviour on invalid env option

By not printing it.

6 years agoprint_option: try and terminate the env option, even on error.
Roy Marples [Fri, 16 Aug 2019 19:29:03 +0000 (20:29 +0100)] 
print_option: try and terminate the env option, even on error.

6 years agoDragonFlyBSD: No longer need to poll for IPv6 address flag changes
Roy Marples [Fri, 16 Aug 2019 18:21:28 +0000 (19:21 +0100)] 
DragonFlyBSD: No longer need to poll for IPv6 address flag changes

6 years agocontrol: Add CTL_FREE_LIST to control memory management.
Roy Marples [Sat, 10 Aug 2019 15:53:01 +0000 (16:53 +0100)] 
control: Add CTL_FREE_LIST to control memory management.

While here, don't try to avoid a malloc and copy of the data
because the script env now just has one buffer.

6 years agoFix control queue free argument.
Roy Marples [Sat, 10 Aug 2019 15:50:43 +0000 (16:50 +0100)] 
Fix control queue free argument.

6 years agoscript: Send the actual env len, not the buffer size to listeners.
Roy Marples [Sat, 10 Aug 2019 14:07:44 +0000 (15:07 +0100)] 
script: Send the actual env len, not the buffer size to listeners.

6 years agoscript: optimise variable
Roy Marples [Thu, 8 Aug 2019 20:59:55 +0000 (21:59 +0100)] 
script: optimise variable

6 years agoprint_option: terminate parameters with no value
Roy Marples [Thu, 8 Aug 2019 19:41:24 +0000 (20:41 +0100)] 
print_option: terminate parameters with no value

6 years agoscript: assert that the env strings are correctly terminated
Roy Marples [Thu, 8 Aug 2019 19:40:34 +0000 (20:40 +0100)] 
script: assert that the env strings are correctly terminated

6 years agoDHCP: If IP checksum is zero for the message, make it all ones.
Roy Marples [Thu, 8 Aug 2019 18:34:52 +0000 (19:34 +0100)] 
DHCP: If IP checksum is zero for the message, make it all ones.

This is required by RFC 768.

6 years agoDragonFly: Now supports sending NA messages from userland
Roy Marples [Thu, 8 Aug 2019 17:01:21 +0000 (18:01 +0100)] 
DragonFly: Now supports sending NA messages from userland

While here, fix NA to the right NetBSD version as well.

6 years agoFix prior.
Roy Marples [Wed, 7 Aug 2019 15:48:11 +0000 (16:48 +0100)] 
Fix prior.

6 years agoBSD: warn if kernel does not support route(4) filtering
Roy Marples [Wed, 7 Aug 2019 15:18:50 +0000 (16:18 +0100)] 
BSD: warn if kernel does not support route(4) filtering

6 years agoMerge branch 'master' of github.com:rsmarples/dhcpcd
Roy Marples [Tue, 6 Aug 2019 14:08:45 +0000 (15:08 +0100)] 
Merge branch 'master' of github.com:rsmarples/dhcpcd

6 years agoBSD: Use read instead of recvmsg
Roy Marples [Tue, 6 Aug 2019 14:04:41 +0000 (15:04 +0100)] 
BSD: Use read instead of recvmsg

Makes for a smaller binary.

6 years agoFreeBSD: warn that we cannot detect overflow on the route socket.
Roy Marples [Sat, 3 Aug 2019 07:48:57 +0000 (08:48 +0100)] 
FreeBSD: warn that we cannot detect overflow on the route socket.

6 years agoCast away an alignment error.
Roy Marples [Sat, 3 Aug 2019 07:48:29 +0000 (08:48 +0100)] 
Cast away an alignment error.

6 years agoLinux: Fix compile on 3.x
Roy Marples [Thu, 1 Aug 2019 12:54:57 +0000 (13:54 +0100)] 
Linux: Fix compile on 3.x

6 years agoDHCP: Rework checksuming so that the packet isn't touched.
Roy Marples [Wed, 31 Jul 2019 08:39:58 +0000 (09:39 +0100)] 
DHCP: Rework checksuming so that the packet isn't touched.

Other than setting udp->uh_sum to zero which we need to do to
calculate the checksum.
Also, the UDP checksum needs to include a pseudo IP header
without options and mostly blank. Instead of changing the packet,
just checksum a blank object we've filled in with the needed
data from the given IP object and use this to start the UDP
checksum calculation with.

While here, improve the checksum function so it more matches the
in_cksum function as noted in RFC 1071 4.1 using 16 byte words.

6 years agoroutes: Fix a NULL dereference error for global static routes v8.0.2
Roy Marples [Tue, 30 Jul 2019 10:04:24 +0000 (11:04 +0100)] 
routes: Fix a NULL dereference error for global static routes

No idea why you would want them, but just in case .....

6 years agoRelease dhcpcd-8.0.2
Roy Marples [Tue, 30 Jul 2019 09:29:51 +0000 (10:29 +0100)] 
Release dhcpcd-8.0.2

6 years agoIP: Work with IP headers with options.
Roy Marples [Tue, 30 Jul 2019 09:03:02 +0000 (10:03 +0100)] 
IP: Work with IP headers with options.

6 years agoBSD: Warn when kernel does not support sending ND6 advertisements
Roy Marples [Mon, 29 Jul 2019 13:46:25 +0000 (14:46 +0100)] 
BSD: Warn when kernel does not support sending ND6 advertisements

6 years agoND6: Disable advertising on OS other than NetBSD and Linux
Roy Marples [Mon, 29 Jul 2019 12:31:23 +0000 (13:31 +0100)] 
ND6: Disable advertising on OS other than NetBSD and Linux

It's only used for IP6 address sharing to prefer an interface,
but this only works on NetBSD. It might work on Linux too.
For all other OS advertising either fails to work (OpenBSD)
or erroneously logs duplicate address messages (all other BSD's).

6 years agoDragonFlyBSD: Fix compile
Roy Marples [Mon, 29 Jul 2019 11:51:13 +0000 (12:51 +0100)] 
DragonFlyBSD: Fix compile

6 years agoDHCP6: Change state to REQEST when any IA has NOBINDING status
Roy Marples [Mon, 29 Jul 2019 07:39:57 +0000 (08:39 +0100)] 
DHCP6: Change state to REQEST when any IA has NOBINDING status

Just to be more RFC conformant.

6 years agoFix a memory NULL deference when freeing static routes at exit.
Roy Marples [Sun, 28 Jul 2019 20:14:41 +0000 (21:14 +0100)] 
Fix a memory NULL deference when freeing static routes at exit.

This is less effort than changing the options API to work with
an interface object rather than an interface name.

6 years agoSolaris: Avoid re-adding IPv6 addresses to preserve the prefix route
Roy Marples [Sun, 28 Jul 2019 16:10:36 +0000 (16:10 +0000)] 
Solaris: Avoid re-adding IPv6 addresses to preserve the prefix route

Really, kernels should just stop doing this, it's pointless.

6 years agoRework prior again so we log the address in debug.
Roy Marples [Sun, 28 Jul 2019 14:56:41 +0000 (15:56 +0100)] 
Rework prior again so we log the address in debug.

6 years agoFix compile issue with prior.
Roy Marples [Sun, 28 Jul 2019 14:41:07 +0000 (15:41 +0100)] 
Fix compile issue with prior.

6 years agoIP: If no address lifetime support don't re-add the address
Roy Marples [Sun, 28 Jul 2019 14:37:05 +0000 (15:37 +0100)] 
IP: If no address lifetime support don't re-add the address

Unless we need to. If we do, there is a chance that the OS
will scrub the subnet route and re-add it. We want to avoid
this as it's likely in use.

6 years agoDHCP: Avoid duplicate read of packet
Roy Marples [Sun, 28 Jul 2019 13:27:24 +0000 (14:27 +0100)] 
DHCP: Avoid duplicate read of packet

If the BPF socket is open, discard any read from UDP as it
would be duplicated.

6 years agoconfigure: Fix test for open_memstream
Roy Marples [Sun, 28 Jul 2019 11:53:03 +0000 (12:53 +0100)] 
configure: Fix test for open_memstream

glibc-2.19 needs the return value testing....

6 years agoscript: ensure that tmp files are removed
Roy Marples [Sun, 28 Jul 2019 10:49:17 +0000 (11:49 +0100)] 
script: ensure that tmp files are removed

fopen creates a new stream which will use a new fd.
Why using fdopen, the new stream will use the same fd, so when
it's closed the tmp file will really unlink.

6 years agoUpdate comment
Roy Marples [Thu, 25 Jul 2019 17:58:18 +0000 (18:58 +0100)] 
Update comment

6 years agoMention 29-lookup-hostname rather than 10-wpa_supplicant
Roy Marples [Thu, 25 Jul 2019 17:49:13 +0000 (18:49 +0100)] 
Mention 29-lookup-hostname rather than 10-wpa_supplicant

As the wpa_supplicant hook script is obsolete when using
wpa_suppliant-2.6 or newer build with CONFIG_MATCH_IFACE.

6 years agoFix define for prior
Roy Marples [Thu, 25 Jul 2019 16:31:02 +0000 (17:31 +0100)] 
Fix define for prior

6 years agoRemove ND6 Advertisement from SMALL builds.
Roy Marples [Thu, 25 Jul 2019 16:20:41 +0000 (17:20 +0100)] 
Remove ND6 Advertisement from SMALL builds.

This is quite a saving and is only used for IP6 address sharing
which only works on NetBSD.

6 years agoNetBSD: Allow dhcpcd to be built without ARP support
Roy Marples [Thu, 25 Jul 2019 15:27:09 +0000 (16:27 +0100)] 
NetBSD: Allow dhcpcd to be built without ARP support

Because NetBSD has RFC 5227 support in the kernel, we only need
ARP to announce addresses and we only need to do that when
address sharing which shouldn't be a concern for small
installations where size is paramount.

6 years agoRelease dhcpcd-8.0.1 v8.0.1
Roy Marples [Thu, 25 Jul 2019 08:37:10 +0000 (09:37 +0100)] 
Release dhcpcd-8.0.1

6 years agoFix compile on NetBSD with ARP but not ARPING
Roy Marples [Wed, 24 Jul 2019 23:06:36 +0000 (00:06 +0100)] 
Fix compile on NetBSD with ARP but not ARPING

6 years agoFix compile on Linux without ARPING
Roy Marples [Wed, 24 Jul 2019 19:16:27 +0000 (20:16 +0100)] 
Fix compile on Linux without ARPING

6 years agoFree script buffers before exiting from a fork.
Roy Marples [Wed, 24 Jul 2019 18:53:10 +0000 (19:53 +0100)] 
Free script buffers before exiting from a fork.

6 years agoFix build without INET.
Roy Marples [Wed, 24 Jul 2019 18:42:00 +0000 (19:42 +0100)] 
Fix build without INET.

6 years agoFix build without ARP and/or ARPING
Roy Marples [Wed, 24 Jul 2019 18:33:10 +0000 (19:33 +0100)] 
Fix build without ARP and/or ARPING

6 years agoFix compile without IPv4LL
Roy Marples [Wed, 24 Jul 2019 18:21:45 +0000 (19:21 +0100)] 
Fix compile without IPv4LL

6 years agoIPv4LL: Work once more on NetBSD
Roy Marples [Wed, 24 Jul 2019 18:12:24 +0000 (19:12 +0100)] 
IPv4LL: Work once more on NetBSD

6 years agoFix SMALL build.
Roy Marples [Wed, 24 Jul 2019 15:06:51 +0000 (16:06 +0100)] 
Fix SMALL build.

6 years agoRelease dhcpcd-8.0.0 v8.0.0
Roy Marples [Wed, 24 Jul 2019 09:32:21 +0000 (10:32 +0100)] 
Release dhcpcd-8.0.0

6 years agoBSD: Work around another coverity false positive.
Roy Marples [Tue, 23 Jul 2019 16:20:35 +0000 (17:20 +0100)] 
BSD: Work around another coverity false positive.

6 years agoTypo
Roy Marples [Tue, 23 Jul 2019 15:23:27 +0000 (16:23 +0100)] 
Typo

6 years agoLinux: Mark another coverity false positive.
Roy Marples [Tue, 23 Jul 2019 15:11:18 +0000 (16:11 +0100)] 
Linux: Mark another coverity false positive.

6 years agoinet: Don't lose the host route needed for the router
Roy Marples [Tue, 23 Jul 2019 14:55:27 +0000 (15:55 +0100)] 
inet: Don't lose the host route needed for the router

6 years agoLinux: Work around a coverity issue
Roy Marples [Tue, 23 Jul 2019 14:27:48 +0000 (15:27 +0100)] 
Linux: Work around a coverity issue

sa points to a struct sockaddr inside a union where the
biggest member os sockaddr_in6.
We cast sa to char *, and then write to the address offset
directly which will go beyond a sockaddr if we're writing
a sockaddr_in6 - but this is fine, the union caters for it.

6 years agodhcpcd: Don't leak resources if we can't find a newly added interface
Roy Marples [Tue, 23 Jul 2019 13:56:49 +0000 (14:56 +0100)] 
dhcpcd: Don't leak resources if we can't find a newly added interface

6 years agodhcpcd: Don't leak memory when routing socket overflows
Roy Marples [Tue, 23 Jul 2019 13:53:01 +0000 (14:53 +0100)] 
dhcpcd: Don't leak memory when routing socket overflows

6 years agoChange prior to be non-fatal
Roy Marples [Tue, 23 Jul 2019 13:33:14 +0000 (14:33 +0100)] 
Change prior to be non-fatal

6 years agoLinux: Care about the return of setsockopt
Roy Marples [Tue, 23 Jul 2019 13:31:07 +0000 (14:31 +0100)] 
Linux: Care about the return of setsockopt

6 years agoDHCP: On ARP duplication, ensure the interface pointer is valid
Roy Marples [Tue, 23 Jul 2019 13:26:53 +0000 (14:26 +0100)] 
DHCP: On ARP duplication, ensure the interface pointer is valid

6 years agologerr: Care about fprintf return codes
Roy Marples [Tue, 23 Jul 2019 13:23:11 +0000 (14:23 +0100)] 
logerr: Care about fprintf return codes

Abort early if an error and return the overall result if we ever
need it.

6 years agoOpenBSD: Fix compile.
Roy Marples [Mon, 22 Jul 2019 15:19:27 +0000 (16:19 +0100)] 
OpenBSD: Fix compile.

6 years agoCast time_t to long long to satisfy printf.
Roy Marples [Mon, 22 Jul 2019 15:12:53 +0000 (16:12 +0100)] 
Cast time_t to long long to satisfy printf.

There is no standard primitive for it.

6 years agoRemove fcntl.h from here.
Roy Marples [Mon, 22 Jul 2019 14:59:37 +0000 (15:59 +0100)] 
Remove fcntl.h from here.

6 years agoUse rebindtime rather than renewaltime.
Roy Marples [Mon, 22 Jul 2019 13:41:05 +0000 (14:41 +0100)] 
Use rebindtime rather than renewaltime.

6 years agoDHCP: Always add the leased address
Roy Marples [Mon, 22 Jul 2019 12:34:10 +0000 (13:34 +0100)] 
DHCP: Always add the leased address

This is needed so that the lifetimes are refreshed.
While here, set the pltime to the renewal time.

6 years agoDHCP6: Assert auto sla is only 32-bits
Roy Marples [Mon, 22 Jul 2019 11:44:20 +0000 (12:44 +0100)] 
DHCP6: Assert auto sla is only 32-bits

It already is due to the use of fls32 above, but this assertion
makes clang static analyser happy.

6 years agooptions: Fix a static analysis error
Roy Marples [Mon, 22 Jul 2019 10:49:54 +0000 (11:49 +0100)] 
options: Fix a static analysis error

Can't actually happen because the string doesn't change and the
result is already checked above. However, it's pretty harmless to
add.

6 years agoFix prior
Roy Marples [Mon, 22 Jul 2019 10:38:10 +0000 (11:38 +0100)] 
Fix prior

6 years agooptions: Fix a potential memory leak
Roy Marples [Mon, 22 Jul 2019 10:20:27 +0000 (11:20 +0100)] 
options: Fix a potential memory leak

6 years agoFix compile issue with prior
Roy Marples [Mon, 22 Jul 2019 09:41:16 +0000 (10:41 +0100)] 
Fix compile issue with prior

6 years agoDHCP: Set address vltime and pltime to the length of the lease
Roy Marples [Mon, 22 Jul 2019 09:37:13 +0000 (10:37 +0100)] 
DHCP: Set address vltime and pltime to the length of the lease

The only OS which supports this is Linux, but more importantly it
will report the address as "dynamic" so that users can distinguish
it from statically added addresses.

6 years agoarp: Fix a crash when dhcpcd forks or an interface removed
Roy Marples [Tue, 16 Jul 2019 09:53:35 +0000 (10:53 +0100)] 
arp: Fix a crash when dhcpcd forks or an interface removed

Because we try and free the ARP state when dhcpcd forks or an
interface is removed, the loop to work out the next state to free
could return invalid memory.
So test we have an ARP state each time we iterate and free.

6 years agoroute: Compare AF_UNSPEC family when cleaning old routes
Roy Marples [Mon, 15 Jul 2019 16:13:43 +0000 (17:13 +0100)] 
route: Compare AF_UNSPEC family when cleaning old routes

6 years agohooks: Ensure header is empty before populating it.
Roy Marples [Fri, 12 Jul 2019 14:04:13 +0000 (15:04 +0100)] 
hooks: Ensure header is empty before populating it.

Thanks to Andreas

6 years ago10-wpa_supplicant: Correct stop diagnostic
Roy Marples [Tue, 9 Jul 2019 09:27:38 +0000 (10:27 +0100)] 
10-wpa_supplicant: Correct stop diagnostic

6 years agoMerge branch 'memstream'
Roy Marples [Thu, 4 Jul 2019 11:22:46 +0000 (12:22 +0100)] 
Merge branch 'memstream'

6 years agoAdd SPDX identifiers to all dhcpcd source files.
Yegor Yefremov [Thu, 4 Jul 2019 11:18:28 +0000 (12:18 +0100)] 
Add SPDX identifiers to all dhcpcd source files.
See https://spdx.org/ for details.

6 years agoMerge pull request #7 from sashko/master
Roy Marples [Tue, 25 Jun 2019 21:31:02 +0000 (22:31 +0100)] 
Merge pull request #7 from sashko/master

Fix typo in configure

6 years agoFix typo in configure
Oleksandr Kravchuk [Tue, 25 Jun 2019 20:28:35 +0000 (22:28 +0200)] 
Fix typo in configure

6 years agoDHCP6: Fix INFORM support
Roy Marples [Thu, 20 Jun 2019 15:44:21 +0000 (16:44 +0100)] 
DHCP6: Fix INFORM support

6 years agoscript: enable if_ssid again
Roy Marples [Wed, 19 Jun 2019 20:33:57 +0000 (21:33 +0100)] 
script: enable if_ssid again

6 years agoscript: Fix a memory error
Roy Marples [Wed, 19 Jun 2019 17:59:44 +0000 (18:59 +0100)] 
script: Fix a memory error

6 years agoND: Ensure that ltime is always set
Roy Marples [Wed, 19 Jun 2019 10:42:30 +0000 (10:42 +0000)] 
ND: Ensure that ltime is always set

6 years agoRemove now unused variables.
Roy Marples [Wed, 19 Jun 2019 10:41:06 +0000 (10:41 +0000)] 
Remove now unused variables.

6 years agoMerge branch 'master' into memstream
Roy Marples [Tue, 18 Jun 2019 16:37:04 +0000 (17:37 +0100)] 
Merge branch 'master' into memstream

6 years agoroute: Build list of static routes and routers correctly.
Roy Marples [Tue, 18 Jun 2019 16:35:23 +0000 (17:35 +0100)] 
route: Build list of static routes and routers correctly.

They they need to be inserted by rt_proto_add().

6 years agoscript: Write variables to a FILE
Roy Marples [Tue, 18 Jun 2019 10:33:53 +0000 (11:33 +0100)] 
script: Write variables to a FILE

Each variable is NULL terminated inside the file just like the
control stream which saves us from having to flatten it when
writing to the control stream.
Once written, create env pointers to the start of each string
just after the NULL terminator.

This also means that we just need to free two buffers when
dhcpcd exits (FILE buffer and env buffer) rather than each variable
individually.

If open_memstream(3) is not supported by libc then dhcpcd will
write to a file in /tmp instead.

6 years agoRA: expire whole RA on carrier up
Roy Marples [Fri, 14 Jun 2019 16:05:24 +0000 (17:05 +0100)] 
RA: expire whole RA on carrier up

If preserving IP, we need to expire the whole RA now that we care
about RDNSS and DNSSL lifetimes. Cheat by setting the aquired time
to something very low so it all expires.

6 years agoarp: announce address from most preferred interface
Roy Marples [Fri, 14 Jun 2019 16:03:55 +0000 (17:03 +0100)] 
arp: announce address from most preferred interface

Now we no longer sort interfaces, this is needed.

6 years agoMerge branch 'master' into rbtree
Roy Marples [Fri, 14 Jun 2019 14:22:43 +0000 (15:22 +0100)] 
Merge branch 'master' into rbtree

6 years agodhcpcd: don't expire RA on carrier down when when preserving IP
Roy Marples [Fri, 14 Jun 2019 13:49:01 +0000 (14:49 +0100)] 
dhcpcd: don't expire RA on carrier down when when preserving IP

6 years agoRA: expire RDNSS and DNSSL entries
Roy Marples [Fri, 14 Jun 2019 12:53:51 +0000 (13:53 +0100)] 
RA: expire RDNSS and DNSSL entries

This allows us to remember N fully expired RA's which works around
an obscure issue where a received RA has no lifetime or any
prefixes with lifetimes but does have an instruction to start DHCP6.

It was harmless but filled the log with spam and now there is no
log spam!

6 years agoMerge pull request #6 from DanielG/master
Roy Marples [Wed, 12 Jun 2019 18:44:16 +0000 (19:44 +0100)] 
Merge pull request #6 from DanielG/master

30-hostname: Fix typo: hsort -> hshort

6 years ago30-hostname: Fix typo: hsort -> hshort
Daniel Gröber [Wed, 12 Jun 2019 17:59:53 +0000 (19:59 +0200)] 
30-hostname: Fix typo: hsort -> hshort

6 years agoDHCP6: Keep running regardless of RA state
Roy Marples [Wed, 12 Jun 2019 12:43:27 +0000 (13:43 +0100)] 
DHCP6: Keep running regardless of RA state

We should keep DHCP6 running even if routers expire or link changes.
This is noted in RFC3315 18.1.2:
   If the client receives no responses before the message transmission
   process terminates, as described in section 14, the client SHOULD
   continue to use any IP addresses, using the last known
   lifetimes for those addresses, and SHOULD continue to use any other
   previously obtained configuration parameters.

6 years agoFix a gcc warning about signed overflow
Roy Marples [Fri, 7 Jun 2019 16:15:00 +0000 (17:15 +0100)] 
Fix a gcc warning about signed overflow

6 years agoroute: Compile on older BSD platforms
Roy Marples [Fri, 7 Jun 2019 15:59:41 +0000 (16:59 +0100)] 
route: Compile on older BSD platforms

6 years agoroute: Use order from message / config
Roy Marples [Fri, 7 Jun 2019 15:37:00 +0000 (16:37 +0100)] 
route: Use order from message / config

We can't just make the order up as that is prone to error.
So apply ordering as from the source.