From 59a7301e3b34c6aa1a172f54d362019f58043ade Mon Sep 17 00:00:00 2001 From: Niv Bromberg Date: Thu, 3 Sep 2026 15:21:33 +0000 Subject: [PATCH 1/2] Preserve vendclass optarg when parsing enterprise number The vendclass parser split the enterprise number from its class data by writing a NUL into optarg. dhcpcd applies command-line options more than once: first while processing global options, then again when each interface is configured. That made the first pass succeed because it kept a local pointer to the bytes after the separator, but it permanently shortened the shared argv string to the enterprise number for later passes. Parse the enterprise number from a temporary NUL-terminated copy instead, leaving argv intact so the per-interface pass can still see and encode the vendor-class data. (cherry picked from commit 261851a888028a070a11faf5ed003aa2bea71e1a from NetworkConfiguration/dhcpcd#725) --- src/if-options.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/if-options.c b/src/if-options.c index 6cf0e4e6a..0b2d207a6 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -1974,9 +1974,22 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, case O_VENDCLASS: ARG_REQUIRED; fp = strwhite(arg); - if (fp) - *fp++ = '\0'; - u = (uint32_t)strtou(arg, NULL, 0, 0, UINT32_MAX, &e); + bp = NULL; + /* Command line options are parsed globally and then replayed + * per-interface using the same argv, so do not split optarg + * in-place. Later passes still need the data after the EN. */ + if (fp) { + dl = (size_t)(fp - arg); + bp = malloc(dl + 1); + if (!bp) { + logerr(__func__); + return -1; + } + memcpy(bp, arg, dl); + bp[dl] = '\0'; + } + u = (uint32_t)strtou(bp ? bp : arg, NULL, 0, 0, UINT32_MAX, &e); + free(bp); if (e) { logerrx("invalid code: %s", arg); return -1; From a3c67b9030295fecd69cb0627be383297451831a Mon Sep 17 00:00:00 2001 From: Niv Bromberg Date: Sun, 6 Sep 2026 13:39:02 +0000 Subject: [PATCH 2/2] Clarify make install with abspath --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e7d0e691c..b707cb706 100644 --- a/README.md +++ b/README.md @@ -93,17 +93,23 @@ dhcpcd-9 defaults the run directory to `/var/run/dhcpcd` instead of To create a statically-linked .deb package for Drivenets (baseos, interfacehandler, containers): -1. **Configure and build:** +1. **Configure and build from the repository root:** ```bash - ./configure --libexecdir="/usr/lib/dhcpcd" --enable-static CFLAGS="-Os -g" + ./configure --libexecdir="/usr/lib/dhcpcd" --enable-static --without-udev CFLAGS="-Os -g" make ``` -2. **Install to package directory:** +2. **Install to package directory from the repository root:** ```bash - make install DESTDIR=/path/to/dhcpcd_-dn_amd64 + VERSION=10.0.6-dn_81498e4e + PKGDIR="$PWD/src/dhcpcd_${VERSION}-dn_amd64" + make install DESTDIR="$PKGDIR" ``` - Replace `` with the actual version (e.g., `10.0.6`). + Replace `VERSION` with the actual package version. `DESTDIR` should be an + absolute path: the top-level install enters both `src/` and `hooks/`, and a + relative `DESTDIR` would be interpreted separately from each subdirectory. + Running `make install` from `src/` skips `hooks/` entirely and omits + `/usr/lib/dhcpcd/dhcpcd-run-hooks`. 3. **Add Debian control files:**