]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure that we only have a 0 sla once.
authorRoy Marples <roy@marples.name>
Sat, 7 Mar 2015 19:15:14 +0000 (19:15 +0000)
committerRoy Marples <roy@marples.name>
Sat, 7 Mar 2015 19:15:14 +0000 (19:15 +0000)
if-options.c

index 412cee52b74dfb68d2a15ad8fc6c095da7ca837a..8f375a3c004e3a615359d071eb75cce284bdd46f 100644 (file)
@@ -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;