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-6.2.1 with the folowi...



details:   https://anonhg.NetBSD.org/src/rev/b5bc6562f95a
branches:  trunk
changeset: 326001:b5bc6562f95a
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Jan 15 20:36:31 2014 +0000

description:
Import dhcpcd-6.2.1 with the folowing changes:

 * on BSD only flush RA routers and prefixes when trying to own them.
 * Mark some data locations as read only and fix a build issue.
 * Fix some possible NULL dereferences, CID 1153963.
 * Fix CID: 1153964 and 1153966
 * Add support for RFC3495 DHCP option for CableLabs Clients.
   Note that for the TSP suboption 3 we only support the FQDN encoding.
 * Init system detection moved to dhcpcd-run-hooks(8)
 * Fix compile errors and warnings with IPv6 disabled.

diffstat:

 external/bsd/dhcpcd/dist/bpf.c                   |   5 +-
 external/bsd/dhcpcd/dist/defs.h                  |   4 +-
 external/bsd/dhcpcd/dist/dhcp-common.c           |  12 ++-
 external/bsd/dhcpcd/dist/dhcp6.c                 |  10 +-
 external/bsd/dhcpcd/dist/dhcpcd-definitions.conf |  30 +++++++-
 external/bsd/dhcpcd/dist/dhcpcd-embedded.c       |  19 ++++-
 external/bsd/dhcpcd/dist/dhcpcd-embedded.h       |   8 +-
 external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in    |   4 +-
 external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in     |  91 ++++++++++++++++++++++-
 external/bsd/dhcpcd/dist/platform-bsd.c          |  16 ++-
 10 files changed, 170 insertions(+), 29 deletions(-)

diffs (truncated from 407 to 300 lines):

diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/bpf.c
--- a/external/bsd/dhcpcd/dist/bpf.c    Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/bpf.c    Wed Jan 15 20:36:31 2014 +0000
@@ -1,9 +1,9 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: bpf.c,v 1.1.1.6 2014/01/03 22:10:42 roy Exp $");
+ __RCSID("$NetBSD: bpf.c,v 1.1.1.7 2014/01/15 20:36:31 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2013 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2014 Roy Marples <roy%marples.name@localhost>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
  */
 
 #include <sys/types.h>
+#include <sys/time.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h   Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h   Wed Jan 15 20:36:31 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.1.1.33 2014/01/03 22:10:44 roy Exp $ */
+/* $NetBSD: defs.h,v 1.1.1.34 2014/01/15 20:36:32 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "6.2.0"
+#define VERSION                        "6.2.1"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/dhcp-common.c
--- a/external/bsd/dhcpcd/dist/dhcp-common.c    Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp-common.c    Wed Jan 15 20:36:31 2014 +0000
@@ -1,9 +1,9 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp-common.c,v 1.1.1.2 2014/01/03 22:10:42 roy Exp $");
+ __RCSID("$NetBSD: dhcp-common.c,v 1.1.1.3 2014/01/15 20:36:31 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2013 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2014 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -355,9 +355,15 @@
        return (dl < sz ? 0 : sz);
 }
 
+#ifdef INET6
+#define PO_IFNAME
+#else
+#define PO_IFNAME __unused
+#endif
+
 ssize_t
 print_option(char *s, ssize_t len, int type, int dl, const uint8_t *data,
-    const char *ifname)
+    PO_IFNAME const char *ifname)
 {
        const uint8_t *e, *t;
        uint16_t u16;
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/dhcp6.c
--- a/external/bsd/dhcpcd/dist/dhcp6.c  Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp6.c  Wed Jan 15 20:36:31 2014 +0000
@@ -1,9 +1,9 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp6.c,v 1.1.1.5 2014/01/03 22:10:43 roy Exp $");
+ __RCSID("$NetBSD: dhcp6.c,v 1.1.1.6 2014/01/15 20:36:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2013 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2014 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -71,7 +71,7 @@
 //#define VENDOR_SPLIT
 
 static int sock = -1;
-static struct in6_addr in6addr_linklocal_alldhcp =
+static const struct in6_addr in6addr_linklocal_alldhcp =
     IN6ADDR_LINKLOCAL_ALLDHCP_INIT;
 static struct sockaddr_in6 from;
 static struct msghdr sndhdr;
@@ -434,6 +434,10 @@
                        ml = state->new_len;
                }
                si = dhcp6_getmoption(D6_OPTION_SERVERID, m, ml);
+               if (si == NULL) {
+                       errno = ESRCH;
+                       return -1;
+               }
                len += sizeof(*si) + ntohs(si->len);
                /* FALLTHROUGH */
        case DH6S_REBIND:
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/dhcpcd-definitions.conf
--- a/external/bsd/dhcpcd/dist/dhcpcd-definitions.conf  Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-definitions.conf  Wed Jan 15 20:36:31 2014 +0000
@@ -1,4 +1,7 @@
-# $NetBSD: dhcpcd-definitions.conf,v 1.1.1.1 2014/01/03 22:10:43 roy Exp $
+# $NetBSD: dhcpcd-definitions.conf,v 1.1.1.2 2014/01/15 20:36:32 roy Exp $
+
+# Copyright (c) 2006-2014 Roy Marples
+# All rights reserved
 
 # DHCP option definitions for dhcpcd(8)
 # These are used to translate DHCP options into shell variables
@@ -130,6 +133,31 @@
 # DHCP Session Initiated Protocol Servers, RFC3361
 define 120     rfc3361                 sip_server
 
+# DHCP CableLabs Client, RFC3495
+define 122     encap                   tsp
+encap 1                ipaddress               dhcp_server
+encap 2                ipaddress               dhcp_secondary_server
+encap 3                embed                   provisioning_server
+embed          byte                    type
+embed          domain                  fqdn
+#embed         ipaddress               address
+# We only support FQDN in option 3 out of the box which is type 0.
+# Type 1 is an ipaddress, but we currently have no logic to change embedded
+# type based on the content of an option.
+# To swap it out, just comment / uncomment the above two lines to your liking.
+# However, ensure that only one is uncommented.
+encap 4                embed                   as_req_as_rep_backoff
+embed          uint32                  nominal
+embed          uint32                  maximum
+embed          uint32                  retry
+encap 5                embed                   ap_req_ap_rep_backoff
+embed          uint32                  nominal
+embed          uint32                  maximum
+embed          uint32                  retry
+encap 6                domain                  kerberos_realm
+encap 7                byte                    ticket_granting_server_utilization
+encap 8                byte                    provisioning_timer
+
 # DHCP Vendor-Identifying Vendor Options, RFC3925
 define 124     binhex                  vivco
 define 125     embed                   vivso
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/dhcpcd-embedded.c
--- a/external/bsd/dhcpcd/dist/dhcpcd-embedded.c        Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-embedded.c        Wed Jan 15 20:36:31 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd-embedded.c,v 1.1.1.1 2014/01/03 22:10:42 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd-embedded.c,v 1.1.1.2 2014/01/15 20:36:31 roy Exp $");
 
 /*
  * DO NOT EDIT
@@ -133,6 +133,23 @@
 "define 118 ipaddress subnet_selection",
 "define 119 domain domain_search",
 "define 120 rfc3361 sip_server",
+"define 122 encap tsp",
+"encap 1 ipaddress dhcp_server",
+"encap 2 ipaddress dhcp_secondary_server",
+"encap 3 embed provisioning_server",
+"embed byte type",
+"embed domain fqdn",
+"encap 4 embed as_req_as_rep_backoff",
+"embed uint32 nominal",
+"embed uint32 maximum",
+"embed uint32 retry",
+"encap 5 embed ap_req_ap_rep_backoff",
+"embed uint32 nominal",
+"embed uint32 maximum",
+"embed uint32 retry",
+"encap 6 domain kerberos_realm",
+"encap 7 byte ticket_granting_server_utilization",
+"encap 8 byte provisioning_timer",
 "define 124 binhex vivco",
 "define 125 embed vivso",
 "embed uint32 enterprise_number",
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/dhcpcd-embedded.h
--- a/external/bsd/dhcpcd/dist/dhcpcd-embedded.h        Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-embedded.h        Wed Jan 15 20:36:31 2014 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: dhcpcd-embedded.h,v 1.1.1.1 2014/01/03 22:10:44 roy Exp $ */
+/* $NetBSD: dhcpcd-embedded.h,v 1.1.1.2 2014/01/15 20:36:32 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2013 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2014 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 
-#define INITDEFINES          95
+#define INITDEFINES          96
 #define INITDEFINE6S         37
 
-extern const char *dhcpcd_embedded_conf[];
+extern const char * const dhcpcd_embedded_conf[];
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in
--- a/external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in     Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in     Wed Jan 15 20:36:31 2014 +0000
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2013 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2014 Roy Marples <roy%marples.name@localhost>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -28,4 +28,4 @@
 #define INITDEFINES    @INITDEFINES@
 #define INITDEFINE6S   @INITDEFINE6S@
 
-extern const char *dhcpcd_embedded_conf[];
+extern const char * const dhcpcd_embedded_conf[];
diff -r 7d216e08e3bb -r b5bc6562f95a external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
--- a/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in      Wed Jan 15 16:53:32 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in      Wed Jan 15 20:36:31 2014 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: dhcpcd-run-hooks.in,v 1.1.1.15 2014/01/03 22:10:44 roy Exp $
+# $NetBSD: dhcpcd-run-hooks.in,v 1.1.1.16 2014/01/15 20:36:32 roy Exp $
 
 # dhcpcd client configuration script 
 
@@ -20,6 +20,7 @@
 signature_base_end="# End of dhcpcd"
 signature_end="$signature_base_end $from $ifname"
 state_dir=@RUNDIR@/dhcpcd
+_detected_init=false
 
 : ${if_up:=false}
 : ${if_down:=false}
@@ -195,31 +196,113 @@
        return 0
 }
 
+# With the advent of alternative init systems, it's possible to have
+# more than one installed. So we need to try and guess what one we're
+# using unless overriden by configure.
+detect_init()
+{
+       _service_exists="@SERVICEEXISTS@"
+       _service_cmd="@SERVICECMD@"
+       _service_status="@SERVICESTATUS@"
+
+       [ -n "$_service_cmd" ] && return 0
+
+       if ${_detected_init}; then
+               [ -n "$_service_cmd" ]
+               return $?
+       fi
+
+       # Detect the running init system.
+       # As systemd and OpenRC can be installed on top of legacy init
+       # systems we try to detect them first.
+       _service_status=
+       if [ -x /bin/systemctl -a -S /run/systemd/private ]; then
+               _service_exists="/bin/systemctl --quiet is-enabled \$1.service"
+               _service_status="/bin/systemctl --quiet is-active \$1.service"
+               _service_cmd="/bin/systemctl \$2 \$1.service"
+       elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then
+               _service_exists="/usr/bin/systemctl --quiet is-enabled \$1.service"
+               _service_status="/usr/bin/systemctl --quiet is-active \$1.service"
+               _service_cmd="/usr/bin/systemctl \$2 \$1.service"
+       elif [ -x /sbin/rc-service -a \
+           -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ]
+       then
+               _service_exists="/sbin/rc-service -e \$1"
+               _service_cmd="/sbin/rc-service \$1 -- -D \$2"
+       elif [ -x /usr/sbin/invoke-rc.d ]; then
+               _service_exists="/usr/sbin/invoke-rc.d --query --quiet \$1 start >/dev/null 2>&1 || [ \$? = 104 ]"
+               _service_cmd="/usr/sbin/invoke-rc.d \$1 \$2"
+       elif [ -x /sbin/service ]; then
+               _service_exists="/sbin/service \$1 >/dev/null 2>&1"
+               _service_cmd="/sbin/service \$1 \$2"
+       elif [ -e /etc/slackware-version -a -d /etc/rc.d ]; then
+               _service_exists="[ -x /etc/rc.d/rc.\$1 ]"
+               _service_cmd="/etc/rc.d/rc.\$1 \$2"
+               _service_status="/etc/rc.d/rc.\$1 status 1>/dev/null 2>&1"
+       else
+               for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do
+                       if [ -d $x ]; then
+                               _service_exists="[ -x $x/\$1 ]"
+                               _service_cmd="$x/\$1 \$2"
+                               break
+                       fi
+               done



Home | Main Index | Thread Index | Old Index