diff --git a/src/mustach-dhcpd-pools.c b/src/mustach-dhcpd-pools.c index fe06fce..142394a 100644 --- a/src/mustach-dhcpd-pools.c +++ b/src/mustach-dhcpd-pools.c @@ -231,9 +231,10 @@ static int must_enter(void *closure, const char *name) if (!strcmp(name, "subnets")) { itf.put = must_put_range; itf.next = must_next_range; - e->current = num_ranges; + e->current = num_ranges + 1; e->range_p = ranges; /* must_next_range() will skip_ok when needed */ + e->range_p--; return must_next_range(closure); } if (!strcmp(name, "shared-networks")) { diff --git a/tests/expected/mustach b/tests/expected/mustach index 4599887..39f5e6e 100644 --- a/tests/expected/mustach +++ b/tests/expected/mustach @@ -1,4 +1,19 @@ Subnets: + location: example1 + range: 10.0.0.1 - 10.0.0.20 + first_ip: 10.0.0.1 + last_ip: 10.0.0.20 + used: 11 + touched: 0 + defined: 20 + free: 9 + percent: 55 + touch_count: 11 + touch_percent: 55 + backup_count: 1 + backup_percent: 5 + status: 0 + location: example1 range: 10.1.0.1 - 10.1.0.20 first_ip: 10.1.0.1 @@ -101,6 +116,21 @@ Summary: --- skip ok --- Subnets: + location: example1 + range: 10.0.0.1 - 10.0.0.20 + first_ip: 10.0.0.1 + last_ip: 10.0.0.20 + used: 11 + touched: 0 + defined: 20 + free: 9 + percent: 55 + touch_count: 11 + touch_percent: 55 + backup_count: 1 + backup_percent: 5 + status: 1 + location: example1 range: 10.1.0.1 - 10.1.0.20 first_ip: 10.1.0.1