From: Roy Marples Date: Mon, 15 May 2017 08:59:52 +0000 (+0100) Subject: Warn about IA_PD support not being compiled in when requesting it X-Git-Tag: v7.0.0-rc2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c25b444ecbc1355c88f3964b67cb4129fddc27ab;p=thirdparty%2Fdhcpcd.git Warn about IA_PD support not being compiled in when requesting it in dhcpcd.conf. Remove more IA_PD code to reduce small binary. --- diff --git a/src/dhcpcd.c b/src/dhcpcd.c index ce5fb447..0d7676cc 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -532,8 +532,10 @@ configure_interface1(struct interface *ifp) ifo->ia->ia_type = D6_OPTION_IA_NA; memcpy(ifo->ia->iaid, ifo->iaid, sizeof(ifo->iaid)); memset(&ifo->ia->addr, 0, sizeof(ifo->ia->addr)); +#ifndef SMALL ifo->ia->sla = NULL; ifo->ia->sla_len = 0; +#endif } } else { size_t i; diff --git a/src/if-options.c b/src/if-options.c index 3edc0dbe..0d6912b7 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -673,7 +673,9 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, size_t sl; struct if_ia *ia; uint8_t iaid[4]; +#ifndef SMALL struct if_sla *sla, *slap; +#endif #endif dop = NULL; @@ -1317,12 +1319,17 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, /* FALLTHROUGH */ case O_IA_PD: if (i == 0) { +#ifdef SMALL + logwarnx("%s: IA_PD not compiled in", ifname); + return -1; +#else if (ifname == NULL) { logerr("IA PD must belong in an " "interface block"); return -1; } i = D6_OPTION_IA_PD; +#endif } if (ifname == NULL && arg) { logerrx("IA with IAID must belong in an " @@ -1405,12 +1412,15 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, } } } +#ifndef SMALL ia->sla_max = 0; ia->sla_len = 0; ia->sla = NULL; +#endif } if (ia->ia_type != D6_OPTION_IA_PD) break; +#ifndef SMALL for (p = fp; p; p = fp) { fp = strwhite(p); if (fp) { @@ -1530,6 +1540,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, err_sla: ia->sla_len--; return -1; +#endif #endif case O_HOSTNAME_SHORT: ifo->options |= DHCPCD_HOSTNAME | DHCPCD_HOSTNAME_SHORT; @@ -2615,7 +2626,7 @@ free_options(struct if_options *ifo) free_dhcp_opt_embenc(opt); free(ifo->vivso_override); -#ifdef INET6 +#if defined(INET6) && !defined(SMALL) for (; ifo->ia_len > 0; ifo->ia_len--) free(ifo->ia[ifo->ia_len - 1].sla); #endif diff --git a/src/if-options.h b/src/if-options.h index a7a45384..441f0116 100644 --- a/src/if-options.h +++ b/src/if-options.h @@ -143,10 +143,12 @@ struct if_ia { uint8_t iaid_set; struct in6_addr addr; uint8_t prefix_len; +#ifndef SMALL uint32_t sla_max; size_t sla_len; struct if_sla *sla; #endif +#endif }; struct vivco {