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/src Update to dhcpcd-9.1.3 with the...
details: https://anonhg.NetBSD.org/src/rev/8a756e53a70f
branches: trunk
changeset: 973481:8a756e53a70f
user: roy <roy%NetBSD.org@localhost>
date: Thu Jul 02 13:57:40 2020 +0000
description:
Update to dhcpcd-9.1.3 with the following changes:
* inet6: Add support for reporting Mobile IPv6 RA's
* inet6: Report RA Proxy flag if set
* BSD: Allow non NetBSD and OpenBSD to set IN6_IFF_AUTOCONF
* privsep: Don't handle any signals meant for the main process
* eloop: Try and survive a signal storm
* dhcpcd: Add an option to poll the interface carrier state
* script: Make visible some link level parameters to lease dumping
* inet6: Don't regen temp addresses we didn't add
* privsep: Don't limit file writes if logging to a file
* DHCP6: Fix lease timings with nodelay option
diffstat:
external/bsd/dhcpcd/dist/src/common.h | 2 +
external/bsd/dhcpcd/dist/src/defs.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c | 8 +-
external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in | 8 +-
external/bsd/dhcpcd/dist/src/dhcpcd.h | 4 -
external/bsd/dhcpcd/dist/src/eloop.c | 63 +++++----------
external/bsd/dhcpcd/dist/src/if-options.h | 2 +
external/bsd/dhcpcd/dist/src/if.c | 102 +++++++++++++++++++-----
external/bsd/dhcpcd/dist/src/if.h | 5 +
external/bsd/dhcpcd/dist/src/logerr.h | 2 +
external/bsd/dhcpcd/dist/src/privsep-bpf.c | 5 +-
external/bsd/dhcpcd/dist/src/privsep-control.c | 5 +-
external/bsd/dhcpcd/dist/src/privsep-inet.c | 5 +-
external/bsd/dhcpcd/dist/src/privsep-root.c | 28 +-----
15 files changed, 141 insertions(+), 102 deletions(-)
diffs (truncated from 532 to 300 lines):
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/common.h
--- a/external/bsd/dhcpcd/dist/src/common.h Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.h Thu Jul 02 13:57:40 2020 +0000
@@ -31,6 +31,7 @@
#include <sys/param.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
@@ -43,6 +44,7 @@
#define ELOOP_IPV6ND 6
#define ELOOP_IPV6RA_EXPIRE 7
#define ELOOP_DHCP6 8
+#define ELOOP_IF 9
#ifndef HOSTNAME_MAX_LEN
#define HOSTNAME_MAX_LEN 250 /* 255 - 3 (FQDN) - 2 (DNS enc) */
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h Thu Jul 02 13:57:40 2020 +0000
@@ -29,7 +29,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "9.1.2"
+#define VERSION "9.1.3"
#ifndef PRIVSEP_USER
# define PRIVSEP_USER "_" PACKAGE
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c Thu Jul 02 13:57:40 2020 +0000
@@ -68,7 +68,7 @@
"definend 2 binhex target_address\n"
"definend 3 index embed prefix_information\n"
"embed byte length\n"
-"embed bitflags=LA flags\n"
+"embed bitflags=LAH flags\n"
"embed uint32 vltime\n"
"embed uint32 pltime\n"
"embed uint32 reserved\n"
@@ -301,7 +301,7 @@
"definend 2 binhex target_address\n"
"definend 3 index embed prefix_information\n"
"embed byte length\n"
-"embed bitflags=LA flags\n"
+"embed bitflags=LAH flags\n"
"embed uint32 vltime\n"
"embed uint32 pltime\n"
"embed uint32 reserved\n"
@@ -309,6 +309,10 @@
"definend 5 embed mtu\n"
"embed uint16 reserved\n"
"embed uint32 mtu\n"
+"definend 8 embed homeagent_information\n"
+"embed uint16 reserved\n"
+"embed uint16 preference\n"
+"embed uint16 lifetime\n"
"definend 25 index embed rdnss\n"
"embed uint16 reserved\n"
"embed uint32 lifetime\n"
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
--- a/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h Thu Jul 02 13:57:40 2020 +0000
@@ -31,7 +31,7 @@
#define INITDEFINE6S 14
#else
#define INITDEFINES 124
-#define INITDEFINENDS 6
+#define INITDEFINENDS 7
#define INITDEFINE6S 69
#endif
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in Thu Jul 02 13:57:40 2020 +0000
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd May 12, 2020
+.Dd June 18, 2020
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
@@ -595,6 +595,12 @@
detects an address added to a point to point interface (PPP, TUN, etc) then
it will set the listed DHCP options to the destination address of the
interface.
+.It Ic poll Op Ar time
+Polls the interface every
+.Ar time
+milliseconds (default of 100) to check flags and carrier status.
+This option should only be used if the driver does not report link state
+changes but can report the link state.
.It Ic profile Ar name
Subsequent options are only parsed for this profile
.Ar name .
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/dhcpcd.h
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.h Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.h Thu Jul 02 13:57:40 2020 +0000
@@ -66,10 +66,6 @@
#define IF_DATA_DHCP6 6
#define IF_DATA_MAX 7
-/* If the interface does not support carrier status (ie PPP),
- * dhcpcd can poll it for the relevant flags periodically */
-#define IF_POLL_UP 100 /* milliseconds */
-
#ifdef __QNX__
/* QNX carries defines for, but does not actually support PF_LINK */
#undef IFLR_ACTIVE
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/eloop.c
--- a/external/bsd/dhcpcd/dist/src/eloop.c Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/eloop.c Thu Jul 02 13:57:40 2020 +0000
@@ -93,6 +93,14 @@
#endif
/*
+ * Allow a backlog of signals.
+ * If you use many eloops in the same process, they should all
+ * use the same signal handler or have the signal handler unset.
+ * Otherwise the signal might not behave as expected.
+ */
+#define ELOOP_NSIGNALS 5
+
+/*
* time_t is a signed integer of an unspecified size.
* To adjust for time_t wrapping, we need to work the maximum signed
* value and use that as a maximum.
@@ -133,8 +141,6 @@
TAILQ_HEAD (timeout_head, eloop_timeout) timeouts;
struct timeout_head free_timeouts;
- void (*timeout0)(void *);
- void *timeout0_arg;
const int *signals;
size_t signals_len;
void (*signal_cb)(int, void *);
@@ -517,17 +523,6 @@
(unsigned int)seconds, (unsigned int)nseconds, callback, arg);
}
-static int
-eloop_timeout_add_now(struct eloop *eloop,
- void (*callback)(void *), void *arg)
-{
-
- assert(eloop->timeout0 == NULL);
- eloop->timeout0 = callback;
- eloop->timeout0_arg = arg;
- return 0;
-}
-
int
eloop_q_timeout_delete(struct eloop *eloop, int queue,
void (*callback)(void *), void *arg)
@@ -582,32 +577,22 @@
eloop->signal_cb_ctx = signal_cb_ctx;
}
-struct eloop_siginfo {
- int sig;
- struct eloop *eloop;
-};
-static struct eloop_siginfo _eloop_siginfo;
-static struct eloop *_eloop;
-
-static void
-eloop_signal1(void *arg)
-{
- struct eloop_siginfo *si = arg;
-
- si->eloop->signal_cb(si->sig, si->eloop->signal_cb_ctx);
-}
+static volatile int _eloop_sig[ELOOP_NSIGNALS];
+static volatile size_t _eloop_nsig;
static void
eloop_signal3(int sig, __unused siginfo_t *siginfo, __unused void *arg)
{
- /* So that we can operate safely under a signal we instruct
- * eloop to pass a copy of the siginfo structure to handle_signal1
- * as the very first thing to do. */
- _eloop_siginfo.eloop = _eloop;
- _eloop_siginfo.sig = sig;
- eloop_timeout_add_now(_eloop_siginfo.eloop,
- eloop_signal1, &_eloop_siginfo);
+ if (_eloop_nsig == __arraycount(_eloop_sig)) {
+#ifdef ELOOP_DEBUG
+ fprintf(stderr, "%s: signal storm, discarding signal %d\n",
+ __func__, sig);
+#endif
+ return;
+ }
+
+ _eloop_sig[_eloop_nsig++] = sig;
}
int
@@ -628,7 +613,6 @@
if (sigprocmask(SIG_SETMASK, &newset, oldset) == -1)
return -1;
- _eloop = eloop;
sigemptyset(&sa.sa_mask);
for (i = 0; i < eloop->signals_len; i++) {
@@ -711,7 +695,6 @@
int n;
struct eloop_event *e;
struct eloop_timeout *t;
- void (*t0)(void *);
struct timespec ts, *tsp;
assert(eloop != NULL);
@@ -720,11 +703,9 @@
if (eloop->exitnow)
break;
- /* Run all timeouts first. */
- if (eloop->timeout0) {
- t0 = eloop->timeout0;
- eloop->timeout0 = NULL;
- t0(eloop->timeout0_arg);
+ if (_eloop_nsig != 0 && eloop->signal_cb != NULL) {
+ n = _eloop_sig[--_eloop_nsig];
+ eloop->signal_cb(n, eloop->signal_cb_ctx);
continue;
}
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/if-options.h
--- a/external/bsd/dhcpcd/dist/src/if-options.h Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.h Thu Jul 02 13:57:40 2020 +0000
@@ -180,6 +180,7 @@
#define O_INACTIVE O_BASE + 47
#define O_MUDURL O_BASE + 48
#define O_MSUSERCLASS O_BASE + 49
+#define O_POLL O_BASE + 50
extern const struct option cf_options[];
@@ -215,6 +216,7 @@
time_t mtime;
uint8_t iaid[4];
int metric;
+ unsigned long poll;
uint8_t requestmask[256 / NBBY];
uint8_t requiremask[256 / NBBY];
uint8_t nomask[256 / NBBY];
diff -r 66572d164f6c -r 8a756e53a70f external/bsd/dhcpcd/dist/src/if.c
--- a/external/bsd/dhcpcd/dist/src/if.c Thu Jul 02 13:56:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.c Thu Jul 02 13:57:40 2020 +0000
@@ -64,7 +64,9 @@
#include <syslog.h>
#include <unistd.h>
+#define ELOOP_QUEUE ELOOP_IF
#include "common.h"
+#include "eloop.h"
#include "dev.h"
#include "dhcp.h"
#include "dhcp6.h"
@@ -384,6 +386,39 @@
return false;
}
+#if defined(AF_PACKET) && !defined(AF_LINK)
+static unsigned int
+if_check_arphrd(struct interface *ifp, unsigned int active, bool if_noconf)
+{
+
+ switch(ifp->hwtype) {
+ case ARPHRD_ETHER: /* FALLTHROUGH */
+ case ARPHRD_IEEE1394: /* FALLTHROUGH */
+ case ARPHRD_INFINIBAND: /* FALLTHROUGH */
+ case ARPHRD_NONE: /* FALLTHROUGH */
+ break;
+ case ARPHRD_LOOPBACK:
+ case ARPHRD_PPP:
+ if (if_noconf) {
+ logdebugx("%s: ignoring due to interface type and"
+ " no config",
+ ifp->name);
+ active = IF_INACTIVE;
+ }
+ break;
+ default:
+ if (if_noconf)
+ active = IF_INACTIVE;
+ if (active)
+ logwarnx("%s: unsupported interface type 0x%.2x",
+ ifp->name, ifp->hwtype);
+ break;
+ }
+
+ return active;
Home |
Main Index |
Thread Index |
Old Index