]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Build all the targets on macos master
authorRoy Marples <roy@marples.name>
Tue, 30 Jun 2026 12:29:28 +0000 (13:29 +0100)
committerGitHub <noreply@github.com>
Tue, 30 Jun 2026 12:29:28 +0000 (13:29 +0100)
* Build all the targets on macos

.github/workflows/build.yml
src/dhcp6.c
src/if-linux.c
src/if-options.c
src/if-options.h

index 33f3166fc256a88fc5577dd685a1ffed483c761e..83fee113ac54c06919544d8d3c97abba25ebc728 100644 (file)
@@ -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
index b11e40031bf53698bdf45bef9a26f379554f926a..6ee4dede2f55d0a4e7eba614d172349a09293489 100644 (file)
@@ -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);
index 41893815985d36801a914763dde62c43eb1ad718..d7b8330b4f71a05258d3b75666722661f4d846c9 100644 (file)
@@ -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"
index b821327aaadd52b3f3751bcf2afa09ac891b325b..e584a2d562e3aecec3ffd77f31c60a05030b0a5f 100644 (file)
@@ -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
index ecb45f4766a72ee88df3e0944d10f67708e28e74..288426cea6b3e138f6a386deef22ee119806d26f 100644 (file)
@@ -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;