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 Import dhcpcd-7.0.0-beta. Changes fro...



details:   https://anonhg.NetBSD.org/src/rev/1e7ffc800350
branches:  ROY
changeset: 455198:1e7ffc800350
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Mar 31 20:51:15 2017 +0000

description:
Import dhcpcd-7.0.0-beta. Changes from prior version include:

  *  source file locations reworked:
       dhcpcd source is in src
       dhcpcd hooks are in hooks
       compat is in compat
  *  README split into README.md and BUILDING.md
  *  internal routing is now protocol agnostic
  *  avoid using __packed and use compile time asserts instead
  *  addresses some alignment issues
  *  disable some ARP code on kernels which support RFC5227
  *  BSD IPv6 kernel settings are now updated to reflect dhcpcd config
  *  custom logger has been removed, syslog handles everything
     as such, the --logfile option has been removed as well.
     If you need better/earlier logging, get a better syslogger!
  *  distinfo and signed distinfo files are now available alongside
     release taraballs from this point onwards
  *  default DBDIR has changed from /var/db to /var/db/dhcpcd
  *  /etc/dhcpcd.duid moves to DBDIR/duid
  *  /etc/dhcpcd.secret moves to DBDIR/secret
  *  lease file names have dhcpcd removed from them as they are now
     inside a directory of the same name
  *  fixed issues with reject routes not working on some platforms
  *  improved nl80211 support on Linux for working out the SSID
  *  no longer request NTP by default in dhcpcd.conf
  *  BPF filtering vastly improved so dhcpcd only wake up on
     ARP or DHCP packets destined for it
  *  support for MUD URL (draft-ietf-opsawg-mud-05)
  *  if the kernel isn't doing DAD, don't insist on waiting for it
     to actually do it
  *  fix a potential crash where the DHCP or ARP states could be
     freed before the packet processing loop naturally breaks
  *  removed gateway and nogateway options
     (these can be controlled by the nooption directive which
     works for more than just gateways)
  *  removed ipv6ra_own and ipv6ra_own_default options
     (these can be controled by the ipv6rs/noipv6rs directive)
  *  fix a crash receiving SIGUSR1

diffstat:

 external/bsd/dhcpcd/dist/LICENSE                     |    23 +
 external/bsd/dhcpcd/dist/README.md                   |    91 +
 external/bsd/dhcpcd/dist/hooks/01-test               |     8 +
 external/bsd/dhcpcd/dist/hooks/02-dump               |     8 +
 external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant     |   119 +
 external/bsd/dhcpcd/dist/hooks/15-timezone           |    48 +
 external/bsd/dhcpcd/dist/hooks/20-resolv.conf        |   204 +
 external/bsd/dhcpcd/dist/hooks/29-lookup-hostname    |    40 +
 external/bsd/dhcpcd/dist/hooks/30-hostname           |   165 +
 external/bsd/dhcpcd/dist/hooks/50-ntp.conf           |   141 +
 external/bsd/dhcpcd/dist/hooks/50-ypbind.in          |    86 +
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in |   217 +
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in   |   387 +
 external/bsd/dhcpcd/dist/src/arp.c                   |   507 ++
 external/bsd/dhcpcd/dist/src/arp.h                   |   109 +
 external/bsd/dhcpcd/dist/src/auth.c                  |   669 +++
 external/bsd/dhcpcd/dist/src/auth.h                  |    93 +
 external/bsd/dhcpcd/dist/src/bpf.c                   |   662 +++
 external/bsd/dhcpcd/dist/src/bpf.h                   |    45 +
 external/bsd/dhcpcd/dist/src/common.c                |   256 +
 external/bsd/dhcpcd/dist/src/common.h                |   187 +
 external/bsd/dhcpcd/dist/src/control.c               |   423 ++
 external/bsd/dhcpcd/dist/src/control.h               |    64 +
 external/bsd/dhcpcd/dist/src/defs.h                  |    76 +
 external/bsd/dhcpcd/dist/src/dev.h                   |    60 +
 external/bsd/dhcpcd/dist/src/dhcp-common.c           |  1094 +++++
 external/bsd/dhcpcd/dist/src/dhcp-common.h           |   123 +
 external/bsd/dhcpcd/dist/src/dhcp.c                  |  3800 ++++++++++++++++++
 external/bsd/dhcpcd/dist/src/dhcp.h                  |   279 +
 external/bsd/dhcpcd/dist/src/dhcp6.c                 |  3762 +++++++++++++++++
 external/bsd/dhcpcd/dist/src/dhcp6.h                 |   241 +
 external/bsd/dhcpcd/dist/src/dhcpcd.8.in             |   797 +++
 external/bsd/dhcpcd/dist/src/dhcpcd.c                |  1983 +++++++++
 external/bsd/dhcpcd/dist/src/dhcpcd.conf             |    39 +
 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in        |   900 ++++
 external/bsd/dhcpcd/dist/src/dhcpcd.h                |   243 +
 external/bsd/dhcpcd/dist/src/duid.c                  |   161 +
 external/bsd/dhcpcd/dist/src/duid.h                  |    35 +
 external/bsd/dhcpcd/dist/src/eloop.c                 |   979 ++++
 external/bsd/dhcpcd/dist/src/eloop.h                 |   111 +
 external/bsd/dhcpcd/dist/src/if-bsd.c                |  1431 ++++++
 external/bsd/dhcpcd/dist/src/if-options.c            |  2617 ++++++++++++
 external/bsd/dhcpcd/dist/src/if-options.h            |   232 +
 external/bsd/dhcpcd/dist/src/if.c                    |   775 +++
 external/bsd/dhcpcd/dist/src/if.h                    |   204 +
 external/bsd/dhcpcd/dist/src/ipv4.c                  |   936 ++++
 external/bsd/dhcpcd/dist/src/ipv4.h                  |   146 +
 external/bsd/dhcpcd/dist/src/ipv4ll.c                |   511 ++
 external/bsd/dhcpcd/dist/src/ipv4ll.h                |    81 +
 external/bsd/dhcpcd/dist/src/ipv6.c                  |  2292 ++++++++++
 external/bsd/dhcpcd/dist/src/ipv6.h                  |   298 +
 external/bsd/dhcpcd/dist/src/ipv6nd.c                |  1683 +++++++
 external/bsd/dhcpcd/dist/src/ipv6nd.h                |   115 +
 external/bsd/dhcpcd/dist/src/route.c                 |   529 ++
 external/bsd/dhcpcd/dist/src/route.h                 |    92 +
 external/bsd/dhcpcd/dist/src/sa.c                    |   458 ++
 external/bsd/dhcpcd/dist/src/sa.h                    |    68 +
 external/bsd/dhcpcd/dist/src/script.c                |   793 +++
 external/bsd/dhcpcd/dist/src/script.h                |    37 +
 59 files changed, 32533 insertions(+), 0 deletions(-)

diffs (truncated from 32769 to 300 lines):

diff -r d8cd2b9cfefb -r 1e7ffc800350 external/bsd/dhcpcd/dist/LICENSE
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/LICENSE  Fri Mar 31 20:51:15 2017 +0000
@@ -0,0 +1,23 @@
+Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff -r d8cd2b9cfefb -r 1e7ffc800350 external/bsd/dhcpcd/dist/README.md
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/README.md        Fri Mar 31 20:51:15 2017 +0000
@@ -0,0 +1,91 @@
+# dhcpcd
+
+dhcpcd is a
+[DHCP](http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol) and a
+[DHCPv6](http://en.wikipedia.org/wiki/DHCPv6) client.
+It's also an IPv4LL (aka [ZeroConf](http://en.wikipedia.org/wiki/Zeroconf))
+client.
+In layman's terms, dhcpcd runs on your machine and silently configures your
+computer to work on the attached networks without trouble and mostly without
+configuration.
+
+If you're a desktop user then you may also be interested in
+[Network Configurator (dhcpcd-ui)](http://roy.marples.name/projects/dhcpcd-ui)
+which sits in the notification area and monitors the state of the network via
+dhcpcd.
+It also has a nice configuration dialog and the ability to enter a pass phrase
+for wireless networks.
+
+dhcpcd may not be the only daemon running that wants to configure DNS on the
+host, so it uses [openresolv](http://roy.marples.name/projects/openresolv)
+to ensure they can co-exist.
+
+See [BUILDING.md](BUILDING.md) for how to build dhcpcd.
+
+If you wish to file a support ticket or help out with development, please
+[visit the Development Area](https://dev.marples.name/project/profile/101/)
+or join the mailing list below.
+
+## Configuration
+
+You should read the
+[dhcpcd.conf man page](http://roy.marples.name/man/html5/dhcpcd.conf.html)
+and put your options into `/etc/dhcpcd.conf`.
+The default configuration file should work for most people just fine.
+Here it is, in case you lose it.
+
+```
+# A sample configuration for dhcpcd.
+# See dhcpcd.conf(5) for details.
+
+# Allow users of this group to interact with dhcpcd via the control socket.
+#controlgroup wheel
+
+# Inform the DHCP server of our hostname for DDNS.
+hostname
+
+# Use the hardware address of the interface for the Client ID.
+#clientid
+# or
+# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
+# Some non-RFC compliant DHCP servers do not reply with this set.
+# In this case, comment out duid and enable clientid above.
+duid
+
+# A list of options to request from the DHCP server.
+option domain_name_servers, domain_name, domain_search, host_name
+option classless_static_routes
+# Respect the network MTU.
+option interface_mtu
+
+# Most distributions have NTP support.
+#option ntp_servers
+
+# A ServerID is required by RFC2131.
+require dhcp_server_identifier
+
+# Generate Stable Private IPv6 Addresses instead of hardware based ones
+slaac private
+```
+
+The [dhcpcd man page](/man/html8/dhcpcd.html) has a lot of the same options and more, which only apply to calling dhcpcd from the command line.
+
+
+## Compatibility
+dhcpcd-5 is only fully command line compatible with dhcpcd-4
+For compatibility with older versions, use dhcpcd-4
+
+## Upgrading
+dhcpcd-7 defaults the database directory to `/var/db/dhcpcd` instead of
+`/var/db` and now stores dhcpcd.duid and dhcpcd.secret in there instead of
+in /etc.
+The Makefile `_confinstall` target will attempt to move the files correctly from
+the old locations to the new locations.
+Of course this won't work if dhcpcd-7 is packaged up, so packagers will need to
+install similar logic into their dhcpcd package.
+
+## ChangeLog
+We no longer supply a ChangeLog.
+However, you're more than welcome to read the
+[commit log](http://roy.marples.name/git/dhcpcd.git/log/) and
+[archived release annoucements](http://roy.marples.name/archives/dhcpcd-discuss/).
diff -r d8cd2b9cfefb -r 1e7ffc800350 external/bsd/dhcpcd/dist/hooks/01-test
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/01-test    Fri Mar 31 20:51:15 2017 +0000
@@ -0,0 +1,8 @@
+# Echo the interface flags, reason and message options
+
+if [ "$reason" = "TEST" ]; then
+       set | grep "^\(interface\|pid\|reason\|profile\|skip_hooks\)=" | sort
+       set | grep "^if\(carrier\|flags\|mtu\|wireless\|ssid\)=" | sort
+       set | grep "^\(new_\|old_\|nd[0-9]*_\)" | sort
+       exit 0
+fi
diff -r d8cd2b9cfefb -r 1e7ffc800350 external/bsd/dhcpcd/dist/hooks/02-dump
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/02-dump    Fri Mar 31 20:51:15 2017 +0000
@@ -0,0 +1,8 @@
+# Just echo our DHCP options we have
+
+case "$reason" in
+DUMP|DUMP6)
+       set | sed -ne 's/^new_//p' | sort
+       exit 0
+       ;;
+esac
diff -r d8cd2b9cfefb -r 1e7ffc800350 external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant  Fri Mar 31 20:51:15 2017 +0000
@@ -0,0 +1,119 @@
+# Start, reconfigure and stop wpa_supplicant per wireless interface.
+# This is needed because wpa_supplicant lacks hotplugging of any kind
+# and the user should not be expected to have to wire it into their system
+# if the base system doesn't do this itself.
+
+if [ -z "$wpa_supplicant_conf" ]; then
+       for x in \
+               /etc/wpa_supplicant/wpa_supplicant-"$interface".conf \
+               /etc/wpa_supplicant/wpa_supplicant.conf \
+               /etc/wpa_supplicant-"$interface".conf \
+               /etc/wpa_supplicant.conf \
+       ; do
+               if [ -s "$x" ]; then
+                       wpa_supplicant_conf="$x"
+                       break
+               fi
+       done
+fi
+: ${wpa_supplicant_conf:=/etc/wpa_supplicant.conf}
+
+wpa_supplicant_ctrldir()
+{
+       local dir
+
+       dir=$(key_get_value "[[:space:]]*ctrl_interface=" \
+               "$wpa_supplicant_conf")
+       dir=$(trim "$dir")
+       case "$dir" in
+       DIR=*)
+               dir=${dir##DIR=}
+               dir=${dir%%[[:space:]]GROUP=*}
+               dir=$(trim "$dir")
+               ;;
+       esac
+       printf %s "$dir"
+}
+
+wpa_supplicant_start()
+{
+       local dir err errn
+
+       # If the carrier is up, don't bother checking anything
+       [ "$ifcarrier" = "up" ] && return 0
+
+       # Pre flight checks
+       if [ ! -s "$wpa_supplicant_conf" ]; then
+               syslog warn \
+                       "$wpa_supplicant_conf does not exist"
+               syslog warn "not interacting with wpa_supplicant(8)"
+               return 1
+       fi
+       dir=$(wpa_supplicant_ctrldir)
+       if [ -z "$dir" ]; then
+               syslog warn \
+                       "ctrl_interface not defined in $wpa_supplicant_conf"
+               syslog warn "not interacting with wpa_supplicant(8)"
+               return 1
+       fi
+
+       wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 && return 0
+       syslog info "starting wpa_supplicant"
+       driver=${wpa_supplicant_driver:+-D}$wpa_supplicant_driver
+       err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" \
+           "$driver" 2>&1)
+       errn=$?
+       if [ $errn != 0 ]; then
+               syslog err "failed to start wpa_supplicant"
+               syslog err "$err"
+       fi
+       return $errn
+}
+
+wpa_supplicant_reconfigure()
+{
+       local dir err errn
+
+       dir=$(wpa_supplicant_ctrldir)
+       [ -z "$dir" ] && return 1
+       if ! wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1; then
+               wpa_supplicant_start
+               return $?
+       fi
+       syslog info "reconfiguring wpa_supplicant"
+       err=$(wpa_cli -p "$dir" -i "$interface" reconfigure 2>&1)
+       errn=$?
+       if [ $errn != 0 ]; then
+               syslog err "failed to reconfigure wpa_supplicant"
+               syslog err "$err"
+       fi
+       return $errn
+}
+
+wpa_supplicant_stop()
+{
+       local dir err errn
+
+       dir=$(wpa_supplicant_ctrldir)
+       [ -z "$dir" ] && return 1
+       wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 || return 0
+       syslog info "stopping wpa_supplicant"
+       err=$(wpa_cli -i"$interface" terminate 2>&1)
+       errn=$?
+       if [ $errn != 0 ]; then
+               syslog err "failed to start wpa_supplicant"
+               syslog err "$err"
+       fi
+       return $errn
+}
+
+if [ "$ifwireless" = "1" ] && \
+    type wpa_supplicant >/dev/null 2>&1 && \
+    type wpa_cli >/dev/null 2>&1
+then
+       case "$reason" in
+       PREINIT)        wpa_supplicant_start;;
+       RECONFIGURE)    wpa_supplicant_reconfigure;;
+       DEPARTED)       wpa_supplicant_stop;;
+       esac
+fi
diff -r d8cd2b9cfefb -r 1e7ffc800350 external/bsd/dhcpcd/dist/hooks/15-timezone
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/15-timezone        Fri Mar 31 20:51:15 2017 +0000
@@ -0,0 +1,48 @@
+# Configure timezone
+
+: ${localtime:=/etc/localtime}
+
+set_zoneinfo()
+{
+       local zoneinfo_dir= zone_file=
+
+       [ -z "$new_tzdb_timezone" ] && return 0
+
+       for d in \
+               /usr/share/zoneinfo     \
+               /usr/lib/zoneinfo       \
+               /var/share/zoneinfo     \
+               /var/zoneinfo           \
+       ; do
+               if [ -d "$d" ]; then
+                       zoneinfo_dir="$d"
+                       break
+               fi
+       done
+
+       if [ -z "$zoneinfo_dir" ]; then
+               syslog warning "timezone directory not found"
+               return 1
+       fi
+



Home | Main Index | Thread Index | Old Index