]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Warn about IA_PD support not being compiled in when requesting it
authorRoy Marples <roy@marples.name>
Mon, 15 May 2017 08:59:52 +0000 (09:59 +0100)
committerRoy Marples <roy@marples.name>
Mon, 15 May 2017 08:59:52 +0000 (09:59 +0100)
in dhcpcd.conf.
Remove more IA_PD code to reduce small binary.

src/dhcpcd.c
src/if-options.c
src/if-options.h

index ce5fb447f7e2a722435533b803eaafb89b2a2b76..0d7676cc7014d4acf954698a83b55470f6d48f93 100644 (file)
@@ -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;
index 3edc0dbe6bb132ccd3b9308bb4457da7a3f99c77..0d6912b713a1ed55e64017c971611a1a4793b347 100644 (file)
@@ -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
index a7a4538401bc2e775ae571529654fa5558b5088c..441f0116ecf78355a01bf6ca0620b46e80253959 100644 (file)
@@ -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 {