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.5.4 with the follow...



details:   https://anonhg.NetBSD.org/src/rev/813fb46a9116
branches:  trunk
changeset: 773566:813fb46a9116
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Feb 06 15:56:58 2012 +0000

description:
Import dhcpcd-5.5.4 with the following changes:
* Disregard IFF_RUNNING on link state changes
* Warn about the kernel not configured for IPv6 RAs instead of
  complaining it can't send messages

OK: releng@

diffstat:

 external/bsd/dhcpcd/dist/defs.h         |   2 +-
 external/bsd/dhcpcd/dist/dhcpcd.c       |  16 ++++++++-----
 external/bsd/dhcpcd/dist/ipv6rs.c       |   2 +-
 external/bsd/dhcpcd/dist/platform-bsd.c |  37 ++++++++++++++++++++++++++++++++-
 external/bsd/dhcpcd/dist/platform.h     |   3 +-
 5 files changed, 50 insertions(+), 10 deletions(-)

diffs (151 lines):

diff -r c3ffa816454a -r 813fb46a9116 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h   Mon Feb 06 12:13:44 2012 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h   Mon Feb 06 15:56:58 2012 +0000
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "5.5.3"
+#define VERSION                        "5.5.4"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r c3ffa816454a -r 813fb46a9116 external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Mon Feb 06 12:13:44 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Mon Feb 06 15:56:58 2012 +0000
@@ -69,6 +69,7 @@
 #include "ipv4ll.h"
 #include "ipv6rs.h"
 #include "net.h"
+#include "platform.h"
 #include "signals.h"
 
 /* We should define a maximum for the NAK exponential backoff */ 
@@ -897,15 +898,16 @@
        }
        if (!(iface->state->options->options & DHCPCD_LINK))
                return;
-       if (action == 0)
-               carrier = carrier_status(iface);
-       else {
+
+       if (action) {
                carrier = action == 1 ? 1 : 0;
                iface->flags = flags;
-       }
+       } else
+               carrier = carrier_status(iface);
+
        if (carrier == -1)
                syslog(LOG_ERR, "%s: carrier_status: %m", ifname);
-       else if (carrier == 0 || ~iface->flags & (IFF_UP | IFF_RUNNING)) {
+       else if (carrier == 0 || ~iface->flags & IFF_UP) {
                if (iface->carrier != LINK_DOWN) {
                        iface->carrier = LINK_DOWN;
                        syslog(LOG_INFO, "%s: carrier lost", iface->name);
@@ -918,7 +920,7 @@
                        }
                        drop_dhcp(iface, "NOCARRIER");
                }
-       } else if (carrier == 1 && !(~iface->flags & (IFF_UP | IFF_RUNNING))) {
+       } else if (carrier == 1 && !(~iface->flags & IFF_UP)) {
                if (iface->carrier != LINK_UP) {
                        iface->carrier = LINK_UP;
                        syslog(LOG_INFO, "%s: carrier acquired", iface->name);
@@ -1991,6 +1993,8 @@
        }
 #endif
 
+       if (options & DHCPCD_IPV6RS && !check_ipv6())
+               options &= ~DHCPCD_IPV6RS;
        if (options & DHCPCD_IPV6RS) {
                ipv6rsfd = ipv6rs_open();
                if (ipv6rsfd == -1) {
diff -r c3ffa816454a -r 813fb46a9116 external/bsd/dhcpcd/dist/ipv6rs.c
--- a/external/bsd/dhcpcd/dist/ipv6rs.c Mon Feb 06 12:13:44 2012 +0000
+++ b/external/bsd/dhcpcd/dist/ipv6rs.c Mon Feb 06 15:56:58 2012 +0000
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2012 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
diff -r c3ffa816454a -r 813fb46a9116 external/bsd/dhcpcd/dist/platform-bsd.c
--- a/external/bsd/dhcpcd/dist/platform-bsd.c   Mon Feb 06 12:13:44 2012 +0000
+++ b/external/bsd/dhcpcd/dist/platform-bsd.c   Mon Feb 06 15:56:58 2012 +0000
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2010 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2012 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -26,8 +26,12 @@
  */
 
 #include <sys/param.h>
+#include <sys/socket.h>
 #include <sys/sysctl.h>
 #include <sys/utsname.h>
+#include <netinet/in.h>
+
+#include <syslog.h>
 
 #include "platform.h"
 
@@ -48,3 +52,34 @@
                return NULL;
        return march;
 }
+
+static int
+inet6_sysctl(int code)
+{
+       int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 };
+       int val;
+       size_t size;
+
+       mib[3] = code;
+       size = sizeof(val);
+       if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &val, &size, NULL, 0) == -1)
+               return -1;
+       return val;
+}
+
+int
+check_ipv6(void)
+{
+
+       if (inet6_sysctl(IPV6CTL_ACCEPT_RTADV) != 1) {
+               syslog(LOG_WARNING,
+                   "Kernel is not configured to accept IPv6 RAs");
+               return 0;
+       }
+       if (inet6_sysctl(IPV6CTL_FORWARDING) != 0) {
+               syslog(LOG_WARNING,
+                   "Kernel is configured as a router, not a host");
+               return 0;
+       }
+       return 1;
+}
diff -r c3ffa816454a -r 813fb46a9116 external/bsd/dhcpcd/dist/platform.h
--- a/external/bsd/dhcpcd/dist/platform.h       Mon Feb 06 12:13:44 2012 +0000
+++ b/external/bsd/dhcpcd/dist/platform.h       Mon Feb 06 15:56:58 2012 +0000
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2010 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2012 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -29,5 +29,6 @@
 #define PLATFORM_H
 
 char * hardware_platform(void);
+int check_ipv6(void);
 
 #endif



Home | Main Index | Thread Index | Old Index