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 Update to dhcpcd-9.3.0 with the fol...
details: https://anonhg.NetBSD.org/src/rev/2ef3cb3fddca
branches: trunk
changeset: 955630:2ef3cb3fddca
user: roy <roy%NetBSD.org@localhost>
date: Mon Oct 05 16:01:13 2020 +0000
description:
Update to dhcpcd-9.3.0 with the following changes:
* dhcpcd: Backticks have been removed from quoting filenames
* dhcpcd: Only manipulate stdin, stdout and stderr if they are valid
* duid: Adjust option so the type can be specified
* logerr: Don't leak logfile fd to scripts
* privsep: Run the launcher process in the sandbox
* BSD: Use `ifi_link_state` as the single source of truth about carrier
* BSD: Ignore vether(4) devices by default
diffstat:
external/bsd/dhcpcd/dist/README.md | 5 --
external/bsd/dhcpcd/dist/src/defs.h | 2 +-
external/bsd/dhcpcd/dist/src/dev.h | 4 +-
external/bsd/dhcpcd/dist/src/dhcp-common.c | 2 +-
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in | 19 ++-----
external/bsd/dhcpcd/dist/src/dhcpcd.h | 8 ++-
external/bsd/dhcpcd/dist/src/duid.c | 14 ++++-
external/bsd/dhcpcd/dist/src/duid.h | 1 +
external/bsd/dhcpcd/dist/src/if-options.h | 2 -
external/bsd/dhcpcd/dist/src/if.c | 49 ++++++-------------
external/bsd/dhcpcd/dist/src/if.h | 5 +-
external/bsd/dhcpcd/dist/src/privsep-bpf.c | 31 +++---------
external/bsd/dhcpcd/dist/src/privsep-bsd.c | 13 ++++-
external/bsd/dhcpcd/dist/src/privsep-control.c | 13 +-----
external/bsd/dhcpcd/dist/src/privsep-inet.c | 23 +--------
external/bsd/dhcpcd/dist/src/privsep-root.c | 62 ++++++++++++++++++-------
external/bsd/dhcpcd/dist/src/privsep-root.h | 2 +-
external/bsd/dhcpcd/dist/src/privsep.h | 18 ++++++-
18 files changed, 127 insertions(+), 146 deletions(-)
diffs (truncated from 746 to 300 lines):
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/README.md
--- a/external/bsd/dhcpcd/dist/README.md Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/README.md Mon Oct 05 16:01:13 2020 +0000
@@ -89,11 +89,6 @@
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.
-dhcpcd-9 requires this directory and contents to be writeable by the
-unprivileged user (default _dhcpcd, _dhcp or dhcpcd).
-
-Of course this won't work if dhcpcd is packaged up, so packagers will need to
-install similar logic into their dhcpcd package.
dhcpcd-9 defaults the run directory to `/var/run/dhcpcd` instead of
`/var/run` and the prefix of dhcpcd has been removed from the files.
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h Mon Oct 05 16:01:13 2020 +0000
@@ -29,7 +29,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "9.2.0"
+#define VERSION "9.3.0"
#ifndef PRIVSEP_USER
# define PRIVSEP_USER "_" PACKAGE
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/dev.h
--- a/external/bsd/dhcpcd/dist/src/dev.h Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dev.h Mon Oct 05 16:01:13 2020 +0000
@@ -31,7 +31,7 @@
// dev plugin setup
struct dev {
const char *name;
- int (*initialized)(const char *);
+ int (*initialised)(const char *);
int (*listening)(void);
int (*handle_device)(void *);
int (*start)(void);
@@ -47,7 +47,7 @@
// hooks for dhcpcd
#ifdef PLUGIN_DEV
#include "dhcpcd.h"
-int dev_initialized(struct dhcpcd_ctx *, const char *);
+int dev_initialised(struct dhcpcd_ctx *, const char *);
int dev_listening(struct dhcpcd_ctx *);
int dev_start(struct dhcpcd_ctx *, int (*)(void *, int, const char *));
void dev_stop(struct dhcpcd_ctx *);
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/dhcp-common.c
--- a/external/bsd/dhcpcd/dist/src/dhcp-common.c Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp-common.c Mon Oct 05 16:01:13 2020 +0000
@@ -615,7 +615,7 @@
}
/* Trim any extra data.
- * Maybe we need a settng to reject DHCP options with extra data? */
+ * Maybe we need a setting to reject DHCP options with extra data? */
if (opt->type & OT_ARRAY)
return (ssize_t)(dl - (dl % sz));
return (ssize_t)sz;
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in Mon Oct 05 16:01:13 2020 +0000
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 2, 2020
+.Dd September 28, 2020
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
@@ -211,12 +211,15 @@
sends a default
.Ar clientid
of the hardware family and the hardware address.
-.It Ic duid
+.It Ic duid Op ll | lt | uuid
Use a DHCP Unique Identifier.
If a system UUID is available, that will be used to create a DUID-UUID,
otheriwse if persistent storage is available then a DUID-LLT
(link local address + time) is generated,
otherwise DUID-LL is generated (link local address).
+The DUID type can be hinted as an optional parameter if the file
+.Pa @DBDIR@/duid
+does not exist.
This, plus the IAID will be used as the
.Ic clientid .
The DUID generated will be held in
@@ -538,12 +541,6 @@
You should only set this for buggy interface drivers.
.It Ic noup
Don't bring the interface up when in master mode.
-If
-.Nm
-cannot determine the carrier state,
-.Nm
-will enter a tight polling loop until the interface is marked up and running
-or a valid carrier state is reported.
.It Ic option Ar option
Requests the
.Ar option
@@ -601,12 +598,6 @@
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 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/dhcpcd.h
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.h Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.h Mon Oct 05 16:01:13 2020 +0000
@@ -117,8 +117,11 @@
struct dhcpcd_ctx {
char pidfile[sizeof(PIDFILE) + IF_NAMESIZE + 1];
char vendor[256];
+ bool stdin_valid; /* It's possible stdin, stdout and stderr */
+ bool stdout_valid; /* could be closed when dhcpcd starts. */
+ bool stderr_valid;
+ int stderr_fd; /* FD for logging to stderr */
int fork_fd; /* FD for the fork init signal pipe */
- int stderr_fd; /* FD for logging to stderr */
const char *cffile;
unsigned long long options;
char *logfile;
@@ -132,6 +135,7 @@
char **ifv; /* listed interfaces */
int ifcc; /* configured interfaces */
char **ifcv; /* configured interfaces */
+ uint8_t duid_type;
unsigned char *duid;
size_t duid_len;
struct if_head *ifaces;
@@ -267,7 +271,7 @@
void dhcpcd_linkoverflow(struct dhcpcd_ctx *);
int dhcpcd_handleargs(struct dhcpcd_ctx *, struct fd_list *, int, char **);
-void dhcpcd_handlecarrier(struct dhcpcd_ctx *, int, unsigned int, const char *);
+void dhcpcd_handlecarrier(struct interface *, int, unsigned int);
int dhcpcd_handleinterface(void *, int, const char *);
void dhcpcd_handlehwaddr(struct interface *, uint16_t, const void *, uint8_t);
void dhcpcd_dropinterface(struct interface *, const char *);
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/duid.c
--- a/external/bsd/dhcpcd/dist/src/duid.c Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/duid.c Mon Oct 05 16:01:13 2020 +0000
@@ -176,6 +176,9 @@
/* No file? OK, lets make one based the machines UUID */
if (ifp == NULL) {
+ if (ctx->duid_type != DUID_DEFAULT &&
+ ctx->duid_type != DUID_UUID)
+ return 0;
len = duid_make_uuid(data);
if (len == 0)
free(data);
@@ -199,13 +202,15 @@
logwarnx("picked interface %s to generate a DUID",
ifp->name);
} else {
- logwarnx("no interfaces have a fixed hardware "
- "address");
+ if (ctx->duid_type != DUID_LL)
+ logwarnx("no interfaces have a fixed hardware "
+ "address");
return duid_make(data, ifp, DUID_LL);
}
}
- len = duid_make(data, ifp, DUID_LLT);
+ len = duid_make(data, ifp,
+ ctx->duid_type == DUID_LL ? DUID_LL : DUID_LLT);
hwaddr_ntoa(data, len, line, sizeof(line));
slen = strlen(line);
if (slen < sizeof(line) - 2) {
@@ -214,7 +219,8 @@
}
if (dhcp_writefile(ctx, DUID, 0640, line, slen) == -1) {
logerr("%s: cannot write duid", __func__);
- return duid_make(data, ifp, DUID_LL);
+ if (ctx->duid_type != DUID_LL)
+ return duid_make(data, ifp, DUID_LL);
}
return len;
}
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/duid.h
--- a/external/bsd/dhcpcd/dist/src/duid.h Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/duid.h Mon Oct 05 16:01:13 2020 +0000
@@ -30,6 +30,7 @@
#define DUID_H
#define DUID_LEN 128 + 2
+#define DUID_DEFAULT 0
#define DUID_LLT 1
#define DUID_LL 3
#define DUID_UUID 4
diff -r 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/if-options.h
--- a/external/bsd/dhcpcd/dist/src/if-options.h Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.h Mon Oct 05 16:01:13 2020 +0000
@@ -180,7 +180,6 @@
#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[];
@@ -216,7 +215,6 @@
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 5e7b946877fe -r 2ef3cb3fddca external/bsd/dhcpcd/dist/src/if.c
--- a/external/bsd/dhcpcd/dist/src/if.c Mon Oct 05 15:43:32 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.c Mon Oct 05 16:01:13 2020 +0000
@@ -185,7 +185,11 @@
if_ioctl(ifp->ctx, SIOCSIFFLAGS, &ifr, sizeof(ifr)) == -1)
return -1;
- ifp->flags = (unsigned int)ifr.ifr_flags;
+ /*
+ * Do NOT set ifp->flags here.
+ * We need to listen for flag updates from the kernel as they
+ * need to sync with carrier.
+ */
return 0;
}
@@ -399,7 +403,7 @@
break;
case ARPHRD_LOOPBACK:
case ARPHRD_PPP:
- if (if_noconf) {
+ if (if_noconf && active) {
logdebugx("%s: ignoring due to interface type and"
" no config",
ifp->name);
@@ -519,8 +523,11 @@
#ifdef PLUGIN_DEV
/* Ensure that the interface name has settled */
- if (!dev_initialized(ctx, spec.devname))
+ if (!dev_initialised(ctx, spec.devname)) {
+ logdebugx("%s: waiting for interface to initialise",
+ spec.devname);
continue;
+ }
#endif
if (if_vimaster(ctx, spec.devname) == 1) {
@@ -535,8 +542,11 @@
!if_hasconf(ctx, spec.devname));
/* Don't allow some reserved interface names unless explicit. */
- if (if_noconf && if_ignore(ctx, spec.devname))
+ if (if_noconf && if_ignore(ctx, spec.devname)) {
+ logdebugx("%s: ignoring due to interface type and"
+ " no config", spec.devname);
active = IF_INACTIVE;
+ }
ifp = calloc(1, sizeof(*ifp));
if (ifp == NULL) {
@@ -581,7 +591,7 @@
case IFT_LOOP: /* FALLTHROUGH */
case IFT_PPP:
/* Don't allow unless explicit */
- if (if_noconf) {
+ if (if_noconf && active) {
logdebugx("%s: ignoring due to"
" interface type and"
" no config",
@@ -681,40 +691,13 @@
#endif
ifp->active = active;
- if (ifp->active)
- ifp->carrier = if_carrier(ifp);
- else
- ifp->carrier = LINK_UNKNOWN;
+ ifp->carrier = if_carrier(ifp, ifa->ifa_data);
TAILQ_INSERT_TAIL(ifs, ifp, next);
}
return ifs;
}
-static void
-if_poll(void *arg)
-{
- struct interface *ifp = arg;
- unsigned int flags = ifp->flags;
Home |
Main Index |
Thread Index |
Old Index