diff --git a/src/mustach-dhcpd-pools.c b/src/mustach-dhcpd-pools.c index 1cc8bfc..d8096e2 100644 --- a/src/mustach-dhcpd-pools.c +++ b/src/mustach-dhcpd-pools.c @@ -84,6 +84,14 @@ static int must_put_range(void *closure, const char *name, int escape ntop_ipaddr(&e->range_p->last_ip)); return 0; } + if (!strcmp(name, "first_ip")) { + fprintf(file, "%s", ntop_ipaddr(&e->range_p->first_ip)); + return 0; + } + if (!strcmp(name, "last_ip")) { + fprintf(file, "%s", ntop_ipaddr(&e->range_p->last_ip)); + return 0; + } if (!strcmp(name, "used")) { fprintf(file, "%g", e->range_p->count); return 0; diff --git a/src/output.c b/src/output.c index 28f2a57..5c86d54 100644 --- a/src/output.c +++ b/src/output.c @@ -497,6 +497,8 @@ static int output_json(const int print_mac_addreses) fprintf(outfile, "\"range\":\"%s", ntop_ipaddr(&range_p->first_ip)); fprintf(outfile, " - %s\", ", ntop_ipaddr(&range_p->last_ip)); + fprintf(outfile, "\"first_ip\":\"%s\", ", ntop_ipaddr(&range_p->first_ip)); + fprintf(outfile, "\"last_ip\":\"%s\", ", ntop_ipaddr(&range_p->last_ip)); fprintf(outfile, "\"defined\":%g, ", oh.range_size); fprintf(outfile, "\"used\":%g, ", range_p->count); fprintf(outfile, "\"touched\":%g, ", range_p->touched); diff --git a/tests/expected/same-twice-json b/tests/expected/same-twice-json index 598410d..43d431b 100644 --- a/tests/expected/same-twice-json +++ b/tests/expected/same-twice-json @@ -3,7 +3,7 @@ { "ip":"10.0.0.5", "macaddress":"00:00:00:00:00:00" } ], "subnets": [ - { "location":"All networks", "range":"10.0.0.1 - 10.0.0.10", "defined":10, "used":1, "touched":0, "free":9, "percent":10, "touch_count":1, "touch_percent":10, "status":0 } + { "location":"All networks", "range":"10.0.0.1 - 10.0.0.10", "first_ip":"10.0.0.1", "last_ip":"10.0.0.10", "defined":10, "used":1, "touched":0, "free":9, "percent":10, "touch_count":1, "touch_percent":10, "status":0 } ], "shared-networks": [ ],