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.0.2 with the fol...



details:   https://anonhg.NetBSD.org/src/rev/0d7673d88e82
branches:  trunk
changeset: 931058:0d7673d88e82
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Apr 21 09:54:16 2020 +0000

description:
Update to dhcpcd-9.0.2 with the following changes:
 * Control sockets are not opened in test mode
 * privsep: no longer aborts if protocol not available
 * inet6: Don't regen temporary addresses without a state
 * inet6: Reduce RA log spam
 * dhcp6: Don't log when things consitently fail
 * inet6: Add temporary directive to slaac option [1]
 * Ensure current interface flags persist when setting a flag
 * DHCP via BPF is now aligned correctly
 * CMSG buffers are now aligned correctly
 * hostnames are no longer clobbered when being forced and a RA is recieved

[1] dhcpcd no longer looks at any possible kernel settings when deciding to
manage IPv6 temporary addresses or not. You now instruct dhcpcd to do this
in dhcpcd.conf. Playing whack-a-mole with various kernel knobs wasn't fun
and some OS's have or are removing RA and thus temporary address managemnt
from the kernel so said knobs are no longer there.

diffstat:

 external/bsd/dhcpcd/dist/hooks/30-hostname.in |   2 +-
 external/bsd/dhcpcd/dist/src/defs.h           |   2 +-
 external/bsd/dhcpcd/dist/src/dhcp6.h          |   3 +
 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in |  11 ++++--
 external/bsd/dhcpcd/dist/src/if-options.h     |   1 +
 external/bsd/dhcpcd/dist/src/if.c             |  14 +++-----
 external/bsd/dhcpcd/dist/src/if.h             |   7 ----
 external/bsd/dhcpcd/dist/src/privsep-inet.c   |  43 +++++++++++++-------------
 8 files changed, 40 insertions(+), 43 deletions(-)

diffs (216 lines):

diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/hooks/30-hostname.in
--- a/external/bsd/dhcpcd/dist/hooks/30-hostname.in     Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/30-hostname.in     Tue Apr 21 09:54:16 2020 +0000
@@ -153,6 +153,6 @@
        ;;
 esac
 
-if $if_up; then
+if $if_up && [ "$reason" != ROUTERADVERT ]; then
        set_hostname
 fi
diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Tue Apr 21 09:54:16 2020 +0000
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "9.0.1"
+#define VERSION                        "9.0.2"
 
 #ifndef PRIVSEP_USER
 # define PRIVSEP_USER          "_" PACKAGE
diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/src/dhcp6.h
--- a/external/bsd/dhcpcd/dist/src/dhcp6.h      Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.h      Tue Apr 21 09:54:16 2020 +0000
@@ -211,7 +211,10 @@
        const char *reason;
        uint16_t lerror; /* Last error received from DHCPv6 reply. */
        bool has_no_binding;
+       bool failed; /* Entered the failed state - used to rate limit log. */
+#ifdef AUTH
        struct authstate auth;
+#endif
 };
 
 #define D6_STATE(ifp)                                                         \
diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in     Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in     Tue Apr 21 09:54:16 2020 +0000
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 19, 2020
+.Dd April 19, 2020
 .Dt DHCPCD.CONF 5
 .Os
 .Sh NAME
@@ -442,7 +442,7 @@
 RDNSS option and a valid prefix or no DHCPv6 instruction.
 Set this option so to make
 .Nm dhcpcd
-always fork on an RA.
+always fork on a RA.
 .It Ic ipv6rs
 Enables IPv6 Router Advertisement solicitation.
 This is on by default, but is documented here in the case where it is disabled
@@ -626,11 +626,14 @@
 .It Ic ssid Ar ssid
 Subsequent options are only parsed for this wireless
 .Ar ssid .
-.It Ic slaac Op Ar hwaddr | Ar private
+.It Ic slaac Ar hwaddr | Ar private Op Ar temp | Ar temporary
 Selects the interface identifier used for SLAAC generated IPv6 addresses.
 If
 .Ar private
-is used, an RFC 7217 address is generated.
+is used, a RFC 7217 address is generated.
+The
+.Ar temporary
+directive will create a temporary address for the prefix as well.
 .It Ic static Ar value
 Configures a static
 .Ar value .
diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/src/if-options.h
--- a/external/bsd/dhcpcd/dist/src/if-options.h Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.h Tue Apr 21 09:54:16 2020 +0000
@@ -119,6 +119,7 @@
 #define DHCPCD_PRINT_PIDFILE           (1ULL << 59)
 #define DHCPCD_ONESHOT                 (1ULL << 60)
 #define DHCPCD_INACTIVE                        (1ULL << 61)
+#define        DHCPCD_SLAACTEMP                (1ULL << 62)
 
 #define DHCPCD_NODROP  (DHCPCD_EXITING | DHCPCD_PERSISTENT)
 
diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/src/if.c
--- a/external/bsd/dhcpcd/dist/src/if.c Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.c Tue Apr 21 09:54:16 2020 +0000
@@ -161,19 +161,17 @@
 if_setflag(struct interface *ifp, short setflag, short unsetflag)
 {
        struct ifreq ifr = { .ifr_flags = 0 };
-       short f;
+       short oflags;
 
-       if (if_getflags(ifp) == -1)
+       strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
+       if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFFLAGS, &ifr) == -1)
                return -1;
 
-       f = (short)ifp->flags;
-       if ((f & setflag) == setflag && (f & unsetflag) == 0)
-               return 0;
-
-       strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
+       oflags = ifr.ifr_flags;
        ifr.ifr_flags |= setflag;
        ifr.ifr_flags &= (short)~unsetflag;
-       if (if_ioctl(ifp->ctx, SIOCSIFFLAGS, &ifr, sizeof(ifr)) == -1)
+       if (ifr.ifr_flags != oflags &&
+           if_ioctl(ifp->ctx, SIOCSIFFLAGS, &ifr, sizeof(ifr)) == -1)
                return -1;
 
        ifp->flags = (unsigned int)ifr.ifr_flags;
diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/src/if.h
--- a/external/bsd/dhcpcd/dist/src/if.h Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.h Tue Apr 21 09:54:16 2020 +0000
@@ -220,13 +220,6 @@
 #ifdef INET6
 void if_disable_rtadv(void);
 void if_setup_inet6(const struct interface *);
-#ifdef IPV6_MANAGETEMPADDR
-int ip6_use_tempaddr(const char *ifname);
-int ip6_temp_preferred_lifetime(const char *ifname);
-int ip6_temp_valid_lifetime(const char *ifname);
-#else
-#define ip6_use_tempaddr(a) (0)
-#endif
 int ip6_forwarding(const char *ifname);
 
 struct ra;
diff -r c107efd67f33 -r 0d7673d88e82 external/bsd/dhcpcd/dist/src/privsep-inet.c
--- a/external/bsd/dhcpcd/dist/src/privsep-inet.c       Tue Apr 21 09:20:17 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/privsep-inet.c       Tue Apr 21 09:54:16 2020 +0000
@@ -99,37 +99,37 @@
        close(ctx->ps_data_fd);
        ctx->ps_data_fd = -1;
 
+       errno = 0;
+
 #ifdef INET
        if ((ctx->options & (DHCPCD_IPV4 | DHCPCD_MASTER)) ==
            (DHCPCD_IPV4 | DHCPCD_MASTER))
        {
                ctx->udp_fd = dhcp_openudp(NULL);
-               if (ctx->udp_fd == -1) {
+               if (ctx->udp_fd == -1)
                        logerr("%s: dhcp_open", __func__);
-                       return -1;
-               }
-               if (eloop_event_add(ctx->eloop, ctx->udp_fd,
+               else if (eloop_event_add(ctx->eloop, ctx->udp_fd,
                    ps_inet_recvbootp, ctx) == -1)
                {
                        logerr("%s: eloop_event_add DHCP", __func__);
-                       return -1;
-               }
-               ret++;
+                       close(ctx->udp_fd);
+                       ctx->udp_fd = -1;
+               } else
+                       ret++;
        }
 #endif
 #if defined(INET6) && !defined(__sun)
        if (ctx->options & DHCPCD_IPV6) {
-               if (ipv6nd_open(ctx) == -1) {
+               if (ipv6nd_open(ctx) == -1)
                        logerr("%s: ipv6nd_open", __func__);
-                       return -1;
-               }
-               if (eloop_event_add(ctx->eloop, ctx->nd_fd,
+               else if (eloop_event_add(ctx->eloop, ctx->nd_fd,
                    ps_inet_recvra, ctx) == -1)
                {
                        logerr("%s: eloop_event_add RA", __func__);
-                       return -1;
-               }
-               ret++;
+                       close(ctx->nd_fd);
+                       ctx->nd_fd = -1;
+               } else
+                       ret++;
        }
 #endif
 #ifdef DHCP6
@@ -137,21 +137,20 @@
            (DHCPCD_DHCP6 | DHCPCD_MASTER))
        {
                ctx->dhcp6_fd = dhcp6_openudp(0, NULL);
-               if (ctx->dhcp6_fd == -1) {
+               if (ctx->dhcp6_fd == -1)
                        logerr("%s: dhcp6_open", __func__);
-                       return -1;
-               }
-               if (eloop_event_add(ctx->eloop, ctx->dhcp6_fd,
+               else if (eloop_event_add(ctx->eloop, ctx->dhcp6_fd,
                    ps_inet_recvdhcp6, ctx) == -1)
                {
                        logerr("%s: eloop_event_add DHCP6", __func__);
-                       return -1;
-               }
-               ret++;
+                       close(ctx->dhcp6_fd);
+                       ctx->dhcp6_fd = -1;
+               } else
+                       ret++;
        }
 #endif
 
-       if (ret == 0) {
+       if (ret == 0 && errno == 0) {
                errno = ENXIO;
                return -1;
        }



Home | Main Index | Thread Index | Old Index