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 Import dhcpcd-5.2.10 with the follo...



details:   https://anonhg.NetBSD.org/src/rev/8ffaff5272bd
branches:  trunk
changeset: 760353:8ffaff5272bd
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Jan 03 11:28:23 2011 +0000

description:
Import dhcpcd-5.2.10 with the following change:
 * -r, --request <address> now works again

diffstat:

 external/bsd/dhcpcd/dist/config.h       |   1 -
 external/bsd/dhcpcd/dist/defs.h         |   2 +-
 external/bsd/dhcpcd/dist/dhcp.c         |   4 +++-
 external/bsd/dhcpcd/dist/dhcpcd.c       |  25 +++++++------------------
 external/bsd/dhcpcd/dist/if-bsd.c       |   4 ++++
 external/bsd/dhcpcd/dist/if-options.c   |   6 +++---
 external/bsd/dhcpcd/dist/platform-bsd.c |   4 ++++
 7 files changed, 22 insertions(+), 24 deletions(-)

diffs (160 lines):

diff -r bbc42069ac3e -r 8ffaff5272bd external/bsd/dhcpcd/dist/config.h
--- a/external/bsd/dhcpcd/dist/config.h Mon Jan 03 10:44:40 2011 +0000
+++ b/external/bsd/dhcpcd/dist/config.h Mon Jan 03 11:28:23 2011 +0000
@@ -4,4 +4,3 @@
 #define LIBEXECDIR     "/libexec"
 #define DBDIR          "/var/db"
 #define RUNDIR         "/var/run"
-#include "compat/getline.h"
diff -r bbc42069ac3e -r 8ffaff5272bd external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h   Mon Jan 03 10:44:40 2011 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h   Mon Jan 03 11:28:23 2011 +0000
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "5.2.9"
+#define VERSION                        "5.2.10"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r bbc42069ac3e -r 8ffaff5272bd external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c   Mon Jan 03 10:44:40 2011 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c   Mon Jan 03 11:28:23 2011 +0000
@@ -892,7 +892,6 @@
 
        if (lease->addr.s_addr && lease->cookie == htonl(MAGIC_COOKIE)) {
                if (type == DHCP_DECLINE ||
-                   type == DHCP_DISCOVER ||
                    (type == DHCP_REQUEST &&
                        lease->addr.s_addr != iface->addr.s_addr))
                {
@@ -915,6 +914,9 @@
                p += len;
        }
 
+       if (type == DHCP_DISCOVER && ifo->options & DHCPCD_REQUEST)
+               PUTADDR(DHO_IPADDRESS, ifo->req_addr);
+
        if (type == DHCP_DISCOVER ||
            type == DHCP_INFORM ||
            type == DHCP_REQUEST)
diff -r bbc42069ac3e -r 8ffaff5272bd external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Mon Jan 03 10:44:40 2011 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Mon Jan 03 11:28:23 2011 +0000
@@ -1107,9 +1107,6 @@
                return;
        }
 
-       /* We don't want to read the old lease if we NAK an old test */
-       nolease = iface->state->offer && options & DHCPCD_TEST;
-
        iface->start_uptime = uptime();
        free(iface->state->offer);
        iface->state->offer = NULL;
@@ -1134,21 +1131,9 @@
                delete_timeout(NULL, iface);
                return;
        }
-       if (ifo->req_addr.s_addr) {
-               iface->state->offer =
-                   dhcp_message_new(&ifo->req_addr, &ifo->req_mask);
-               if (ifo->options & DHCPCD_REQUEST)
-                       ifo->req_addr.s_addr = 0;
-               else {
-                       iface->state->reason = "STATIC";
-                       iface->state->new = iface->state->offer;
-                       iface->state->offer = NULL;
-                       get_lease(&iface->state->lease, iface->state->new);
-                       configure(iface);
-                       start_inform(iface);
-                       return;
-               }
-       } else if (!nolease)
+       /* We don't want to read the old lease if we NAK an old test */
+       nolease = iface->state->offer && options & DHCPCD_TEST;
+       if (!nolease)
                iface->state->offer = read_lease(iface);
        if (iface->state->offer) {
                get_lease(&iface->state->lease, iface->state->offer);
@@ -1207,6 +1192,10 @@
        configure_interface(iface, argc, argv);
        if (!(options & DHCPCD_TEST))
                run_script(iface);
+       /* We need to drop the leasefile so that start_interface
+        * doesn't load it. */  
+       if (ifs->options->options & DHCPCD_REQUEST)
+               unlink(iface->leasefile);
 
        if (ifs->options->options & DHCPCD_LINK) {
                switch (carrier_status(iface)) {
diff -r bbc42069ac3e -r 8ffaff5272bd external/bsd/dhcpcd/dist/if-bsd.c
--- a/external/bsd/dhcpcd/dist/if-bsd.c Mon Jan 03 10:44:40 2011 +0000
+++ b/external/bsd/dhcpcd/dist/if-bsd.c Mon Jan 03 11:28:23 2011 +0000
@@ -39,6 +39,8 @@
 #include <netinet/in.h>
 #ifdef __DragonFly__
 #  include <netproto/802_11/ieee80211_ioctl.h>
+#elif __APPLE__
+  /* FIXME: Add apple includes so we can work out SSID */
 #else
 #  include <net80211/ieee80211_ioctl.h>
 #endif
@@ -342,6 +344,7 @@
                for (p = link_buf; p < e; p += rtm->rtm_msglen) {
                        rtm = (struct rt_msghdr *)(void *)p;
                        switch(rtm->rtm_type) {
+#ifdef RTM_IFANNOUNCE
                        case RTM_IFANNOUNCE:
                                ifan = (struct if_announcemsghdr *)(void *)p;
                                switch(ifan->ifan_what) {
@@ -353,6 +356,7 @@
                                        break;
                                }
                                break;
+#endif
                        case RTM_IFINFO:
                                ifm = (struct if_msghdr *)(void *)p;
                                memset(ifname, 0, sizeof(ifname));
diff -r bbc42069ac3e -r 8ffaff5272bd external/bsd/dhcpcd/dist/if-options.c
--- a/external/bsd/dhcpcd/dist/if-options.c     Mon Jan 03 10:44:40 2011 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.c     Mon Jan 03 11:28:23 2011 +0000
@@ -420,14 +420,12 @@
                ifo->options |= DHCPCD_QUIET;
                break;
        case 'r':
-               ifo->options |= DHCPCD_REQUEST;
                if (parse_addr(&ifo->req_addr, NULL, arg) != 0)
                        return -1;
+               ifo->options |= DHCPCD_REQUEST;
                ifo->req_mask.s_addr = 0;
                break;
        case 's':
-               ifo->options |= DHCPCD_INFORM | DHCPCD_PERSISTENT;
-               ifo->options &= ~(DHCPCD_ARP | DHCPCD_STATIC);
                if (arg && *arg != '\0') {
                        if (parse_addr(&ifo->req_addr, &ifo->req_mask,
                                arg) != 0)
@@ -436,6 +434,8 @@
                        ifo->req_addr.s_addr = 0;
                        ifo->req_mask.s_addr = 0;
                }
+               ifo->options |= DHCPCD_INFORM | DHCPCD_PERSISTENT;
+               ifo->options &= ~(DHCPCD_ARP | DHCPCD_STATIC);
                break;
        case 't':
                ifo->timeout = atoint(arg);
diff -r bbc42069ac3e -r 8ffaff5272bd external/bsd/dhcpcd/dist/platform-bsd.c
--- a/external/bsd/dhcpcd/dist/platform-bsd.c   Mon Jan 03 10:44:40 2011 +0000
+++ b/external/bsd/dhcpcd/dist/platform-bsd.c   Mon Jan 03 11:28:23 2011 +0000
@@ -31,6 +31,10 @@
 
 #include "platform.h"
 
+#ifndef SYS_NMLN       /* OSX */
+#  define SYS_NMLN 256
+#endif
+
 static char march[SYS_NMLN];
 
 char *



Home | Main Index | Thread Index | Old Index