]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
6 years agoForgot these from merge
Roy Marples [Wed, 17 Apr 2019 08:17:07 +0000 (08:17 +0000)] 
Forgot these from merge

6 years agoMerge branch 'master' into rbtree
Roy Marples [Wed, 17 Apr 2019 08:15:30 +0000 (08:15 +0000)] 
Merge branch 'master' into rbtree

6 years agoroute: Don't install an IPv4LL default route if static one exists
Roy Marples [Wed, 17 Apr 2019 01:14:00 +0000 (01:14 +0000)] 
route: Don't install an IPv4LL default route if static one exists

6 years agoFix compile
Roy Marples [Tue, 16 Apr 2019 21:45:13 +0000 (22:45 +0100)] 
Fix compile

6 years agosun: Add rbtree support
Roy Marples [Tue, 16 Apr 2019 21:41:47 +0000 (21:41 +0000)] 
sun: Add rbtree support

6 years agoMerge branch 'master' into rbtree
Roy Marples [Tue, 16 Apr 2019 19:02:36 +0000 (20:02 +0100)] 
Merge branch 'master' into rbtree

6 years agoRevert "route: Disable RT_FREE_ROUTE_TABLE by default."
Roy Marples [Tue, 16 Apr 2019 18:48:46 +0000 (19:48 +0100)] 
Revert "route: Disable RT_FREE_ROUTE_TABLE by default."

This reverts commit 46059a78ef33341de80c0085570f71bf0ec15e8b.

6 years agosun: Don't read beyond the sockaddr length when making RTM
Roy Marples [Tue, 16 Apr 2019 18:13:25 +0000 (18:13 +0000)] 
sun: Don't read beyond the sockaddr length when making RTM

6 years agoif: Add a generic function to create an aliased address name
Roy Marples [Tue, 16 Apr 2019 18:12:16 +0000 (18:12 +0000)] 
if: Add a generic function to create an aliased address name

Reduces complexity between IPv4 and IPv6 and silences a warning
about potential string trunctaion if the LUN makes too big an
interface name.

6 years agoduid: If no UUID support, don't warn about unused variable.
Roy Marples [Tue, 16 Apr 2019 18:09:50 +0000 (18:09 +0000)] 
duid: If no UUID support, don't warn about unused variable.

6 years agoBSD: Simplify rtm usage
Roy Marples [Mon, 15 Apr 2019 11:39:07 +0000 (12:39 +0100)] 
BSD: Simplify rtm usage

6 years agosun: Find the interface in if_finishrt
Roy Marples [Mon, 15 Apr 2019 11:30:14 +0000 (14:30 +0300)] 
sun: Find the interface in if_finishrt

Makes the code a bit smaller.

6 years agosun: Update the interface index after plumbing
Roy Marples [Sun, 14 Apr 2019 11:01:21 +0000 (14:01 +0300)] 
sun: Update the interface index after plumbing

Otherwise it's likely zero ....

6 years agosun: Use lo0 if we can't find an interface for our route
Roy Marples [Sun, 14 Apr 2019 10:48:29 +0000 (13:48 +0300)] 
sun: Use lo0 if we can't find an interface for our route

We need to operate on the route, and dhcpcd needs an interface for
each route. This seems to work for now.

6 years agosun: Fix carrier detection, MTU detection and plumbing
Roy Marples [Sun, 14 Apr 2019 09:54:16 +0000 (12:54 +0300)] 
sun: Fix carrier detection, MTU detection and plumbing

dhcpcd no longer needs ifconfig to do the initial plumbing.

6 years agosun: Don't report error if interface does not exist during preinit
Roy Marples [Sun, 14 Apr 2019 09:53:25 +0000 (12:53 +0300)] 
sun: Don't report error if interface does not exist during preinit

For sun this is normal as we only create the initial interface
when adding an address.

6 years agosun: Fix routing issues
Roy Marples [Sat, 13 Apr 2019 15:40:39 +0000 (18:40 +0300)] 
sun: Fix routing issues

Solaris doesn't seem to have interface sets for some routes.
Call RTM_GET for these to discover the outbound interface.

Fix adding default routes.

6 years agosun: Compile once more
Joerg Sonnenberger [Fri, 12 Apr 2019 14:25:06 +0000 (15:25 +0100)] 
sun: Compile once more

6 years agooptions: improve string parsing some more
Roy Marples [Thu, 11 Apr 2019 16:18:29 +0000 (17:18 +0100)] 
options: improve string parsing some more

6 years agooptions: terminate strings that are not quoted
Roy Marples [Wed, 10 Apr 2019 21:58:36 +0000 (22:58 +0100)] 
options: terminate strings that are not quoted

6 years agoDHCP: abort BPF in test mode on receipt of message.
Roy Marples [Wed, 10 Apr 2019 21:33:01 +0000 (22:33 +0100)] 
DHCP: abort BPF in test mode on receipt of message.

6 years agooptions: add static routers and routes to environment
Roy Marples [Wed, 10 Apr 2019 21:19:05 +0000 (22:19 +0100)] 
options: add static routers and routes to environment

6 years agoDHCP: Dont really add static address in test mode
Roy Marples [Wed, 10 Apr 2019 20:46:07 +0000 (21:46 +0100)] 
DHCP: Dont really add static address in test mode

6 years agoscript: Assign a default script
Roy Marples [Wed, 10 Apr 2019 20:36:51 +0000 (21:36 +0100)] 
script: Assign a default script

Fixes a dumb mistake I made earlier.

6 years agoDHCP6: Don't spam syslog if we get the same error over and over
Roy Marples [Wed, 10 Apr 2019 13:10:42 +0000 (14:10 +0100)] 
DHCP6: Don't spam syslog if we get the same error over and over

It will still be spammy if we ask for more than one IA
and one of them has an error, but that's for another day.

6 years agoBSD: Fix detecting the interface for scoped routes
Roy Marples [Tue, 2 Apr 2019 12:35:51 +0000 (13:35 +0100)] 
BSD: Fix detecting the interface for scoped routes

dhcpcd will now detect the IPv6 default route being deleted
by a third party, for example.

6 years agoroute: log which pid deletes routes
Roy Marples [Tue, 2 Apr 2019 11:52:31 +0000 (12:52 +0100)] 
route: log which pid deletes routes

6 years agoroute: Disable RT_FREE_ROUTE_TABLE by default.
Roy Marples [Thu, 28 Mar 2019 13:05:50 +0000 (13:05 +0000)] 
route: Disable RT_FREE_ROUTE_TABLE by default.

The libc malloc implementation should be good enough for most.
The environment variables for dhcpcd-run-hooks probably do
more damage anyway.....

6 years agoscript: Parse argument as a string
Roy Marples [Wed, 27 Mar 2019 17:33:03 +0000 (17:33 +0000)] 
script: Parse argument as a string

This allows "" to equal /dev/null.

6 years agoDHCPv6: Allow nooptions dhcp6_unicast to work.
Roy Marples [Tue, 26 Mar 2019 00:40:57 +0000 (00:40 +0000)] 
DHCPv6: Allow nooptions dhcp6_unicast to work.

This allows dhcpcd to ignore any server set unicast option which
doesn't work.

6 years agoscript: Fix prior when we have listeners but no script
Roy Marples [Mon, 25 Mar 2019 12:20:45 +0000 (12:20 +0000)] 
script: Fix prior when we have listeners but no script

6 years agoscript: Fix not running when empty string or /dev/null
Roy Marples [Mon, 25 Mar 2019 12:17:07 +0000 (12:17 +0000)] 
script: Fix not running when empty string or /dev/null

6 years agooptions: add link_rcvbuf variable
Roy Marples [Thu, 14 Mar 2019 00:17:26 +0000 (00:17 +0000)] 
options: add link_rcvbuf variable

Sets SO_RCVBUF on the link socket to the designated size.
On a busy system this can be inflated to avoid buffer overflow.

However, dhcpcd *will* cope fine with overflow on NetBSD, OpenBSD
and Linux with a call to getifaddrs(3), but that might be too
heavy weight depending on the libc implementation as most
don't report address flags via this method.

6 years agoroute: prefer interfaces with a carrier
Roy Marples [Fri, 8 Mar 2019 13:08:16 +0000 (13:08 +0000)] 
route: prefer interfaces with a carrier

6 years agodhcpcd(8): Remove duplicate the
Masanobu SAITOH [Fri, 8 Mar 2019 12:04:48 +0000 (12:04 +0000)] 
dhcpcd(8): Remove duplicate the

6 years agodhcpcd(8): Remove duplicate the
Masanobu SAITOH [Fri, 8 Mar 2019 12:04:48 +0000 (12:04 +0000)] 
dhcpcd(8): Remove duplicate the

6 years agorbtree: sync with upstream to remove diffs
Roy Marples [Fri, 8 Mar 2019 09:13:57 +0000 (09:13 +0000)] 
rbtree: sync with upstream to remove diffs

6 years agoGuard __RCSID
Roy Marples [Thu, 7 Mar 2019 17:05:53 +0000 (17:05 +0000)] 
Guard __RCSID

6 years agoResync with upstream
Roy Marples [Thu, 7 Mar 2019 15:12:27 +0000 (15:12 +0000)] 
Resync with upstream

6 years agorbtree: reduce more with upstream
Roy Marples [Thu, 7 Mar 2019 12:21:20 +0000 (12:21 +0000)] 
rbtree: reduce more with upstream

6 years agorbtree reference fixed header
Roy Marples [Thu, 7 Mar 2019 12:10:05 +0000 (12:10 +0000)] 
rbtree reference fixed header

6 years agoUse __BIT
Roy Marples [Thu, 7 Mar 2019 12:00:37 +0000 (12:00 +0000)] 
Use __BIT

6 years agoroute: Enable the free route table again by default
Roy Marples [Wed, 6 Mar 2019 01:35:43 +0000 (01:35 +0000)] 
route: Enable the free route table again by default

6 years agoroute: Guard free route list stats
Roy Marples [Tue, 5 Mar 2019 20:59:42 +0000 (20:59 +0000)] 
route: Guard free route list stats

And add a maximum free list size stat

6 years agoIPv4LL: Fix routing on failure
Roy Marples [Tue, 5 Mar 2019 20:04:25 +0000 (20:04 +0000)] 
IPv4LL: Fix routing on failure

6 years agoroute: report usage data when using a free list
Roy Marples [Tue, 5 Mar 2019 09:17:33 +0000 (09:17 +0000)] 
route: report usage data when using a free list

6 years agoLinux: Fix compile
Roy Marples [Tue, 5 Mar 2019 00:36:48 +0000 (00:36 +0000)] 
Linux: Fix compile

6 years agoroute: Remove kroutes and make froutes optional
Roy Marples [Tue, 5 Mar 2019 00:28:36 +0000 (00:28 +0000)] 
route: Remove kroutes and make froutes optional

This is an attempt to reduce the memory dhcpcd uses.
By removing kroutes and froutes from global context.

kroutes are generated at the start of rt_build and freed at
the end.

6 years agorbtree: Fix crash with prior
Roy Marples [Mon, 4 Mar 2019 16:31:08 +0000 (16:31 +0000)] 
rbtree: Fix crash with prior

6 years agorbtree: silence more compile warnings.
Roy Marples [Mon, 4 Mar 2019 16:09:33 +0000 (16:09 +0000)] 
rbtree: silence more compile warnings.

6 years agoRe-arrange so to reduce diff to upsteam.
Roy Marples [Mon, 4 Mar 2019 16:07:05 +0000 (16:07 +0000)] 
Re-arrange so to reduce diff to upsteam.

6 years agoroute: Free route when failing to insert.
Roy Marples [Mon, 4 Mar 2019 14:34:59 +0000 (14:34 +0000)] 
route: Free route when failing to insert.

This means the collection already has the route, so we avoid
leaking memory.

6 years agoOpenBSD: Fix segfaults when deleting MPATH routes
Roy Marples [Mon, 4 Mar 2019 12:37:54 +0000 (12:37 +0000)] 
OpenBSD: Fix segfaults when deleting MPATH routes

6 years agoif: No more need for interface sorting
Roy Marples [Mon, 4 Mar 2019 11:48:04 +0000 (11:48 +0000)] 
if: No more need for interface sorting

6 years agoipv6nd: Don't sort interfaces when picking best address
Roy Marples [Mon, 4 Mar 2019 11:42:06 +0000 (11:42 +0000)] 
ipv6nd: Don't sort interfaces when picking best address

6 years agoroute: replace rt_find with rb_tree_find_node
Roy Marples [Mon, 4 Mar 2019 10:29:56 +0000 (10:29 +0000)] 
route: replace rt_find with rb_tree_find_node

6 years agoroute: sprinkle more assert
Roy Marples [Mon, 4 Mar 2019 01:17:51 +0000 (01:17 +0000)] 
route: sprinkle more assert

6 years agoOpenBSD: add some asserts
Roy Marples [Mon, 4 Mar 2019 01:11:58 +0000 (01:11 +0000)] 
OpenBSD: add some asserts

6 years agoSupport NetBSD-6, 7 and 8.
Roy Marples [Mon, 4 Mar 2019 00:22:23 +0000 (00:22 +0000)] 
Support NetBSD-6, 7 and 8.

6 years agoLinux: now fix compile again ....
Roy Marples [Mon, 4 Mar 2019 00:17:08 +0000 (00:17 +0000)] 
Linux: now fix compile again ....

6 years agoFix compile.... doh
Roy Marples [Mon, 4 Mar 2019 00:09:27 +0000 (00:09 +0000)] 
Fix compile.... doh

6 years agoOpenBSD: Fix crash with rbtree
Roy Marples [Mon, 4 Mar 2019 00:04:21 +0000 (00:04 +0000)] 
OpenBSD: Fix crash with rbtree

6 years agoFreeBSD: Fix compile of rbtree.h
Roy Marples [Sun, 3 Mar 2019 23:45:16 +0000 (23:45 +0000)] 
FreeBSD: Fix compile of rbtree.h

6 years agoFix whitespace
Roy Marples [Sun, 3 Mar 2019 23:44:51 +0000 (23:44 +0000)] 
Fix whitespace

6 years agoFix configure reporting of rb_tree_init
Roy Marples [Sun, 3 Mar 2019 23:39:20 +0000 (23:39 +0000)] 
Fix configure reporting of rb_tree_init

6 years agoroute: Fix memory leak on option or freed route
Roy Marples [Sun, 3 Mar 2019 23:21:33 +0000 (23:21 +0000)] 
route: Fix memory leak on option or freed route

In this case there is no interface to compare the metric for.
As such, compare on pointer so we can maintain a free list.

6 years agoAdd rbtree(3) from NetBSD if not present in libc.
Roy Marples [Sun, 3 Mar 2019 22:59:13 +0000 (22:59 +0000)] 
Add rbtree(3) from NetBSD if not present in libc.

6 years agoIPv4LL: Fix compile with rbtree
Roy Marples [Sun, 3 Mar 2019 22:43:00 +0000 (22:43 +0000)] 
IPv4LL: Fix compile with rbtree

6 years agoReplace route TAILQ macros with rbtree(3) from NetBSD.
Roy Marples [Sun, 3 Mar 2019 19:52:57 +0000 (19:52 +0000)] 
Replace route TAILQ macros with rbtree(3) from NetBSD.

This not only reduces the binary size of dhcpcd by ~5k
on NetBSD/amd64, but also increases the performance of
dhcpcd on systems with large routing tables.
There should be more room for improvement as we can now
call find functions on the tree instead of walking it
ourself if we can generate a suitable key.

This has been greatly inspired from a similar patch from
Donald Sharp <sharpd@cumulusnetworks.com> which used the more
generic RB_ macros found in the BSD tree(3).

Not ready for production use because routes are now sorted
upon insertion so we need to ensure rt_compare is 100% correct
as it's no longer in the order supplied by DHCP.

Lastly, portability gunk needs to be added.

6 years agoLinux: Fix compile without IPv4LL
Roy Marples [Thu, 21 Feb 2019 21:21:06 +0000 (21:21 +0000)] 
Linux: Fix compile without IPv4LL

6 years agoDHCP: Dont close ARP gratuitously
Roy Marples [Tue, 19 Feb 2019 23:15:43 +0000 (23:15 +0000)] 
DHCP: Dont close ARP gratuitously

Note we may wish to handle ACD for DHCP in the future.

6 years agoDHCP: free the ARP state of the address once announced
Roy Marples [Tue, 19 Feb 2019 23:02:17 +0000 (23:02 +0000)] 
DHCP: free the ARP state of the address once announced

This closes the ARP socket if nothing more todo.

6 years agoGuard with IP_PKTINFO as well.
Roy Marples [Tue, 19 Feb 2019 22:07:08 +0000 (22:07 +0000)] 
Guard with IP_PKTINFO as well.

6 years agoFold all CMSG parsing into a common function.
Roy Marples [Tue, 19 Feb 2019 21:46:06 +0000 (21:46 +0000)] 
Fold all CMSG parsing into a common function.

Makes dhcpcd smaller still.

6 years agoDHCP: Close the BPF socket once BOUND
Roy Marples [Tue, 19 Feb 2019 21:15:14 +0000 (21:15 +0000)] 
DHCP: Close the BPF socket once BOUND

Receive all messages via the global BOOTPC socket.
This makes the resource usage of dhcpcd a small bit lighter.

6 years agoBSD: Don't keep PF LINK socket open needlessly
Roy Marples [Tue, 19 Feb 2019 08:07:37 +0000 (08:07 +0000)] 
BSD: Don't keep PF LINK socket open needlessly

Saves a tiny bit of resource when dhcpcd is running.

6 years agoRemove the send/recv structures from dhcpcd context and allocate
Roy Marples [Sun, 17 Feb 2019 09:36:11 +0000 (09:36 +0000)] 
Remove the send/recv structures from dhcpcd context and allocate
on stack as and when required.
Rather than peaking and checking for truncation for receiving,
just allocate a large enough buffer upfront.

6 years agoFix whitespace introduced by my last patch
Roy Marples [Thu, 14 Feb 2019 21:26:47 +0000 (21:26 +0000)] 
Fix whitespace introduced by my last patch

6 years agobuild: exit the SUBDIR build loop if an error is detected
Kenny Napier [Thu, 14 Feb 2019 21:23:16 +0000 (21:23 +0000)] 
build: exit the SUBDIR build loop if an error is detected

6 years agoRemove gmake-4 note, gmake-3 works again.
Roy Marples [Mon, 11 Feb 2019 18:07:25 +0000 (18:07 +0000)] 
Remove gmake-4 note, gmake-3 works again.
Might require newer gmake-4, but heh ho.

6 years agomake: support gmake-3 again.
Roy Marples [Mon, 11 Feb 2019 18:02:15 +0000 (18:02 +0000)] 
make: support gmake-3 again.

6 years agolinux: Fix compile on old RedHat/CentOS systems
Roy Marples [Mon, 11 Feb 2019 17:45:04 +0000 (17:45 +0000)] 
linux: Fix compile on old RedHat/CentOS systems

6 years agoDHCP: Don't dictate the outbound interface when unicasting
Roy Marples [Sat, 9 Feb 2019 17:04:01 +0000 (17:04 +0000)] 
DHCP: Don't dictate the outbound interface when unicasting

Correct routing should have been setup already and this avoids
a buggy IP_PKTINFO implementation on NetBSD.

6 years agoBSD: don't log an error if the interface departs during SIOCGIFALIAS
Roy Marples [Fri, 8 Feb 2019 17:14:26 +0000 (17:14 +0000)] 
BSD: don't log an error if the interface departs during SIOCGIFALIAS

6 years agofix build with --disable-inet6
Chris Clayton [Fri, 8 Feb 2019 16:35:36 +0000 (16:35 +0000)] 
fix build with --disable-inet6

6 years agodhcp: if the netmask is all ones, it's a host route
Roy Marples [Fri, 8 Feb 2019 16:32:36 +0000 (16:32 +0000)] 
dhcp: if the netmask is all ones, it's a host route

6 years agoRelease dhcpcd-7.1.1 v7.1.1
Roy Marples [Thu, 7 Feb 2019 21:20:41 +0000 (21:20 +0000)] 
Release dhcpcd-7.1.1

6 years agoNot using c++11, go back to attribute
Roy Marples [Wed, 6 Feb 2019 20:07:53 +0000 (20:07 +0000)] 
Not using c++11, go back to attribute

6 years agoFix __fallthrough directive on non GNUC
Roy Marples [Wed, 6 Feb 2019 20:05:52 +0000 (20:05 +0000)] 
Fix __fallthrough directive on non GNUC

6 years agogcc: appease gcc-7's implicit fallthrough warning
Roy Marples [Wed, 6 Feb 2019 19:39:00 +0000 (19:39 +0000)] 
gcc: appease gcc-7's implicit fallthrough warning

We now need to define __fallthrough for one part because
cpp strips comments from preprocessed code and I don't want to
enforce needing -C in CFLAGS to avoid this.

6 years agoIP4: No need to set a variable to arp announce the address
Roy Marples [Wed, 6 Feb 2019 19:38:01 +0000 (19:38 +0000)] 
IP4: No need to set a variable to arp announce the address

6 years agoARP: make the announce address a constant
Roy Marples [Wed, 6 Feb 2019 19:36:36 +0000 (19:36 +0000)] 
ARP: make the announce address a constant

6 years agolink: introduce LINK_DOWN_IFFUP
Roy Marples [Wed, 30 Jan 2019 22:40:12 +0000 (22:40 +0000)] 
link: introduce LINK_DOWN_IFFUP

Set this state so when we preserve config on carrier loss.
This allows us to remove config if the interface is then brought down.

6 years agoFreeBSD: avoid kernel panics when adding on-link IPv6 routes
Roy Marples [Sat, 26 Jan 2019 02:13:29 +0000 (02:13 +0000)] 
FreeBSD: avoid kernel panics when adding on-link IPv6 routes

Also warn that OS does not support IPv6 address sharing.

6 years agossid is not NULL terminated anymore.
Roy Marples [Sat, 26 Jan 2019 00:16:09 +0000 (00:16 +0000)] 
ssid is not NULL terminated anymore.

6 years agoBSD: treat LINK_STATE_UNKNOWN as DOWN if media is invalid
Roy Marples [Sat, 26 Jan 2019 00:08:43 +0000 (00:08 +0000)] 
BSD: treat LINK_STATE_UNKNOWN as DOWN if media is invalid

On BSD, some interfaces might emit RTM_IFINFO before the link state
has initialised. Mainly wireless cards.
If the intial carrier call says media state change is valid,
we need to treat LINK_STATE_UNKNOWN as LINK_DOWN rather than
LINK_UP.

6 years agoIP6ND: Remove #defines for functions when INET6 is disabled
Roy Marples [Wed, 23 Jan 2019 13:50:34 +0000 (13:50 +0000)] 
IP6ND: Remove #defines for functions when INET6 is disabled

This allows us to optimise the code better and hopefully
become less error prone.

6 years agoBSD: Remove silly guards
Roy Marples [Wed, 23 Jan 2019 13:05:12 +0000 (13:05 +0000)] 
BSD: Remove silly guards

6 years agoDHCP6: Remove #defines for functions when DHCP6 is disabled
Roy Marples [Wed, 23 Jan 2019 13:01:19 +0000 (13:01 +0000)] 
DHCP6: Remove #defines for functions when DHCP6 is disabled

This allows us to optimise the code better and hopefully
become less error prone.

6 years agoIP4: Remove #defines for functions when INET is disabled
Roy Marples [Wed, 23 Jan 2019 11:43:11 +0000 (11:43 +0000)] 
IP4: Remove #defines for functions when INET is disabled

This allows us to optimise the code better and hopefully
become less error prone.