Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/dhcpcd/dist Update to dhcpcd-9.4.0 with the fol...



details:   https://anonhg.NetBSD.org/src/rev/ecdc9eaee413
branches:  trunk
changeset: 948382:ecdc9eaee413
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Dec 28 13:56:25 2020 +0000

description:
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

diffstat:

 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in |  11 ++++++-----
 external/bsd/dhcpcd/dist/src/defs.h                  |   2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in        |  10 ++++++----
 external/bsd/dhcpcd/dist/src/if-options.h            |   2 ++
 external/bsd/dhcpcd/dist/src/if.c                    |   7 +++----
 external/bsd/dhcpcd/dist/src/if.h                    |   9 +--------
 external/bsd/dhcpcd/dist/src/ipv4ll.c                |   2 +-
 external/bsd/dhcpcd/dist/src/privsep-bpf.c           |   3 ++-
 external/bsd/dhcpcd/dist/src/route.c                 |  11 +++++++++++
 external/bsd/dhcpcd/dist/src/route.h                 |   9 +++++++++
 10 files changed, 42 insertions(+), 24 deletions(-)

diffs (230 lines):

diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in      Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in      Mon Dec 28 13:56:25 2020 +0000
@@ -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 @@
 .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 @@
 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 @@
 .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 .
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Mon Dec 28 13:56:25 2020 +0000
@@ -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
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in     Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in     Mon Dec 28 13:56:25 2020 +0000
@@ -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 @@
 .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 @@
 .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.
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/if-options.h
--- a/external/bsd/dhcpcd/dist/src/if-options.h Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.h Mon Dec 28 13:56:25 2020 +0000
@@ -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 @@
        uint32_t timeout;
        uint32_t reboot;
        unsigned long long options;
+       bool randomise_hwaddr;
 
        struct in_addr req_addr;
        struct in_addr req_mask;
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/if.c
--- a/external/bsd/dhcpcd/dist/src/if.c Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.c Mon Dec 28 13:56:25 2020 +0000
@@ -697,12 +697,11 @@
                        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
 
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/if.h
--- a/external/bsd/dhcpcd/dist/src/if.h Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.h Mon Dec 28 13:56:25 2020 +0000
@@ -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 @@
 #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);
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/ipv4ll.c
--- a/external/bsd/dhcpcd/dist/src/ipv4ll.c     Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4ll.c     Mon Dec 28 13:56:25 2020 +0000
@@ -137,7 +137,7 @@
        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;
 }
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/privsep-bpf.c
--- a/external/bsd/dhcpcd/dist/src/privsep-bpf.c        Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/privsep-bpf.c        Mon Dec 28 13:56:25 2020 +0000
@@ -73,7 +73,8 @@
                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
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/route.c
--- a/external/bsd/dhcpcd/dist/src/route.c      Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/route.c      Mon Dec 28 13:56:25 2020 +0000
@@ -168,6 +168,15 @@
        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->rt_ifp = ifp;
 #ifdef HAVE_ROUTE_METRIC
        rt->rt_metric = ifp->metric;
+       if (if_roaming(ifp))
+               rt->rt_metric += RTMETRIC_ROAM;
 #endif
 }
 
diff -r 7e460e78cdbb -r ecdc9eaee413 external/bsd/dhcpcd/dist/src/route.h
--- a/external/bsd/dhcpcd/dist/src/route.h      Mon Dec 28 13:12:24 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/route.h      Mon Dec 28 13:56:25 2020 +0000
@@ -93,6 +93,15 @@
 #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



Home | Main Index | Thread Index | Old Index