Update to dhcpcd-9.4.0 with the following changes:

* DHCP: For anonymous, just use a generic ClientID
 * link: Split hardware address randomisation out of anonymous option
 * link: Only report hardware changes for active interfaces
 * link: Report errors obtaining recv buffer size on overflow
 * hooks: Add NOCARRIER_ROAMING reason
 * hooks: interface_order now reflects priorities again
This commit is contained in:
roy 2020-12-28 13:56:25 +00:00
parent 5395edda8e
commit f7c1f2f087
10 changed files with 42 additions and 24 deletions

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd May 24, 2020
.Dd December 27, 2020
.Dt DHCPCD-RUN-HOOKS 8
.Os
.Sh NAME
@ -92,6 +92,9 @@ This is generally just a notification and no action need be taken.
.It Dv NOCARRIER
dhcpcd lost the carrier.
The cable may have been unplugged or association to the wireless point lost.
.It Dv NOCARRIER_ROAMING
dhcpcd lost the carrier but the interface configuration is persisted.
The OS has to support wireless roaming or IP Persistance for this to happen.
.It Dv INFORM | Dv INFORM6
dhcpcd informed a DHCP server about its address and obtained other
configuration details.
@ -147,10 +150,6 @@ will clear the environment variables aside from
The following variables will then be set, along with any protocol supplied
ones.
.Bl -tag -width xnew_delegated_dhcp6_prefix
.It Ev $chroot
the directory where
.Nm dhcpcd
is chrooted.
.It Ev $interface
the name of the interface.
.It Ev $protocol
@ -193,12 +192,14 @@ if the
.Ev interface
is up, otherwise
.Dv false .
This is more than IFF_UP and may not be equal.
.It Ev $if_down
.Dv true
if the
.Ev interface
is down, otherwise
.Dv false .
This is more than IFF_UP and may not be equal.
.It Ev $af_waiting
Address family waiting for, as defined in
.Xr dhcpcd.conf 5 .

View File

@ -29,7 +29,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
#define VERSION "9.3.4"
#define VERSION "9.4.0"
#ifndef PRIVSEP_USER
# define PRIVSEP_USER "_" PACKAGE

View File

@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd November 25, 2020
.Dd December 27, 2020
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
@ -61,9 +61,7 @@ which is a space or comma separated list of patterns passed to
.Xr fnmatch 3 .
.It Ic anonymous
Enables Anonymity Profiles for DHCP, RFC 7844.
This implementation forces a hardware address randomisaton when
the interface link is down and that ClientID's are only LL.
Any DUID is ignored.
Any DUID is ignored and ClientID is set to LL only.
All non essential options are then masked at this point,
but they could be unmasked by explicitly requesting the option
.Sy after
@ -79,6 +77,10 @@ send something which could identify you.
.Nm dhcpcd
will not try and reboot an old lease, it will go straight into
DISCOVER/SOLICIT.
.It Ic randomise_hwaddr
Forces a hardware address randomisation when the interface is brought up
or when the carrier is lost.
This is generally used in tandem with the anonymous option.
.It Ic arping Ar address Op address
.Nm dhcpcd
will arping each address in order before attempting DHCP.

View File

@ -182,6 +182,7 @@
#define O_MSUSERCLASS O_BASE + 49
#define O_CONFIGURE O_BASE + 50
#define O_NOCONFIGURE O_BASE + 51
#define O_RANDOMISE_HWADDR O_BASE + 52
extern const struct option cf_options[];
@ -234,6 +235,7 @@ struct if_options {
uint32_t timeout;
uint32_t reboot;
unsigned long long options;
bool randomise_hwaddr;
struct in_addr req_addr;
struct in_addr req_mask;

View File

@ -697,12 +697,11 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
ifp->metric = (unsigned int)ifr.ifr_metric;
if_getssid(ifp);
#else
/* We reserve the 100 range for virtual interfaces, if and when
* we can work them out. */
ifp->metric = 200 + ifp->index;
/* Leave a low portion for user config */
ifp->metric = RTMETRIC_BASE + ifp->index;
if (if_getssid(ifp) != -1) {
ifp->wireless = true;
ifp->metric += 100;
ifp->metric += RTMETRIC_WIRELESS;
}
#endif

View File

@ -42,14 +42,6 @@
* dhcpcd can poll it for the relevant flags periodically */
#define IF_POLL_UP 100 /* milliseconds */
/* Some systems have in-built IPv4 DAD.
* However, we need them to do DAD at carrier up as well. */
#ifdef IN_IFF_TENTATIVE
# ifdef __NetBSD__
# define NOCARRIER_PRESERVE_IP
# endif
#endif
/*
* Systems which handle 1 address per alias.
* Currenly this is just Solaris.
@ -161,6 +153,7 @@ int if_domtu(const struct interface *, short int);
#define if_getmtu(ifp) if_domtu((ifp), 0)
#define if_setmtu(ifp, mtu) if_domtu((ifp), (mtu))
int if_carrier(struct interface *, const void *);
bool if_roaming(struct interface *);
#ifdef ALIAS_ADDR
int if_makealias(char *, size_t, const char *, int);

View File

@ -137,7 +137,7 @@ ipv4ll_defaultroute(rb_tree_t *routes, struct interface *ifp)
sa_in_init(&rt->rt_ifa, &state->addr->addr);
rt->rt_dflags |= RTDF_IPV4LL;
#ifdef HAVE_ROUTE_METRIC
rt->rt_metric += 10000;
rt->rt_metric += RTMETRIC_IPV4LL;
#endif
return rt_proto_add(routes, rt) ? 1 : 0;
}

View File

@ -73,7 +73,8 @@ ps_bpf_recvbpf(void *arg)
if (len == -1) {
int error = errno;
logerr("%s: %s", psp->psp_ifname, __func__);
if (errno != ENETDOWN)
logerr("%s: %s", psp->psp_ifname, __func__);
if (error != ENXIO)
break;
/* If the interface has departed, close the BPF

View File

@ -168,6 +168,15 @@ rt_compare_proto(void *context, const void *node1, const void *node2)
if (c != 0)
return -c;
/* Prefer roaming over non roaming if both carriers are down. */
if (ifp1->carrier == LINK_DOWN && ifp2->carrier == LINK_DOWN) {
bool roam1 = if_roaming(ifp1);
bool roam2 = if_roaming(ifp2);
if (roam1 != roam2)
return roam1 ? 1 : -1;
}
#ifdef INET
/* IPv4LL routes always come last */
if (rt1->rt_dflags & RTDF_IPV4LL && !(rt2->rt_dflags & RTDF_IPV4LL))
@ -374,6 +383,8 @@ rt_setif(struct rt *rt, struct interface *ifp)
rt->rt_ifp = ifp;
#ifdef HAVE_ROUTE_METRIC
rt->rt_metric = ifp->metric;
if (if_roaming(ifp))
rt->rt_metric += RTMETRIC_ROAM;
#endif
}

View File

@ -93,6 +93,15 @@ struct rt {
#ifdef HAVE_ROUTE_METRIC
unsigned int rt_metric;
#endif
/* Maximum interface index is generally USHORT_MAX or 65535.
* Add some padding for other stuff and we get offsets for the
* below that should work automatically.
* This is only an issue if the user defines higher metrics in
* their configuration, but then they might wish to override also. */
#define RTMETRIC_BASE 1000U
#define RTMETRIC_WIRELESS 2000U
#define RTMETRIC_IPV4LL 1000000U
#define RTMETRIC_ROAM 2000000U
#ifdef HAVE_ROUTE_PREF
int rt_pref;
#endif