* Build all the targets on macos
strategy:
matrix:
os: [ macos-26 ]
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
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Configure
- run: ./configure --sanitize
+ run: CPPFLAGS="${{ matrix.cppflags }}" ./configure ${{ matrix.args }}
* But we can support both as the hook scripts will uniqify the
* results if the server returns both options.
*/
* But we can support both as the hook scripts will uniqify the
* results if the server returns both options.
*/
static const struct dhcp_compat dhcp_compats[] = { { DHO_DNSSERVER,
D6_OPTION_DNS_SERVERS },
{ DHO_HOSTNAME, D6_OPTION_FQDN }, { DHO_DNSDOMAIN, D6_OPTION_FQDN },
static const struct dhcp_compat dhcp_compats[] = { { DHO_DNSSERVER,
D6_OPTION_DNS_SERVERS },
{ DHO_HOSTNAME, D6_OPTION_FQDN }, { DHO_DNSDOMAIN, D6_OPTION_FQDN },
{ 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 } };
{ 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 } };
static const char *const dhcp6_statuses[] = { "Success", "Unspecified Failure",
"No Addresses Available", "No Binding", "Not On Link", "Use Multicast",
static const char *const dhcp6_statuses[] = { "Success", "Unspecified Failure",
"No Addresses Available", "No Binding", "Not On Link", "Use Multicast",
struct if_options *ifo = ifp->options;
struct dho_policy_group *pg = &ifo->dhopg_dhcp6;
struct dhcp6_state *state;
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 &&
if ((ctx->options & (DHCPCD_MANAGER | DHCPCD_PRIVSEP)) ==
DHCPCD_MANAGER &&
/* If no DHCPv6 options are configured,
match configured DHCPv4 options to DHCPv6 equivalents. */
if (pg->dhop_request.dhop_policy_len == 0) {
/* 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;
const struct dho_policy_group *dpg = &ifo->dhopg_dhcp;
for (dhc = dhcp_compats; dhc->dhcp_opt; dhc++) {
if (!dho_policy_has(&dpg->dhop_request, dhc->dhcp_opt))
continue;
for (dhc = dhcp_compats; dhc->dhcp_opt; dhc++) {
if (!dho_policy_has(&dpg->dhop_request, dhc->dhcp_opt))
continue;
+#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);
if (ifo->fqdn != FQDN_DISABLE ||
ifo->options & DHCPCD_HOSTNAME) {
err = dho_policy_add(&pg->dhop_request, D6_OPTION_FQDN);
static int if_addressexists(struct interface *, struct in_addr *);
static int if_addressexists(struct interface *, struct in_addr *);
#define PROC_PROMOTE "/proc/sys/net/ipv4/conf/%s/promote_secondaries"
#define SYS_BRIDGE "/sys/class/net/%s/bridge/bridge_id"
#define PROC_PROMOTE "/proc/sys/net/ipv4/conf/%s/promote_secondaries"
#define SYS_BRIDGE "/sys/class/net/%s/bridge/bridge_id"
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) {
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) {
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;
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 0;
+#else
+ errno = EPFNOSUPPORT;
+ return -1;
+#endif
}
if (strncmp(arg, "dhcp6_", strlen("dhcp6_")) == 0) {
}
if (strncmp(arg, "dhcp6_", strlen("dhcp6_")) == 0) {
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;
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 0;
+#else
+ errno = EPFNOSUPPORT;
+ return -1;
+#endif
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;
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
ARG_REQUIRED;
if (ctx->options & DHCPCD_PRINT_PIDFILE)
break;
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) {
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) {
ARG_REQUIRED;
if (ctx->options & DHCPCD_PRINT_PIDFILE)
break;
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) {
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) {
ARG_REQUIRED;
if (ctx->options & DHCPCD_PRINT_PIDFILE)
break;
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) {
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) {
ARG_REQUIRED;
if (ctx->options & DHCPCD_PRINT_PIDFILE)
break;
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 ||
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 ||
ARG_REQUIRED;
if (ctx->options & DHCPCD_PRINT_PIDFILE)
break;
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;
if (set_default_allow(ifo, pg)) {
logerr("%s: set_default_allow", __func__);
return -1;
ARG_REQUIRED;
if (ctx->options & DHCPCD_PRINT_PIDFILE)
break;
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)
if (dho_policy_set(&pctx, &ifo->dhop_destination, arg, 2) !=
0) {
if (errno == EINVAL)
dho_policy_group_free(ifo->dhopg_dhcp);
dho_policy_free(ifo->dhop_destination);
dho_policy_group_free(ifo->dhopg_dhcp);
dho_policy_free(ifo->dhop_destination);
dho_policy_group_free(ifo->dhopg_nd);
dho_policy_group_free(ifo->dhopg_nd);
dho_policy_group_free(ifo->dhopg_dhcp6);
dho_policy_group_free(ifo->dhopg_dhcp6);
#ifdef RT_FREE_ROUTE_TABLE
/* Stupidly, we don't know the interface when creating the
#ifdef RT_FREE_ROUTE_TABLE
/* Stupidly, we don't know the interface when creating the
unsigned long long options;
bool randomise_hwaddr;
unsigned long long options;
bool randomise_hwaddr;
struct dho_policy_group dhopg_dhcp;
struct dho_policy dhop_destination;
struct dho_policy_group dhopg_dhcp;
struct dho_policy dhop_destination;
struct dho_policy_group dhopg_nd;
struct dho_policy_group dhopg_nd;
struct dho_policy_group dhopg_dhcp6;
struct dho_policy_group dhopg_dhcp6;
struct in_addr req_addr;
struct in_addr req_mask;
struct in_addr req_addr;
struct in_addr req_mask;