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:** 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;