Source-Changes-HG archive

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

[src/ROY]: src/external/bsd/dhcpcd/dist/src Import dhcpcd-7.1.1 with the foll...



details:   https://anonhg.NetBSD.org/src/rev/297605e7f2ea
branches:  ROY
changeset: 455217:297605e7f2ea
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Feb 07 21:34:30 2019 +0000

description:
Import dhcpcd-7.1.1 with the following changes:

* IPv4LL: Fixed build with this disabled
* IPv4LL: Remember last address between carrier resets
* BSD: Fixed initial link infos reported as LINK_STATE_UNKNOWN

diffstat:

 external/bsd/dhcpcd/dist/src/arp.c        |    4 +-
 external/bsd/dhcpcd/dist/src/arp.h        |    4 +-
 external/bsd/dhcpcd/dist/src/common.h     |    8 ++
 external/bsd/dhcpcd/dist/src/defs.h       |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp.c       |   10 +-
 external/bsd/dhcpcd/dist/src/dhcp.h       |   15 +---
 external/bsd/dhcpcd/dist/src/dhcp6.c      |    8 +-
 external/bsd/dhcpcd/dist/src/dhcp6.h      |   21 +----
 external/bsd/dhcpcd/dist/src/dhcpcd.c     |  114 +++++++++++++++++++++++++----
 external/bsd/dhcpcd/dist/src/dhcpcd.h     |   14 ++-
 external/bsd/dhcpcd/dist/src/if-bsd.c     |   41 ++++++---
 external/bsd/dhcpcd/dist/src/if-options.c |   10 ++-
 external/bsd/dhcpcd/dist/src/if.c         |   26 +++++-
 external/bsd/dhcpcd/dist/src/ipv4.c       |   13 ++-
 external/bsd/dhcpcd/dist/src/ipv4.h       |    9 +-
 external/bsd/dhcpcd/dist/src/ipv4ll.h     |    6 -
 external/bsd/dhcpcd/dist/src/ipv6.c       |   18 ++++-
 external/bsd/dhcpcd/dist/src/ipv6.h       |   16 +---
 external/bsd/dhcpcd/dist/src/ipv6nd.c     |   38 ++++++---
 external/bsd/dhcpcd/dist/src/ipv6nd.h     |   13 +--
 external/bsd/dhcpcd/dist/src/script.c     |   19 +++-
 21 files changed, 269 insertions(+), 140 deletions(-)

diffs (truncated from 1306 to 300 lines):

diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c        Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c        Thu Feb 07 21:34:30 2019 +0000
@@ -400,7 +400,7 @@
 }
 
 void
-arp_announceaddr(struct dhcpcd_ctx *ctx, struct in_addr *ia)
+arp_announceaddr(struct dhcpcd_ctx *ctx, const struct in_addr *ia)
 {
        struct interface *ifp;
        struct ipv4_addr *iaf;
@@ -424,7 +424,7 @@
 }
 
 void
-arp_ifannounceaddr(struct interface *ifp, struct in_addr *ia)
+arp_ifannounceaddr(struct interface *ifp, const struct in_addr *ia)
 {
        struct arp_state *astate;
 
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/arp.h
--- a/external/bsd/dhcpcd/dist/src/arp.h        Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.h        Thu Feb 07 21:34:30 2019 +0000
@@ -95,8 +95,8 @@
 struct arp_state *arp_new(struct interface *, const struct in_addr *);
 struct arp_state *arp_find(struct interface *, const struct in_addr *);
 void arp_announce(struct arp_state *);
-void arp_announceaddr(struct dhcpcd_ctx *, struct in_addr *);
-void arp_ifannounceaddr(struct interface *, struct in_addr *);
+void arp_announceaddr(struct dhcpcd_ctx *, const struct in_addr *);
+void arp_ifannounceaddr(struct interface *, const struct in_addr *);
 void arp_cancel(struct arp_state *);
 void arp_free(struct arp_state *);
 void arp_free_but(struct arp_state *);
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/common.h
--- a/external/bsd/dhcpcd/dist/src/common.h     Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.h     Thu Feb 07 21:34:30 2019 +0000
@@ -130,6 +130,14 @@
 # endif
 #endif
 
+#ifndef __fallthrough
+# if __GNUC__ >= 7
+#  define __fallthrough __attribute__((fallthrough))
+# else
+#  define __fallthrough
+# endif
+#endif
+
 /*
  * Compile Time Assertion.
  */
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Thu Feb 07 21:34:30 2019 +0000
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "7.1.0"
+#define VERSION                        "7.1.1"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c       Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c       Thu Feb 07 21:34:30 2019 +0000
@@ -1764,7 +1764,7 @@
 
        if (!callback) {
                /* No carrier? Don't bother sending the packet. */
-               if (ifp->carrier == LINK_DOWN)
+               if (ifp->carrier <= LINK_DOWN)
                        return;
                logdebugx("%s: sending %s with xid 0x%x",
                    ifp->name,
@@ -1784,7 +1784,7 @@
                timespecnorm(&tv);
                /* No carrier? Don't bother sending the packet.
                 * However, we do need to advance the timeout. */
-               if (ifp->carrier == LINK_DOWN)
+               if (ifp->carrier <= LINK_DOWN)
                        goto fail;
                logdebugx("%s: sending %s (xid 0x%x), next in %0.1f seconds",
                    ifp->name,
@@ -1965,7 +1965,7 @@
        dhcp_drop(ifp, "EXPIRE");
        unlink(state->leasefile);
        state->interval = 0;
-       if (!(ifp->options->options & DHCPCD_LINK) || ifp->carrier != LINK_DOWN)
+       if (!(ifp->options->options & DHCPCD_LINK) || ifp->carrier > LINK_DOWN)
                dhcp_discover(ifp);
 }
 
@@ -2601,7 +2601,7 @@
        state->state = DHS_REBOOT;
        state->interval = 0;
 
-       if (ifo->options & DHCPCD_LINK && ifp->carrier == LINK_DOWN) {
+       if (ifo->options & DHCPCD_LINK && ifp->carrier <= LINK_DOWN) {
                loginfox("%s: waiting for carrier", ifp->name);
                return;
        }
@@ -2691,7 +2691,7 @@
                state->state = DHS_RELEASE;
 
                unlink(state->leasefile);
-               if (ifp->carrier != LINK_DOWN &&
+               if (ifp->carrier > LINK_DOWN &&
                    state->new != NULL &&
                    state->lease.server.s_addr != INADDR_ANY)
                {
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/dhcp.h
--- a/external/bsd/dhcpcd/dist/src/dhcp.h       Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.h       Thu Feb 07 21:34:30 2019 +0000
@@ -228,6 +228,7 @@
 #endif
 };
 
+#ifdef INET
 #define D_STATE(ifp)                                                          \
        ((struct dhcp_state *)(ifp)->if_data[IF_DATA_DHCP])
 #define D_CSTATE(ifp)                                                         \
@@ -243,7 +244,6 @@
 #include "dhcpcd.h"
 #include "if-options.h"
 
-#ifdef INET
 char *decode_rfc3361(const uint8_t *, size_t);
 ssize_t decode_rfc3442(char *, size_t, const uint8_t *p, size_t);
 
@@ -266,15 +266,6 @@
 void dhcp_close(struct interface *);
 void dhcp_free(struct interface *);
 int dhcp_dump(struct interface *);
-#else
-#define dhcp_start(a) {}
-#define dhcp_abort(a) {}
-#define dhcp_renew(a) {}
-#define dhcp_reboot(a, b) (b = b)
-#define dhcp_reboot_newopts(a, b) (b = b)
-#define dhcp_close(a) {}
-#define dhcp_free(a) {}
-#define dhcp_dump(a) (-1)
-#endif
+#endif /* INET */
 
-#endif
+#endif /* DHCP_H */
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/dhcp6.c
--- a/external/bsd/dhcpcd/dist/src/dhcp6.c      Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.c      Thu Feb 07 21:34:30 2019 +0000
@@ -1169,7 +1169,7 @@
        struct ipv6_addr *lla;
        int s;
 
-       if (!callback && ifp->carrier == LINK_DOWN)
+       if (!callback && ifp->carrier <= LINK_DOWN)
                return 0;
 
        memset(&dst, 0, sizeof(dst));
@@ -1262,7 +1262,7 @@
                }
 
 logsend:
-               if (ifp->carrier != LINK_DOWN)
+               if (ifp->carrier > LINK_DOWN)
                        logdebugx("%s: %s %s (xid 0x%02x%02x%02x),"
                            " next in %0.1f seconds",
                            ifp->name,
@@ -1286,7 +1286,7 @@
                }
        }
 
-       if (ifp->carrier == LINK_DOWN)
+       if (ifp->carrier <= LINK_DOWN)
                return 0;
 
        /* Update the elapsed time */
@@ -3416,6 +3416,8 @@
                        break;
                }
                return;
+#else
+               break;
 #endif
        default:
                logerrx("%s: invalid DHCP6 type %s (%d)",
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/dhcp6.h
--- a/external/bsd/dhcpcd/dist/src/dhcp6.h      Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.h      Thu Feb 07 21:34:30 2019 +0000
@@ -55,6 +55,8 @@
 #define DHCP6_RECONFIGURE_REQ  18
 #define DHCP6_RECONFIGURE_REPLY        19
 
+#ifdef DHCP6
+
 #define D6_OPTION_CLIENTID             1
 #define D6_OPTION_SERVERID             2
 #define D6_OPTION_IA_NA                        3
@@ -216,7 +218,6 @@
        (D6_CSTATE((ifp)) &&                                                   \
        D6_CSTATE((ifp))->reason && dhcp6_dadcompleted((ifp)))
 
-#ifdef DHCP6
 void dhcp6_printoptions(const struct dhcpcd_ctx *,
     const struct dhcp_opt *, size_t);
 const struct ipv6_addr *dhcp6_iffindaddr(const struct interface *ifp,
@@ -236,20 +237,6 @@
 void dhcp6_drop(struct interface *, const char *);
 void dhcp6_dropnondelegates(struct interface *ifp);
 int dhcp6_dump(struct interface *);
-#else
-#define dhcp6_printoptions(a, b, c) {}
-#define dhcp6_iffindaddr(a, b, c) (NULL)
-#define dhcp6_findaddr(a, b, c) (NULL)
-#define dhcp6_find_delegates(a) {}
-#define dhcp6_start(a, b) (0)
-#define dhcp6_reboot(a) {}
-#define dhcp6_renew(a) {}
-#define dhcp6_env(a, b, c, d, e) (0)
-#define dhcp6_free(a) {}
-#define dhcp6_dadcompleted(a) (0)
-#define dhcp6_drop(a, b) {}
-#define dhcp6_dropnondelegates(a) {}
-#define dhcp6_dump(a) (-1)
-#endif
+#endif /* DHCP6 */
 
-#endif
+#endif /* DHCP6_H */
diff -r fbae92301fd5 -r 297605e7f2ea external/bsd/dhcpcd/dist/src/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.c     Tue Jan 22 15:16:24 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.c     Thu Feb 07 21:34:30 2019 +0000
@@ -52,6 +52,7 @@
 #include "common.h"
 #include "control.h"
 #include "dev.h"
+#include "dhcp-common.h"
 #include "dhcpcd.h"
 #include "dhcp6.h"
 #include "duid.h"
@@ -151,6 +152,7 @@
                free(ctx->nd_opts);
                ctx->nd_opts = NULL;
        }
+#ifdef DHCP6
        if (ctx->dhcp6_opts) {
                for (opt = ctx->dhcp6_opts;
                    ctx->dhcp6_opts_len > 0;
@@ -160,6 +162,7 @@
                ctx->dhcp6_opts = NULL;
        }
 #endif
+#endif
        if (ctx->vivso) {
                for (opt = ctx->vivso;
                    ctx->vivso_len > 0;
@@ -205,18 +208,39 @@
 dhcpcd_ifafwaiting(const struct interface *ifp)
 {
        unsigned long long opts;
+       bool foundany = false;
 
        if (ifp->active != IF_ACTIVE_USER)
                return AF_MAX;
 
+#define DHCPCD_WAITALL (DHCPCD_WAITIP4 | DHCPCD_WAITIP6)
        opts = ifp->options->options;
-       if (opts & DHCPCD_WAITIP4 && !ipv4_hasaddr(ifp))
-               return AF_INET;
-       if (opts & DHCPCD_WAITIP6 && !ipv6_hasaddr(ifp))
-               return AF_INET6;
-       if (opts & DHCPCD_WAITIP &&
-           !(opts & (DHCPCD_WAITIP4 | DHCPCD_WAITIP6)) &&
-           !ipv4_hasaddr(ifp) && !ipv6_hasaddr(ifp))
+#ifdef INET
+       if (opts & DHCPCD_WAITIP4 ||
+           (opts & DHCPCD_WAITIP && !(opts & DHCPCD_WAITALL)))
+       {
+               bool foundaddr = ipv4_hasaddr(ifp);
+
+               if (opts & DHCPCD_WAITIP4 && !foundaddr)
+                       return AF_INET;
+               if (foundaddr)
+                       foundany = true;
+       }
+#endif
+#ifdef INET6
+       if (opts & DHCPCD_WAITIP6 ||
+           (opts & DHCPCD_WAITIP && !(opts & DHCPCD_WAITALL)))
+       {
+               bool foundaddr = ipv6_hasaddr(ifp);
+
+               if (opts & DHCPCD_WAITIP6 && !foundaddr)
+                       return AF_INET;
+               if (foundaddr)
+                       foundany = true;
+       }



Home | Main Index | Thread Index | Old Index