gluon-radv-filterd: Return null via respondd without chosen gateway

This commit is contained in:
Jan-Philipp Litza 2018-01-03 22:18:23 +01:00
parent 9b3a2f2be2
commit f6f1ae9c4f
No known key found for this signature in database
GPG Key ID: 1FB658053CE27196

View File

@ -12,7 +12,7 @@ static struct json_object * get_radv_filter() {
char *line = NULL;
size_t len = 0;
struct ether_addr mac = {};
struct json_object *ret = NULL;
struct ether_addr unspec = {};
char macstr[F_MAC_LEN + 1] = "";
if (!f)
@ -26,17 +26,19 @@ static struct json_object * get_radv_filter() {
pclose(f);
memset(&unspec, 0, sizeof(unspec));
if (ether_addr_equal(mac, unspec)) {
return NULL;
} else {
snprintf(macstr, sizeof(macstr), F_MAC, F_MAC_VAR(mac));
ret = gluonutil_wrap_string(macstr);
return ret;
return gluonutil_wrap_string(macstr);
}
}
static struct json_object * respondd_provider_statistics() {
struct json_object *ret = json_object_new_object();
struct json_object *radv_filter = get_radv_filter();
if (radv_filter)
json_object_object_add(ret, "gateway6", radv_filter);
json_object_object_add(ret, "gateway6", get_radv_filter());
return ret;
}