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 Sync



details:   https://anonhg.NetBSD.org/src/rev/5c8d32a01af0
branches:  trunk
changeset: 804976:5c8d32a01af0
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Dec 09 20:21:05 2014 +0000

description:
Sync

diffstat:

 external/bsd/dhcpcd/dist/defs.h                          |   4 +-
 external/bsd/dhcpcd/dist/dhcp.c                          |  15 ++-
 external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname |   8 ++-
 external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in             |   4 +-
 external/bsd/dhcpcd/dist/dhcpcd.8.in                     |   7 +-
 external/bsd/dhcpcd/dist/dhcpcd.c                        |  49 ++++++++++++---
 external/bsd/dhcpcd/dist/if.c                            |  33 +++++++--
 external/bsd/dhcpcd/dist/script.c                        |  10 ++-
 8 files changed, 93 insertions(+), 37 deletions(-)

diffs (truncated from 321 to 300 lines):

diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h   Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h   Tue Dec 09 20:21:05 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.9 2014/11/26 16:05:14 roy Exp $ */
+/* $NetBSD: defs.h,v 1.10 2014/12/09 20:21:05 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "6.6.4"
+#define VERSION                        "6.6.5"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c   Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c   Tue Dec 09 20:21:05 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.24 2014/11/26 13:43:06 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.25 2014/12/09 20:21:05 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -3077,11 +3077,14 @@
        if (ifp->ctx->udp_fd == -1) {
                ifp->ctx->udp_fd = dhcp_openudp(NULL);
                if (ifp->ctx->udp_fd == -1) {
-                       syslog(LOG_ERR, "dhcp_openudp: %m");
-                       return;
-               }
-               eloop_event_add(ifp->ctx->eloop,
-                   ifp->ctx->udp_fd, dhcp_handleudp, ifp->ctx, NULL, NULL);
+                       /* Don't log an error if some other process
+                        * is handling this. */
+                       if (errno != EADDRINUSE)
+                               syslog(LOG_ERR, "dhcp_openudp: %m");
+               } else
+                       eloop_event_add(ifp->ctx->eloop,
+                           ifp->ctx->udp_fd, dhcp_handleudp,
+                           ifp->ctx, NULL, NULL);
        }
 
        if (dhcp_init(ifp) == -1) {
diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname
--- a/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname  Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname  Tue Dec 09 20:21:05 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: 29-lookup-hostname,v 1.6 2014/11/07 20:51:03 roy Exp $
+# $NetBSD: 29-lookup-hostname,v 1.7 2014/12/09 20:21:05 roy Exp $
 
 # Lookup the hostname in DNS if not set
 
@@ -20,6 +20,12 @@
                        | sed 's/.* domain name pointer \(.*\)./\1/'
                        return 0
                fi
+       elif type getent >/dev/null 2>&1; then
+               h=$(getent hosts $new_ip_address)
+               if [ $? = 0 ]; then
+                       echo "$h" | sed 's/[^ ]* *\([^ ]*\).*/\1/'
+                       return 0
+                fi
        fi
        return 1
 }
diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
--- a/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in      Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in      Tue Dec 09 20:21:05 2014 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: dhcpcd-run-hooks.in,v 1.7 2014/11/26 16:05:14 roy Exp $
+# $NetBSD: dhcpcd-run-hooks.in,v 1.8 2014/12/09 20:21:05 roy Exp $
 
 # dhcpcd client configuration script 
 
@@ -9,8 +9,6 @@
                ifsuffix=":ra";;
        INFORM6|BOUND6|RENEW6|REBIND6|REBOOT6|EXPIRE6|RELEASE6|STOP6)
                ifsuffix=":dhcp6";;
-       STOPPED) # This reason should never be processed
-               exit 0;;
        *)
                ifsuffix=;;
 esac
diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/dhcpcd.8.in
--- a/external/bsd/dhcpcd/dist/dhcpcd.8.in      Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.8.in      Tue Dec 09 20:21:05 2014 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.8.in,v 1.37 2014/11/26 13:43:06 roy Exp $
+.\"     $NetBSD: dhcpcd.8.in,v 1.38 2014/12/09 20:21:05 roy Exp $
 .\" Copyright (c) 2006-2014 Roy Marples
 .\" All rights reserved
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 18, 2014
+.Dd November 26, 2014
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -557,6 +557,9 @@
 to the console.
 The interface configuration isn't touched and neither are any configuration
 files.
+The
+.Ar rapid_commit
+option is not sent in TEST mode so that the server does not lease an address.
 To test INFORM the interface needs to be configured with the desired address
 before starting
 .Nm .
diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Tue Dec 09 20:21:05 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.18 2014/11/26 13:43:06 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.19 2014/12/09 20:21:05 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -452,12 +452,13 @@
                            sizeof(ifo->iaid));
                else {
                        uint32_t len;
-                       
+
                        len = (uint32_t)strlen(ifp->name);
                        if (len <= sizeof(ifo->iaid)) {
                                memcpy(ifo->iaid, ifp->name, len);
-                               memset(ifo->iaid + len, 0,
-                                   sizeof(ifo->iaid) - len);
+                               if (len < sizeof(ifo->iaid))
+                                       memset(ifo->iaid + len, 0,
+                                           sizeof(ifo->iaid) - len);
                        } else {
                                /* IAID is the same size as a uint32_t */
                                len = htonl(ifp->index);
@@ -540,6 +541,25 @@
        configure_interface1(ifp);
 }
 
+static void
+dhcpcd_pollup(void *arg)
+{
+       struct interface *ifp = arg;
+       int carrier;
+
+       carrier = if_carrier(ifp); /* will set ifp->flags */
+       if (carrier == LINK_UP && !(ifp->flags & IFF_UP)) {
+               struct timeval tv;
+
+               tv.tv_sec = 0;
+               tv.tv_usec = IF_POLL_UP * 1000;
+               eloop_timeout_add_tv(ifp->ctx->eloop, &tv, dhcpcd_pollup, ifp);
+               return;
+       }
+
+       dhcpcd_handlecarrier(ifp->ctx, carrier, ifp->flags, ifp->name);
+}
+
 void
 dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
     const char *ifname)
@@ -555,19 +575,24 @@
                carrier = if_carrier(ifp); /* will set ifp->flags */
                break;
        case LINK_UP:
-               /* we have a carrier! however, we need to ignore the flags
-                * set in the kernel message as sometimes this message is
-                * reported before IFF_UP is set by the kernel even though
-                * dhcpcd has already set it.
-                *
-                * So we check the flags now. If IFF_UP is still not set
-                * then we should expect an accompanying link_down message */
-               if_setflag(ifp, 0); /* will set ifp->flags */
+               /* we have a carrier! Still need to check for IFF_UP */
+               if (flags & IFF_UP)
+                       ifp->flags = flags;
+               else {
+                       /* So we need to poll for IFF_UP as there is no
+                        * kernel notification when it's set. */
+                       dhcpcd_pollup(ifp);
+                       return;
+               }
                break;
        default:
                ifp->flags = flags;
        }
 
+       /* If we here, we don't need to poll for IFF_UP any longer
+        * if generated by a kernel event. */
+       eloop_timeout_delete(ifp->ctx->eloop, dhcpcd_pollup, ifp);
+
        if (carrier == LINK_UNKNOWN) {
                if (errno != ENOTTY) /* For example a PPP link on BSD */
                        syslog(LOG_ERR, "%s: carrier_status: %m", ifname);
diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/if.c
--- a/external/bsd/dhcpcd/dist/if.c     Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/if.c     Tue Dec 09 20:21:05 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if.c,v 1.8 2014/12/02 22:13:13 christos Exp $");
+ __RCSID("$NetBSD: if.c,v 1.9 2014/12/09 20:21:05 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -187,7 +187,6 @@
        struct ifaddrs *ifaddrs, *ifa;
        char *p;
        int i;
-       sa_family_t sdltype;
        struct if_head *ifs;
        struct interface *ifp;
 #ifdef __linux__
@@ -321,7 +320,6 @@
                ifp->flags = ifa->ifa_flags;
                ifp->carrier = if_carrier(ifp);
 
-               sdltype = 0;
                if (ifa->ifa_addr != NULL) {
 #ifdef AF_LINK
                        sdl = (const struct sockaddr_dl *)(void *)ifa->ifa_addr;
@@ -346,7 +344,6 @@
                        memcpy(&ifp->linkaddr, sdl, sdl->sdl_len);
 #endif
                        ifp->index = sdl->sdl_index;
-                       sdltype = sdl->sdl_type;
                        switch(sdl->sdl_type) {
 #ifdef IFT_BRIDGE
                        case IFT_BRIDGE:
@@ -379,6 +376,21 @@
                                ifp->family = ARPHRD_INFINIBAND;
                                break;
 #endif
+                       default:
+                               /* Don't allow unless explicit */
+                               if ((argc == 0 || argc == -1) &&
+                                   ctx->ifac == 0 &&
+                                   !if_hasconf(ctx, ifp->name))
+                               {
+                                       if_free(ifp);
+                                       continue;
+                               }
+                               syslog(LOG_WARNING,
+                                   "%s: unsupported interface type %.2x",
+                                   ifp->name, ifp->family);
+                               /* Pretend it's ethernet */
+                               ifp->family = ARPHRD_ETHER;
+                               break;
                        }
                        ifp->hwlen = sdl->sdl_alen;
 #ifndef CLLADDR
@@ -388,7 +400,7 @@
 #elif AF_PACKET
                        sll = (const struct sockaddr_ll *)(void *)ifa->ifa_addr;
                        ifp->index = (unsigned int)sll->sll_ifindex;
-                       ifp->family = sdltype = sll->sll_hatype;
+                       ifp->family = sll->sll_hatype;
                        ifp->hwlen = sll->sll_halen;
                        if (ifp->hwlen != 0)
                                memcpy(ifp->hwaddr, sll->sll_addr, ifp->hwlen);
@@ -409,7 +421,7 @@
                                continue;
                        }
                        switch (ifp->family) {
-                       case ARPHRD_IEEE1394: /* FALLTHROUGH */
+                       case ARPHRD_IEEE1394:
                        case ARPHRD_INFINIBAND:
 #ifdef ARPHRD_LOOPBACK
                        case ARPHRD_LOOPBACK:
@@ -419,12 +431,15 @@
 #endif
                                /* We don't warn for supported families */
                                break;
+
+/* IFT already checked */
+#ifndef AF_LINK
                        default:
                                syslog(LOG_WARNING,
-                                   "%s: unsupported interface type %.2x, "
-                                   "family %.2x",
-                                   ifp->name, sdltype, ifp->family);
+                                   "%s: unsupported interface family %.2x",
+                                   ifp->name, ifp->family);
                                break;
+#endif
                        }
                }
 
diff -r b91d6ee96b5e -r 5c8d32a01af0 external/bsd/dhcpcd/dist/script.c
--- a/external/bsd/dhcpcd/dist/script.c Tue Dec 09 14:39:49 2014 +0000
+++ b/external/bsd/dhcpcd/dist/script.c Tue Dec 09 20:21:05 2014 +0000
@@ -1,5 +1,5 @@



Home | Main Index | Thread Index | Old Index