From: Roy Marples Date: Sat, 7 Mar 2015 19:15:14 +0000 (+0000) Subject: Ensure that we only have a 0 sla once. X-Git-Tag: v6.8.0~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a268d0e4741c8368b9ce0b240f75ba43504371e8;p=thirdparty%2Fdhcpcd.git Ensure that we only have a 0 sla once. --- diff --git a/if-options.c b/if-options.c index 412cee52..8f375a3c 100644 --- a/if-options.c +++ b/if-options.c @@ -1362,13 +1362,6 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ifname); goto err_sla; } - if (sla->sla == 0 && ia->sla_len > 1) { - syslog(LOG_ERR, "%s: cannot" - " assign multiple prefixes" - " with a SLA of 0", - ifname); - goto err_sla; - } } if (np) { sla->prefix_len = (uint8_t)strtoi(np, @@ -1388,7 +1381,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, /* Sanity check */ for (sl = 0; sl < ia->sla_len - 1; sl++) { slap = &ia->sla[sl]; - if (slap->sla_set && sla->sla_set == 0) { + if (slap->sla_set != sla->sla_set) { syslog(LOG_WARNING, "%s: cannot mix automatic " "and fixed SLA", @@ -1405,6 +1398,13 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, sla->ifname); goto err_sla; } + if (slap->sla == 0 || sla->sla == 0) { + syslog(LOG_ERR, "%s: cannot" + " assign multiple prefixes" + " with a SLA of 0", + ifname); + goto err_sla; + } } if (sla->sla_set && sla->sla > ia->sla_max) ia->sla_max = sla->sla;