19 months agoRelease dhcpcd-9.4.0 dhcpcd-9.4.0
Roy Marples [Mon, 28 Dec 2020 12:59:20 +0000 (12:59 +0000)]
Release dhcpcd-9.4.0

19 months agoscript: ignore inactive interfaces for ordering
Roy Marples [Mon, 28 Dec 2020 01:59:57 +0000 (01:59 +0000)]
script: ignore inactive interfaces for ordering

19 months agoDHCP: Split hardware address randomisation out of anonymous option
Roy Marples [Mon, 28 Dec 2020 00:02:26 +0000 (00:02 +0000)]
DHCP: Split hardware address randomisation out of anonymous option

A 3rd party might want to control the randomisation.

19 months agoDHCP: For anonymous, just use a generic clientid
Roy Marples [Sun, 27 Dec 2020 23:52:44 +0000 (23:52 +0000)]
DHCP: For anonymous, just use a generic clientid

19 months ago20-resolv.conf: Don't call resolvconf -c if we didn't call -C
Roy Marples [Sun, 27 Dec 2020 22:31:02 +0000 (22:31 +0000)]
20-resolv.conf: Don't call resolvconf -c if we didn't call -C

This solves the warnings on all OS other than Linux who don't have
a supporting resolvconf for deprecating DNS because they never
emit the NOCARRIER_ROAMING reason.

19 months agoCheck for NetBSD in prior, as we did before
Roy Marples [Sun, 27 Dec 2020 22:04:45 +0000 (22:04 +0000)]
Check for NetBSD in prior, as we did before

19 months agodhcpcd: Don't roam when anonymous is set
Roy Marples [Sun, 27 Dec 2020 21:59:32 +0000 (21:59 +0000)]
dhcpcd: Don't roam when anonymous is set

We can now remove the NOCARRIER_PRESERVE_IP define.

19 months agoNetBSD: Map IP Persistance to roaming
Roy Marples [Sun, 27 Dec 2020 20:39:38 +0000 (20:39 +0000)]
NetBSD: Map IP Persistance to roaming

We can use IN_IFF_TENTATIVE for this.

19 months agoAdjust prior to build routes and run script after aborting protocols for roaming
Roy Marples [Sun, 27 Dec 2020 20:39:31 +0000 (20:39 +0000)]
Adjust prior to build routes and run script after aborting protocols for roaming

19 months agohooks: add NOCARRIER_ROAMING reason
Roy Marples [Sun, 27 Dec 2020 19:53:31 +0000 (19:53 +0000)]
hooks: add NOCARRIER_ROAMING reason

This is given when the OS supports the concept of wireless roaming
or the IP setup can be persisted when the carrier drops.

When this happens, routes are moved to a higher metric (if supported)
to support non preferred but non roaming routes.
The `interface_order` hook variable will now order the interfaces
according to priority and move roaming interfaces to the back of the
If resolvconf is present then it is called with the -C option
to deprecate DNS and if carrier comes back it is called again with the
-c option to activate it once more.

As part of this change, default route metrics have been changed to
support a larger number of interfaces.
base metric 1000 (was 200)
wireless offset 2000 (was 100)
IPv4LL offset 1000000 (was 10000)
roaming offset 2000000

19 months agosrc/dhcpcd.c: fix build without fork or signals (#20)
Fabrice Fontaine [Sat, 26 Dec 2020 19:45:08 +0000 (20:45 +0100)]
src/dhcpcd.c: fix build without fork or signals (#20)

Since version 9.3.3 and commit a5348dd02c86fa940cd93f203d0aa974cae0563c,
build without fork or signals fails on:

dhcpcd.c: In function ‘main’:
dhcpcd.c:2261:3: error: label ‘start_master’ used but not defined
   goto start_master;

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
19 months agoprivsep: log sandbox when not daemonising
Roy Marples [Sat, 26 Dec 2020 15:58:46 +0000 (15:58 +0000)]
privsep: log sandbox when not daemonising

19 months agolinux: ARM64 stock kernel does not emit hardware in cpuinfo
Roy Marples [Sat, 26 Dec 2020 15:57:31 +0000 (15:57 +0000)]
linux: ARM64 stock kernel does not emit hardware in cpuinfo

They have no plans to add it either, so just hardcode AArch64.

20 months agoprivsep: Fix Linux i386 for SECCOMP as it just uses socketcall
Roy Marples [Sat, 12 Dec 2020 22:12:54 +0000 (22:12 +0000)]
privsep: Fix Linux i386 for SECCOMP as it just uses socketcall

Rather than accept(2), recv(2), etc..... which is horrible!

Thanks to Steve Hirsch <stevehirsch49@msn.com> for testing.

20 months agoDHCP6: Fix a LGTM issue
Roy Marples [Sat, 12 Dec 2020 17:41:37 +0000 (17:41 +0000)]
DHCP6: Fix a LGTM issue

20 months agoprivsep: Allow getsockopt for SO_RCVBUF on Linux
Roy Marples [Sat, 12 Dec 2020 17:35:45 +0000 (17:35 +0000)]
privsep: Allow getsockopt for SO_RCVBUF on Linux

For when the link socket overflows

20 months agolink: Report errors obtaining recv buffer size on link overflow
Roy Marples [Sat, 12 Dec 2020 17:34:31 +0000 (17:34 +0000)]
link: Report errors obtaining recv buffer size on link overflow

20 months agolink: Only report hardware address changes for active interfaces
Roy Marples [Sat, 12 Dec 2020 17:33:26 +0000 (17:33 +0000)]
link: Only report hardware address changes for active interfaces

20 months agoLinux: Support wireless IP roaming
Roy Marples [Sat, 12 Dec 2020 13:12:26 +0000 (13:12 +0000)]
Linux: Support wireless IP roaming

This is achieved by checking that the interface is wireless,
IFF_UP and IFF_LOWER_UP are present, but IFF_RUNNING is missing.

This gives exactly the same support as modern NetBSD when carrier
loss is detected, but without the address verifications when the
carrier comes back as that needs to be handled in the kernel.

While IP setup is maintained, other configuration data is discarded.
Note that this should be improved in the future.

Thanks to Boris Krasnovskiy <borkra@gmail.com> for helping with this.

20 months agoprivsep: Don't log a BPF error that network is down
Roy Marples [Wed, 9 Dec 2020 11:15:30 +0000 (11:15 +0000)]
privsep: Don't log a BPF error that network is down

The master process will catch this clean remove the BPF process.

20 months agoLinux: Fix privsep build by including sys/termios.h for all platforms
Mikhail Efremov [Tue, 8 Dec 2020 16:15:28 +0000 (16:15 +0000)]
Linux: Fix privsep build by including sys/termios.h for all platforms

20 months agoRelease dhcpcd-9.3.4 dhcpcd-9.3.4
Roy Marples [Sat, 28 Nov 2020 14:12:59 +0000 (14:12 +0000)]
Release dhcpcd-9.3.4

20 months agoDHCP6: Abort in test mode when an error is returned by server.
Roy Marples [Wed, 25 Nov 2020 15:14:11 +0000 (15:14 +0000)]
DHCP6: Abort in test mode when an error is returned by server.

20 months agoDon't stop control in test
Roy Marples [Wed, 25 Nov 2020 14:55:25 +0000 (14:55 +0000)]
Don't stop control in test

20 months agooptions: Allow duid to take a value
Roy Marples [Wed, 25 Nov 2020 14:19:55 +0000 (14:19 +0000)]
options: Allow duid to take a value

If a value is given, it overrides /var/db/dhcpcd/duid.

20 months agooptions: allow --ia_na=1 and --ia_pd=2 on the command line
Roy Marples [Wed, 25 Nov 2020 14:05:18 +0000 (14:05 +0000)]
options: allow --ia_na=1 and --ia_pd=2 on the command line

This only works for non master mode.

20 months agoDHCP: If error adding the address in oneshot, exit with failure
Roy Marples [Tue, 24 Nov 2020 10:30:08 +0000 (10:30 +0000)]
DHCP: If error adding the address in oneshot, exit with failure

Otherwise we loop.
It's unlikely oneshot would be used with IPv6 due to addresses
having lifetimes.

20 months agoDHCP: Only listen to the address if we successfully added it
Roy Marples [Mon, 23 Nov 2020 13:22:20 +0000 (13:22 +0000)]
DHCP: Only listen to the address if we successfully added it

Fixes an issue on Linux where the headers advertise something
newer than what the kernel actually provides.

20 months agoImprove readability.
Roy Marples [Sat, 21 Nov 2020 12:01:21 +0000 (12:01 +0000)]
Improve readability.

20 months agoDHCP6: Delegated activations work once more
Roy Marples [Sat, 21 Nov 2020 11:59:07 +0000 (11:59 +0000)]
DHCP6: Delegated activations work once more

This was broken with the --noconfigure option in dhcpcd-9.3.3

20 months agoDHCP6: Fix segfault introduced in dhcpcd-9.3.3
Roy Marples [Sat, 21 Nov 2020 08:46:30 +0000 (08:46 +0000)]
DHCP6: Fix segfault introduced in dhcpcd-9.3.3

lo0 won't have a configuration for example.

20 months agodhcpcd.conf(8): add all -> at all
Lars Wendler [Fri, 20 Nov 2020 19:49:46 +0000 (19:49 +0000)]
dhcpcd.conf(8): add all -> at all

20 months agoRelease dhcpcd-9.3.3 dhcpcd-9.3.3
Roy Marples [Fri, 20 Nov 2020 13:06:16 +0000 (13:06 +0000)]
Release dhcpcd-9.3.3

20 months agoprivsep: adjust comment for prior
Matthew Clarkson [Thu, 19 Nov 2020 19:15:12 +0000 (19:15 +0000)]
privsep: adjust comment for prior

Note that this is a requirement for printf over serial terminals.

20 months agoprivsep: Allow ioctl TCGETS
Matthew Clarkson [Thu, 19 Nov 2020 15:37:33 +0000 (15:37 +0000)]
privsep: Allow ioctl TCGETS

printf on some platforms seems to require it.
Without this, script_dump() may fault.

21 months agoprivsep: Allow fcntl64 and fstat64 to fix ARM32 talking to the controller
Matthew Clarkson [Fri, 13 Nov 2020 08:22:42 +0000 (08:22 +0000)]
privsep: Allow fcntl64 and fstat64 to fix ARM32 talking to the controller

We already allow fcntl and fstat so this is not a problem.

21 months agoroute: Correct prior logic
Roy Marples [Fri, 13 Nov 2020 08:21:12 +0000 (08:21 +0000)]
route: Correct prior logic

21 months agodhcpcd: Don't create launcher process if keeping in foreground
Roy Marples [Wed, 11 Nov 2020 17:44:55 +0000 (17:44 +0000)]
dhcpcd: Don't create launcher process if keeping in foreground

There is little point.

21 months agocontrol: create an unpriv socket for non master mode
Roy Marples [Wed, 11 Nov 2020 17:41:16 +0000 (17:41 +0000)]
control: create an unpriv socket for non master mode

This allows `dhcpcd -U4 eth0` to work once more.

21 months agoWhen adding a route, the interface will always have options.
Roy Marples [Wed, 4 Nov 2020 14:25:00 +0000 (14:25 +0000)]
When adding a route, the interface will always have options.

21 months agoAdd --noconfigure option
Roy Marples [Wed, 4 Nov 2020 14:18:48 +0000 (14:18 +0000)]
Add --noconfigure option

With this set dhcpcd will not configure anything on the host.
The expectation is that a 3rd party script will instead.

21 months agofix if_getnetworknamespace matching bug. (#19)
Ted Feng [Tue, 3 Nov 2020 22:31:40 +0000 (11:31 +1300)]
fix if_getnetworknamespace matching bug. (#19)

Co-authored-by: Ted Feng <Ted.Feng@Aviatnet.com>
21 months agoLinux: Fix detecting existing IPv4 addresses
Roy Marples [Tue, 3 Nov 2020 11:37:05 +0000 (11:37 +0000)]
Linux: Fix detecting existing IPv4 addresses

This is important for better NetworkManager support.

21 months agooptions: Don't log unknown option errors when printing the pidfile
Roy Marples [Mon, 2 Nov 2020 17:03:31 +0000 (17:03 +0000)]
options: Don't log unknown option errors when printing the pidfile

21 months agoRelease dhcpcd-9.3.2 dhcpcd-9.3.2
Roy Marples [Sun, 1 Nov 2020 14:07:38 +0000 (14:07 +0000)]
Release dhcpcd-9.3.2

21 months agoFix compile without various defines
Roy Marples [Fri, 30 Oct 2020 22:18:57 +0000 (22:18 +0000)]
Fix compile without various defines

21 months agoRemove debug from prior
Roy Marples [Fri, 30 Oct 2020 16:13:49 +0000 (16:13 +0000)]
Remove debug from prior

21 months agoprivsep: don't leave a BOOTP process hanging around on SIGUSR1
Roy Marples [Fri, 30 Oct 2020 16:11:44 +0000 (16:11 +0000)]
privsep: don't leave a BOOTP process hanging around on SIGUSR1

When not in master mode.

21 months agolog: Allow logopen to be called without logclose
Roy Marples [Fri, 30 Oct 2020 15:16:02 +0000 (15:16 +0000)]
log: Allow logopen to be called without logclose

logclose is meant to free resources.
On Linux this means that _log_prog is also free'd and once in the
chroot we cannot work it out again.

As such allow logopen to close what it needs to so that reopening

21 months agoprivsep: Allow logfile reopening in a chroot
Roy Marples [Fri, 30 Oct 2020 14:19:16 +0000 (14:19 +0000)]
privsep: Allow logfile reopening in a chroot

Now that only the privileged actioneer does the actual logging
we can safely reopen the file we are logging to.
This also closes and re-opens the syslog connection.

21 months agoprivsep: Send all log messages to the privileged actioneer
Roy Marples [Fri, 30 Oct 2020 03:43:51 +0000 (03:43 +0000)]
privsep: Send all log messages to the privileged actioneer

If dhcpcd starts and no syslogd implementation is running then
various syscall filters could be triggered when dhcpcd wants to syslog
and it's already in a chroot.

Not all libc openlog implementations support LOG_NDELAY and
openlog does not return an error code and can also mask errno back to 0.
So we have no way of knowing if we have a syslog connection or not.
This means we cannot cache the connection at startup because syslog itself
will try and open if no connection.

As such, all logging is now directed to the dhcpcd privileged actioneer
process which will handle all the syslog and log file writing actions.

The only downside of this approach (other than an extra fd per process)
is that we no longer know which PID raised the message. While we could
put the correct PID in the logfile as we control the API, we cannot
put it into syslog as we cannot control that API.
As all privsep errors should log which function they came from this
will hopefully not be an issue as on the happy path only the master
process will log stuff.

21 months agoDHCP: Implement IPv6-Only Preferred option, RFC 8925.
Roy Marples [Mon, 26 Oct 2020 11:19:54 +0000 (11:19 +0000)]
DHCP: Implement IPv6-Only Preferred option, RFC 8925.

Enable it like so in dhcpcd.conf:
option ipv6_only_preferred

21 months agoprivsep: Close BPF socket on ENXIO.
Roy Marples [Sun, 25 Oct 2020 15:30:13 +0000 (15:30 +0000)]
privsep: Close BPF socket on ENXIO.

This stops log spam if RTM_IFANNOUNCE is delayed for the departing

21 months agoBump date for prior
Roy Marples [Sun, 25 Oct 2020 08:52:38 +0000 (08:52 +0000)]
Bump date for prior

21 months agodhcpcd.conf(5): mention fallback for the reboot option
Roy Marples [Sun, 25 Oct 2020 08:50:44 +0000 (08:50 +0000)]
dhcpcd.conf(5): mention fallback for the reboot option

Syncs with dhcpcd(8)

22 months agoBSD: LINK_UNKNOWN is traditionally treated as LINK_UP
Roy Marples [Fri, 16 Oct 2020 13:36:34 +0000 (14:36 +0100)]
BSD: LINK_UNKNOWN is traditionally treated as LINK_UP

22 months agoprivsep: Allow more syscalls through SECCOMP and add a debugger
Roy Marples [Thu, 15 Oct 2020 16:59:33 +0000 (17:59 +0100)]
privsep: Allow more syscalls through SECCOMP and add a debugger

This fixes PowerPC at least.

The debugger should not be enabled by default as the attacker
could keep the processes running.
However, it is need to work out which syscall is failing due to the
way SECCOMP works.

22 months agoMake a note about solaris privileges
Roy Marples [Thu, 15 Oct 2020 12:29:26 +0000 (13:29 +0100)]
Make a note about solaris privileges

22 months agoduid: plug a potential memory leak dhcpcd-9.3.1
Roy Marples [Mon, 12 Oct 2020 13:56:34 +0000 (14:56 +0100)]
duid: plug a potential memory leak

22 months agoRelease dhcpcd-9.3.1
Roy Marples [Mon, 12 Oct 2020 13:41:06 +0000 (14:41 +0100)]
Release dhcpcd-9.3.1

22 months agoprivsep: Minor correction to prior logic
Roy Marples [Sun, 11 Oct 2020 07:47:31 +0000 (08:47 +0100)]
privsep: Minor correction to prior logic

22 months agoprivsep: We need to ensure stderr is valid before testing if tty
Roy Marples [Sat, 10 Oct 2020 16:54:03 +0000 (17:54 +0100)]
privsep: We need to ensure stderr is valid before testing if tty

22 months agoprivsep: Fix stderr redirection again
Roy Marples [Sat, 10 Oct 2020 14:07:38 +0000 (15:07 +0100)]
privsep: Fix stderr redirection again

22 months agoprivsep: allow gettimeofday for SECCOMP
Roy Marples [Sat, 10 Oct 2020 14:06:59 +0000 (15:06 +0100)]
privsep: allow gettimeofday for SECCOMP

We need it for logging.

22 months agoBSD doesn't use envp
Roy Marples [Sat, 10 Oct 2020 13:46:25 +0000 (14:46 +0100)]
BSD doesn't use envp

22 months agosetproctitle compat requires envp, not environ
Roy Marples [Sat, 10 Oct 2020 13:44:00 +0000 (14:44 +0100)]
setproctitle compat requires envp, not environ

The two could be different!
envp is NOT C or POSIX standard, but does appear to be a UNIX standard.

22 months agoJust give up with setproctitle on Illumos
Roy Marples [Sat, 10 Oct 2020 10:32:23 +0000 (13:32 +0300)]
Just give up with setproctitle on Illumos

Their ps tools go out of their way to only show how it was launched :/

22 months agoChange copyright on setproctitle.h
Roy Marples [Fri, 9 Oct 2020 19:38:48 +0000 (20:38 +0100)]
Change copyright on setproctitle.h

22 months agocompat: Use libbsd's setproctitle(3)
Roy Marples [Fri, 9 Oct 2020 19:21:52 +0000 (20:21 +0100)]
compat: Use libbsd's setproctitle(3)

Linux PRCTL variant, although more light weight, doesn't work on
some kernels.
This weighs in around 1k more, but always works.
It does play around with environ and args but unlike other
similar variants doesn't appear to stamp on what you actually
use in the program.

22 months agoprivsep: Always try and open syslog
Roy Marples [Fri, 9 Oct 2020 14:06:57 +0000 (15:06 +0100)]
privsep: Always try and open syslog

Even if we don't print as otherwise we can't in a chroot.

22 months agoprivsep: Ensure command is for BPF first and interface valid second
Roy Marples [Fri, 9 Oct 2020 13:45:57 +0000 (14:45 +0100)]
privsep: Ensure command is for BPF first and interface valid second

Otherwise we won't call inet_dispatch on a message meant for it.

22 months agoLinux: fix compile
Roy Marples [Wed, 7 Oct 2020 15:21:26 +0000 (16:21 +0100)]
Linux: fix compile

22 months agoprivsep: Improve rights on launcher fork and stderr fds
Roy Marples [Wed, 7 Oct 2020 14:31:35 +0000 (15:31 +0100)]
privsep: Improve rights on launcher fork and stderr fds

22 months agoprivsep: Only start network proxy if we need to
Roy Marples [Wed, 7 Oct 2020 14:28:33 +0000 (15:28 +0100)]
privsep: Only start network proxy if we need to

Do this before starting it rather than it shutting down.

22 months agoprivsep: Only log chrooting from the launcher process
Roy Marples [Wed, 7 Oct 2020 13:37:35 +0000 (14:37 +0100)]
privsep: Only log chrooting from the launcher process

And the sandbox tech as well.
Rework stop_interface so we can reuse an option for marking
a process as the launcher.

22 months agoif: always log about unsupported interface types in debug
Roy Marples [Wed, 7 Oct 2020 13:23:23 +0000 (14:23 +0100)]
if: always log about unsupported interface types in debug

22 months agodhcpcd: Simplify the link handling even more
Roy Marples [Wed, 7 Oct 2020 13:11:47 +0000 (14:11 +0100)]
dhcpcd: Simplify the link handling even more

Move the IS_LINK_UP macro to if_is_link_up function to reduce
binary size.
Rather than DHCPCD_LINK option controlling the carrier state,
use it in if_is_link_up to determine the outcome.

22 months agoWireless must be down if unknown.
Roy Marples [Tue, 6 Oct 2020 06:36:22 +0000 (07:36 +0100)]
Wireless must be down if unknown.

22 months agodhcpcd: Simplify carrier handling more by using IS_LINK_UP macro
Roy Marples [Tue, 6 Oct 2020 06:10:41 +0000 (07:10 +0100)]
dhcpcd: Simplify carrier handling more by using IS_LINK_UP macro

Removes the need for the LINK_DOWN_IFFUP state.
While here, remove the check for IFF_RUNNING when LINK_UNKNOWN
because that is OS specific.

22 months agoRelease dhcpcd-9.3.0 dhcpcd-9.3.0
Roy Marples [Mon, 5 Oct 2020 15:33:51 +0000 (16:33 +0100)]
Release dhcpcd-9.3.0

22 months agoprivsep: Remove capsicum specific hooks from BPF
Roy Marples [Sun, 4 Oct 2020 21:04:49 +0000 (22:04 +0100)]
privsep: Remove capsicum specific hooks from BPF

We no longer change the filter as it's locked if the OS supports.

22 months agoDon't log backticks.
Roy Marples [Sat, 3 Oct 2020 16:17:45 +0000 (17:17 +0100)]
Don't log backticks.

22 months agoprivsep: We need getsockopt as well as setsockopt on the link socket
Roy Marples [Sat, 3 Oct 2020 16:00:56 +0000 (17:00 +0100)]
privsep: We need getsockopt as well as setsockopt on the link socket

So we can report receive buffer size.
Important for route(4) overflow so we can try and set a bigger buffer.

22 months agoprivsep: allow CAP_SETSOCKOPT for route(4) fd.
Roy Marples [Fri, 2 Oct 2020 14:57:01 +0000 (15:57 +0100)]
privsep: allow CAP_SETSOCKOPT for route(4) fd.

If FreeBSD ever implements RO_MISSFILTER it will need special
rights to work over Capsium.

22 months agoprivsep: We now need to carry ifa_data for BSD
Roy Marples [Wed, 30 Sep 2020 16:25:32 +0000 (17:25 +0100)]
privsep: We now need to carry ifa_data for BSD

22 months agoBSD: Fix compile for non NetBSD
Roy Marples [Wed, 30 Sep 2020 15:14:39 +0000 (16:14 +0100)]
BSD: Fix compile for non NetBSD

22 months agoAdd a comment to prior incase I do something dumb like removing it
Roy Marples [Tue, 29 Sep 2020 07:00:24 +0000 (08:00 +0100)]
Add a comment to prior incase I do something dumb like removing it

in the future if I forgot why it was there.

22 months agoFix a typo in a comment
SAITOH Masanobu [Tue, 29 Sep 2020 06:30:27 +0000 (07:30 +0100)]
Fix a typo in a comment

22 months agoprivsep: fix crash when interface departs before bpf returns for it
Roy Marples [Mon, 28 Sep 2020 20:10:21 +0000 (21:10 +0100)]
privsep: fix crash when interface departs before bpf returns for it

22 months agoBSD: struct if_data->ifi_link_state is the single source of truth
Roy Marples [Mon, 28 Sep 2020 16:09:38 +0000 (17:09 +0100)]
BSD: struct if_data->ifi_link_state is the single source of truth

Vastly improve and simplify link detection on BSD.
dhcpcd either examines the whole system via getifaddrs(3) or
reacts to events via route(4).
In both cases we have struct if_data which has ifi_link_state.

Armed with this knowledge, we no longer need SIOCGIFDATA or

To solve the issue of newly attached interfaces having
LINK_STATE_UNKNOWN or some interfaces not even changing it,
we only change the local knowledge of interface flags when
reports them by getifaddrs(3) or route(4) when we change them.
For example, if we set IFF_UP and it succeeds we don't set this
internally until reported by the kernel as above.

This keeps flags and link state in sync with each other.
The hope is that the kernel can set the real link state before
it reports IFF_UP.

As such, we no longer require the poll option or need to enter a
tight loop for old interfaces.

22 months agoBSD: Ignore vether(4) devices by default.
Roy Marples [Sun, 27 Sep 2020 10:28:03 +0000 (11:28 +0100)]
BSD: Ignore vether(4) devices by default.

22 months agoClean up some warnings.
Sascha Wildner [Thu, 24 Sep 2020 19:53:56 +0000 (20:53 +0100)]
Clean up some warnings.

22 months agoFreeBSD: Anticipate SIOCGIFDATA not working in Capsicum
Roy Marples [Thu, 24 Sep 2020 02:49:30 +0000 (03:49 +0100)]
FreeBSD: Anticipate SIOCGIFDATA not working in Capsicum

22 months agoBSD: NetBSD is the odd man out with SIOCGIFDATA
Roy Marples [Thu, 24 Sep 2020 02:31:43 +0000 (03:31 +0100)]
BSD: NetBSD is the odd man out with SIOCGIFDATA

So setup the #defines like so.
On OpenBSD, pledge blocks it and there is no escape.
Luckily we already allow indirect ioctls via privsep so it works fine.

22 months agoif: Always warn about ignored interfaces.
Roy Marples [Wed, 23 Sep 2020 12:14:06 +0000 (13:14 +0100)]
if: Always warn about ignored interfaces.

22 months agoBSD: Of course DragonFly does SIOCGIFDATA differently..
Roy Marples [Wed, 23 Sep 2020 08:59:47 +0000 (09:59 +0100)]
BSD: Of course DragonFly does SIOCGIFDATA differently..

22 months agoAdd a warning about prior
Roy Marples [Wed, 23 Sep 2020 08:31:24 +0000 (09:31 +0100)]
Add a warning about prior

22 months agoRevert double variable define
Roy Marples [Wed, 23 Sep 2020 08:27:58 +0000 (09:27 +0100)]
Revert double variable define

22 months agoFreeBSD lacks SIOCGIFDATA it seems.
Roy Marples [Wed, 23 Sep 2020 08:26:16 +0000 (09:26 +0100)]
FreeBSD lacks SIOCGIFDATA it seems.

22 months agoBSD: Use SIOCGIFDATA if no media support and no ifa_data
Roy Marples [Tue, 22 Sep 2020 20:53:13 +0000 (21:53 +0100)]
BSD: Use SIOCGIFDATA if no media support and no ifa_data

Hopefully this nails link state once and for all on BSD.