changeset 3000:b5d6570d224b draft

Ensure that we only have a 0 sla once.
author Roy Marples <roy@marples.name>
date Sat, 07 Mar 2015 19:15:14 +0000
parents 77d9a1a2a2e3
children f24c67362ec2
files if-options.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/if-options.c	Sat Mar 07 16:31:22 2015 +0000
+++ b/if-options.c	Sat Mar 07 19:15:14 2015 +0000
@@ -1362,13 +1362,6 @@
 						    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 @@
 			/* 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 @@
 					    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;