From: Roy Marples Date: Tue, 30 Jun 2026 12:29:28 +0000 (+0100) Subject: Build all the targets on macos X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b312918d8f1885d7fe8fcc03a7e06ae8a0314b4;p=thirdparty%2Fdhcpcd.git Build all the targets on macos * Build all the targets on macos --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33f3166f..83fee113 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,13 +17,23 @@ jobs: strategy: matrix: os: [ macos-26 ] + args: + - --sanitize + - --disable-ipv4 + - --disable-arp + - --disable-ipv4ll + - --disable-ipv6 + - --disable-dhcp6 + cppflags: + - + - -DSMALL runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 - name: Configure - run: ./configure --sanitize + run: CPPFLAGS="${{ matrix.cppflags }}" ./configure ${{ matrix.args }} - name: Build run: make diff --git a/src/dhcp6.c b/src/dhcp6.c index b11e4003..6ee4dede 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -154,6 +154,7 @@ struct dhcp_compat { * But we can support both as the hook scripts will uniqify the * results if the server returns both options. */ +#ifdef INET static const struct dhcp_compat dhcp_compats[] = { { DHO_DNSSERVER, D6_OPTION_DNS_SERVERS }, { DHO_HOSTNAME, D6_OPTION_FQDN }, { DHO_DNSDOMAIN, D6_OPTION_FQDN }, @@ -164,6 +165,7 @@ static const struct dhcp_compat dhcp_compats[] = { { DHO_DNSSERVER, { DHO_FQDN, D6_OPTION_FQDN }, { DHO_VIVCO, D6_OPTION_VENDOR_CLASS }, { DHO_VIVSO, D6_OPTION_VENDOR_OPTS }, { DHO_DNSSEARCH, D6_OPTION_DOMAIN_LIST }, { 0, 0 } }; +#endif static const char *const dhcp6_statuses[] = { "Success", "Unspecified Failure", "No Addresses Available", "No Binding", "Not On Link", "Use Multicast", @@ -4025,7 +4027,6 @@ dhcp6_start1(void *arg) struct if_options *ifo = ifp->options; struct dho_policy_group *pg = &ifo->dhopg_dhcp6; struct dhcp6_state *state; - const struct dhcp_compat *dhc; if ((ctx->options & (DHCPCD_MANAGER | DHCPCD_PRIVSEP)) == DHCPCD_MANAGER && @@ -4052,9 +4053,13 @@ dhcp6_start1(void *arg) /* If no DHCPv6 options are configured, match configured DHCPv4 options to DHCPv6 equivalents. */ if (pg->dhop_request.dhop_policy_len == 0) { +#ifdef INET + const struct dhcp_compat *dhc; const struct dho_policy_group *dpg = &ifo->dhopg_dhcp; +#endif int err; +#ifdef INET for (dhc = dhcp_compats; dhc->dhcp_opt; dhc++) { if (!dho_policy_has(&dpg->dhop_request, dhc->dhcp_opt)) continue; @@ -4064,6 +4069,18 @@ dhcp6_start1(void *arg) return; } } +#else + err = dho_policy_add(&pg->dhop_request, D6_OPTION_DNS_SERVERS); + if (err == -1) { + logerr(__func__); + return; + } + err = dho_policy_add(&pg->dhop_request, D6_OPTION_DOMAIN_LIST); + if (err == -1) { + logerr(__func__); + return; + } +#endif if (ifo->fqdn != FQDN_DISABLE || ifo->options & DHCPCD_HOSTNAME) { err = dho_policy_add(&pg->dhop_request, D6_OPTION_FQDN); diff --git a/src/if-linux.c b/src/if-linux.c index 41893815..d7b8330b 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -170,7 +170,9 @@ static const uint8_t ipv4_bcast_addr[] = { }; #endif +#ifdef INET static int if_addressexists(struct interface *, struct in_addr *); +#endif #define PROC_PROMOTE "/proc/sys/net/ipv4/conf/%s/promote_secondaries" #define SYS_BRIDGE "/sys/class/net/%s/bridge/bridge_id" diff --git a/src/if-options.c b/src/if-options.c index b821327a..e584a2d5 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -507,33 +507,49 @@ parse_addr(__unused struct in_addr *addr, __unused struct in_addr *net, } #endif -static void +static int set_option_space(struct dhcpcd_ctx *ctx, struct if_options *ifo, const char *arg, struct dho_policy_ctx *pctx, struct dho_policy_group **pg) { if (strncmp(arg, "nd_", strlen("nd_")) == 0) { +#ifdef INET6 pctx->dopts = ctx->nd_opts; pctx->dopts_len = ctx->nd_opts_len; pctx->odopts = ifo->nd_override; pctx->odopts_len = ifo->nd_override_len; *pg = &ifo->dhopg_nd; - return; + return 0; +#else + errno = EPFNOSUPPORT; + return -1; +#endif } if (strncmp(arg, "dhcp6_", strlen("dhcp6_")) == 0) { +#ifdef DHCP6 pctx->dopts = ctx->dhcp6_opts; pctx->dopts_len = ctx->dhcp6_opts_len; pctx->odopts = ifo->dhcp6_override; pctx->odopts_len = ifo->dhcp6_override_len; *pg = &ifo->dhopg_dhcp6; - return; + return 0; +#else + errno = EPFNOSUPPORT; + return -1; +#endif } +#ifdef INET pctx->dopts = ctx->dhcp_opts; pctx->dopts_len = ctx->dhcp_opts_len; pctx->odopts = ifo->dhcp_override; pctx->odopts_len = ifo->dhcp_override_len; *pg = &ifo->dhopg_dhcp; + return 0; +#else + errno = EPFNOSUPPORT; + return -1; +#endif } void @@ -824,7 +840,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ARG_REQUIRED; if (ctx->options & DHCPCD_PRINT_PIDFILE) break; - set_option_space(ctx, ifo, arg, &pctx, &pg); + if (set_option_space(ctx, ifo, arg, &pctx, &pg) == -1) + return 0; if (dho_policy_set(&pctx, &pg->dhop_request, arg, 1) != 0 || dho_policy_set(&pctx, &pg->dhop_remove, arg, -1) != 0 || dho_policy_set(&pctx, &pg->dhop_reject, arg, -1) != 0) { @@ -836,7 +853,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ARG_REQUIRED; if (ctx->options & DHCPCD_PRINT_PIDFILE) break; - set_option_space(ctx, ifo, arg, &pctx, &pg); + if (set_option_space(ctx, ifo, arg, &pctx, &pg) == -1) + return 0; if (dho_policy_set(&pctx, &pg->dhop_reject, arg, 1) != 0 || dho_policy_set(&pctx, &pg->dhop_request, arg, -1) != 0 || dho_policy_set(&pctx, &pg->dhop_require, arg, -1) != 0) { @@ -1268,7 +1286,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ARG_REQUIRED; if (ctx->options & DHCPCD_PRINT_PIDFILE) break; - set_option_space(ctx, ifo, arg, &pctx, &pg); + if (set_option_space(ctx, ifo, arg, &pctx, &pg) == -1) + return 0; if (dho_policy_set(&pctx, &pg->dhop_request, arg, -1) != 0 || dho_policy_set(&pctx, &pg->dhop_require, arg, -1) != 0 || dho_policy_set(&pctx, &pg->dhop_remove, arg, 1) != 0) { @@ -1280,7 +1299,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ARG_REQUIRED; if (ctx->options & DHCPCD_PRINT_PIDFILE) break; - set_option_space(ctx, ifo, arg, &pctx, &pg); + if (set_option_space(ctx, ifo, arg, &pctx, &pg) == -1) + return 0; if (dho_policy_set(&pctx, &pg->dhop_require, arg, 1) != 0 || dho_policy_set(&pctx, &pg->dhop_request, arg, 1) != 0 || dho_policy_set(&pctx, &pg->dhop_remove, arg, -1) != 0 || @@ -1513,7 +1533,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ARG_REQUIRED; if (ctx->options & DHCPCD_PRINT_PIDFILE) break; - set_option_space(ctx, ifo, arg, &pctx, &pg); + if (set_option_space(ctx, ifo, arg, &pctx, &pg) == -1) + return 0; if (set_default_allow(ifo, pg)) { logerr("%s: set_default_allow", __func__); return -1; @@ -1572,7 +1593,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ARG_REQUIRED; if (ctx->options & DHCPCD_PRINT_PIDFILE) break; - set_option_space(ctx, ifo, arg, &pctx, &pg); + if (set_option_space(ctx, ifo, arg, &pctx, &pg) == -1) + return 0; if (dho_policy_set(&pctx, &ifo->dhop_destination, arg, 2) != 0) { if (errno == EINVAL) @@ -3109,11 +3131,17 @@ free_options(struct dhcpcd_ctx *ctx, struct if_options *ifo) free(ifo->config); } +#ifdef INET dho_policy_group_free(ifo->dhopg_dhcp); dho_policy_free(ifo->dhop_destination); +#endif +#ifdef INET6 dho_policy_group_free(ifo->dhopg_nd); +#endif +#ifdef DHCP6 dho_policy_group_free(ifo->dhopg_dhcp6); +#endif #ifdef RT_FREE_ROUTE_TABLE /* Stupidly, we don't know the interface when creating the diff --git a/src/if-options.h b/src/if-options.h index ecb45f47..288426ce 100644 --- a/src/if-options.h +++ b/src/if-options.h @@ -278,11 +278,17 @@ struct if_options { unsigned long long options; bool randomise_hwaddr; +#ifdef INET struct dho_policy_group dhopg_dhcp; struct dho_policy dhop_destination; +#endif +#ifdef INET6 struct dho_policy_group dhopg_nd; +#endif +#ifdef DHCP6 struct dho_policy_group dhopg_dhcp6; +#endif struct in_addr req_addr; struct in_addr req_mask;