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-7.0.0-rc2 with the fo...
details: https://anonhg.NetBSD.org/src/rev/83d2dcca7179
branches: trunk
changeset: 356341:83d2dcca7179
user: roy <roy%NetBSD.org@localhost>
date: Tue Sep 19 19:16:48 2017 +0000
description:
Import dhcpcd-7.0.0-rc2 with the following changes:
* dhcp: fixed classless static routes
* prefix delegation: build routes after assigning addresses
* dhcp: on lease expiration, discover only when carrier
* ip6: fix potential segfault when lifetime overflows
* dhcp: fix reporting of DNS encoded SIP servers
* dhcp6: fix unicast in non master mode
diffstat:
external/bsd/dhcpcd/dist/Makefile.inc | 1 +
external/bsd/dhcpcd/dist/README.md | 12 +-
external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in | 29 +-
external/bsd/dhcpcd/dist/src/Makefile | 3 +
external/bsd/dhcpcd/dist/src/arp.c | 69 +-
external/bsd/dhcpcd/dist/src/arp.h | 12 +-
external/bsd/dhcpcd/dist/src/auth.c | 4 +-
external/bsd/dhcpcd/dist/src/common.c | 3 +-
external/bsd/dhcpcd/dist/src/defs.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcp-common.c | 85 +-
external/bsd/dhcpcd/dist/src/dhcp.h | 1 +
external/bsd/dhcpcd/dist/src/dhcp6.c | 1007 ++++++++++++-------
external/bsd/dhcpcd/dist/src/dhcp6.h | 65 +-
external/bsd/dhcpcd/dist/src/dhcpcd.8.in | 11 +-
external/bsd/dhcpcd/dist/src/eloop.c | 18 +-
external/bsd/dhcpcd/dist/src/eloop.h | 4 +-
external/bsd/dhcpcd/dist/src/if-bsd.c | 21 +-
external/bsd/dhcpcd/dist/src/if-linux.c | 5 +-
external/bsd/dhcpcd/dist/src/if-options.h | 2 +
external/bsd/dhcpcd/dist/src/if.c | 22 +
external/bsd/dhcpcd/dist/src/if.h | 1 +
external/bsd/dhcpcd/dist/src/ipv4.c | 107 +-
external/bsd/dhcpcd/dist/src/ipv4.h | 2 -
external/bsd/dhcpcd/dist/src/ipv4ll.c | 1 -
external/bsd/dhcpcd/dist/src/ipv6.c | 282 +++--
external/bsd/dhcpcd/dist/src/ipv6.h | 91 +-
external/bsd/dhcpcd/dist/src/ipv6nd.c | 125 +-
external/bsd/dhcpcd/dist/src/ipv6nd.h | 32 +-
external/bsd/dhcpcd/dist/src/sa.c | 8 +-
29 files changed, 1155 insertions(+), 870 deletions(-)
diffs (truncated from 3565 to 300 lines):
diff -r 4371597d37da -r 83d2dcca7179 external/bsd/dhcpcd/dist/Makefile.inc
--- a/external/bsd/dhcpcd/dist/Makefile.inc Tue Sep 19 17:26:45 2017 +0000
+++ b/external/bsd/dhcpcd/dist/Makefile.inc Tue Sep 19 19:16:48 2017 +0000
@@ -9,6 +9,7 @@
CC?= cc
INSTALL?= install
+LINT?= lint
SED?= sed
HOST_SH?= /bin/sh
diff -r 4371597d37da -r 83d2dcca7179 external/bsd/dhcpcd/dist/README.md
--- a/external/bsd/dhcpcd/dist/README.md Tue Sep 19 17:26:45 2017 +0000
+++ b/external/bsd/dhcpcd/dist/README.md Tue Sep 19 19:16:48 2017 +0000
@@ -52,10 +52,18 @@
# In this case, comment out duid and enable clientid above.
duid
+# Persist interface configuration when dhcpcd exits.
+persistent
+
+# Rapid commit support.
+# Safe to enable by default because it requires the equivalent option set
+# on the server to actually work.
+option rapid_commit
+
# 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.
+# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# Most distributions have NTP support.
@@ -88,4 +96,4 @@
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/).
+[archived release announcements](http://roy.marples.name/archives/dhcpcd-discuss/).
diff -r 4371597d37da -r 83d2dcca7179 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in Tue Sep 19 17:26:45 2017 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in Tue Sep 19 19:16:48 2017 +0000
@@ -3,14 +3,18 @@
# Handy variables and functions for our hooks to use
case "$reason" in
+ PREINIT|CARRIER|NOCARRIER|DEPARTED|STOPPED|DUMP|TEST)
+ ifsuffix=;; #unset
ROUTERADVERT)
ifsuffix=".ra";;
INFORM6|BOUND6|RENEW6|REBIND6|REBOOT6|EXPIRE6|RELEASE6|STOP6)
ifsuffix=".dhcp6";;
IPV4LL)
ifsuffix=".ipv4ll";;
+ INFORM|BOUND|RENEW|REBIND|REBOOT|EXPIRE|RELEASE|STOP)
+ ifsuffix=".dhcp";;
*)
- ifsuffix=".dhcp";;
+ ifsuffix=;; #unset
esac
ifname="$interface$ifsuffix"
@@ -33,10 +37,10 @@
for i do
case " $result " in
*" $i "*);;
- *) result="$result $i";;
+ *) result="$result${result:+ }$i";;
esac
done
- echo "${result# *}"
+ echo "$result"
}
# List interface config files in a directory.
@@ -198,8 +202,7 @@
fi
}
-# Check for a valid domain name as per RFC1123 with the exception of
-# allowing - and _ as they seem to be widely used.
+# Check for a valid name as per RFC952 and RFC1123 section 2.1
valid_domainname()
{
local name="$1" label
@@ -211,14 +214,12 @@
[ -z "$label" -o ${#label} -gt 63 ] && return 1
case "$label" in
-*|_*|*-|*_) return 1;;
- # some sh require - as the first or last character in the class
- # when matching it
*[![:alnum:]_-]*) return 1;;
+ "$name") return 0;;
esac
- [ "$name" = "${name#*.}" ] && break
name="${name#*.}"
done
- return 0
+ return 0
}
valid_domainname_list()
@@ -231,16 +232,6 @@
return 0
}
-# Check for a valid path
-valid_path()
-{
-
- case "$@" in
- *[![:alnum:]#%+-_:\.,@~\\/\[\]=\ ]*) return 1;;
- esac
- 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.
diff -r 4371597d37da -r 83d2dcca7179 external/bsd/dhcpcd/dist/src/Makefile
--- a/external/bsd/dhcpcd/dist/src/Makefile Tue Sep 19 17:26:45 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/Makefile Tue Sep 19 19:16:48 2017 +0000
@@ -71,6 +71,9 @@
${PROG}: ${DEPEND} ${OBJS}
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
+lint:
+ ${LINT} -Suz ${CPPFLAGS} ${SRCS} ${PCRYPT_SRCS} ${PCOMPAT_SRCS}
+
_embeddedinstall: ${DHCPCD_DEFS}
${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
${INSTALL} -m ${CONFMODE} ${DHCPCD_DEFS} ${DESTDIR}${LIBEXECDIR}
diff -r 4371597d37da -r 83d2dcca7179 external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c Tue Sep 19 17:26:45 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c Tue Sep 19 19:16:48 2017 +0000
@@ -35,7 +35,6 @@
#include <netinet/if_ether.h>
#include <errno.h>
-#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -53,7 +52,7 @@
#include "ipv4ll.h"
#include "logerr.h"
-#if defined(ARP) && (!defined(KERNEL_RFC5227) || defined(ARPING))
+#if defined(ARP)
#define ARP_LEN \
(sizeof(struct arphdr) + (2 * sizeof(uint32_t)) + (2 * HWADDR_LEN))
@@ -282,8 +281,6 @@
astate->iface->name, inet_ntoa(astate->addr));
arp_probe1(astate);
}
-#else /* !ARP */
-#define arp_close(ifp) {}
#endif /* ARP */
static void
@@ -305,11 +302,6 @@
struct arp_state *astate = arg;
struct interface *ifp = astate->iface;
-#ifdef KERNEL_RFC5227
- /* We rely on the kernel announcing correctly.
- * As the timings are not random we can callback safely. */
- astate->claims++;
-#else
if (++astate->claims < ANNOUNCE_NUM)
logdebugx("%s: ARP announcing %s (%d of %d), "
"next in %d.0 seconds",
@@ -321,28 +313,81 @@
astate->claims, ANNOUNCE_NUM);
if (arp_request(ifp, astate->addr.s_addr, astate->addr.s_addr) == -1)
logerr(__func__);
-#endif
eloop_timeout_add_sec(ifp->ctx->eloop, ANNOUNCE_WAIT,
astate->claims < ANNOUNCE_NUM ? arp_announce1 : arp_announced,
astate);
}
+/*
+ * XXX FIXME
+ * Kernels supporting RFC5227 will announce the address when it's
+ * added.
+ * dhcpcd should not announce when this happens, nor need to open
+ * a BPF socket for it.
+ * Also, an address might be added to a non preferred inteface when
+ * the same address exists on a preferred one so we need to instruct
+ * the kernel not to announce the address somehow.
+ */
+
void
arp_announce(struct arp_state *astate)
{
+ struct iarp_state *state;
+ struct interface *ifp;
+ struct arp_state *a2;
+ int r;
-#ifndef KERNEL_RFC5227
if (arp_open(astate->iface) == -1) {
logerr(__func__);
return;
}
-#endif
+
+ /* Cancel any other ARP announcements for this address. */
+ TAILQ_FOREACH(ifp, astate->iface->ctx->ifaces, next) {
+ state = ARP_STATE(ifp);
+ if (state == NULL)
+ continue;
+ TAILQ_FOREACH(a2, &state->arp_states, next) {
+ if (astate == a2 ||
+ a2->addr.s_addr != astate->addr.s_addr)
+ continue;
+ r = eloop_timeout_delete(a2->iface->ctx->eloop,
+ a2->claims < ANNOUNCE_NUM
+ ? arp_announce1 : arp_announced,
+ a2);
+ if (r == -1)
+ logerr(__func__);
+ else if (r != 0)
+ logdebugx("%s: ARP announcement "
+ "of %s cancelled",
+ a2->iface->name,
+ inet_ntoa(a2->addr));
+ }
+ }
astate->claims = 0;
arp_announce1(astate);
}
void
+arp_announceaddr(struct dhcpcd_ctx *ctx, struct in_addr *ia)
+{
+ struct interface *ifp;
+ struct arp_state *astate;
+
+ TAILQ_FOREACH(ifp, ctx->ifaces, next) {
+ if (ipv4_iffindaddr(ifp, ia, NULL))
+ break;
+ }
+ if (ifp == NULL)
+ return;
+
+ astate = arp_find(ifp, ia);
+ if (astate != NULL)
+ arp_announce(astate);
+}
+
+void
arp_report_conflicted(const struct arp_state *astate,
const struct arp_msg *amsg)
{
diff -r 4371597d37da -r 83d2dcca7179 external/bsd/dhcpcd/dist/src/arp.h
--- a/external/bsd/dhcpcd/dist/src/arp.h Tue Sep 19 17:26:45 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.h Tue Sep 19 19:16:48 2017 +0000
@@ -85,25 +85,21 @@
#define ARP_CSTATE(ifp) \
((const struct iarp_state *)(ifp)->if_data[IF_DATA_ARP])
-#if defined(ARP) && (!defined(KERNEL_RFC5227) || defined(ARPING))
+#ifdef ARP
int arp_open(struct interface *);
ssize_t arp_request(const struct interface *, in_addr_t, in_addr_t);
void arp_probe(struct arp_state *);
void arp_close(struct interface *);
-#endif
-
-#ifdef ARP
void arp_report_conflicted(const struct arp_state *, const struct arp_msg *);
struct arp_state *arp_new(struct interface *, const struct in_addr *);
struct arp_state *arp_find(struct interface *, const struct in_addr *);
void arp_announce(struct arp_state *);
+void arp_announceaddr(struct dhcpcd_ctx *, struct in_addr *);
void arp_cancel(struct arp_state *);
void arp_free(struct arp_state *);
void arp_free_but(struct arp_state *);
void arp_drop(struct interface *);
void arp_handleifa(int, struct ipv4_addr *);
-#else
-#define arp_drop(a) {}
-#endif
-#endif
+#endif /* ARP */
+#endif /* ARP_H */
diff -r 4371597d37da -r 83d2dcca7179 external/bsd/dhcpcd/dist/src/auth.c
--- a/external/bsd/dhcpcd/dist/src/auth.c Tue Sep 19 17:26:45 2017 +0000
+++ b/external/bsd/dhcpcd/dist/src/auth.c Tue Sep 19 19:16:48 2017 +0000
@@ -50,7 +50,7 @@
#ifndef htonll
#if (BYTE_ORDER == LITTLE_ENDIAN)
#define htonll(x) ((uint64_t)htonl((uint32_t)((x) >> 32)) | \
- (uint64_t)htonl((uint32_t)((x) & 0xffffffff)) << 32)
Home |
Main Index |
Thread Index |
Old Index