gluon-radv-filterd: Return null via respondd without chosen gateway
This commit is contained in:
parent
9b3a2f2be2
commit
f6f1ae9c4f
@ -12,7 +12,7 @@ static struct json_object * get_radv_filter() {
|
|||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
struct ether_addr mac = {};
|
struct ether_addr mac = {};
|
||||||
struct json_object *ret = NULL;
|
struct ether_addr unspec = {};
|
||||||
char macstr[F_MAC_LEN + 1] = "";
|
char macstr[F_MAC_LEN + 1] = "";
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
@ -26,17 +26,19 @@ static struct json_object * get_radv_filter() {
|
|||||||
|
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
|
||||||
snprintf(macstr, sizeof(macstr), F_MAC, F_MAC_VAR(mac));
|
memset(&unspec, 0, sizeof(unspec));
|
||||||
ret = gluonutil_wrap_string(macstr);
|
if (ether_addr_equal(mac, unspec)) {
|
||||||
return ret;
|
return NULL;
|
||||||
|
} else {
|
||||||
|
snprintf(macstr, sizeof(macstr), F_MAC, F_MAC_VAR(mac));
|
||||||
|
return gluonutil_wrap_string(macstr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct json_object * respondd_provider_statistics() {
|
static struct json_object * respondd_provider_statistics() {
|
||||||
struct json_object *ret = json_object_new_object();
|
struct json_object *ret = json_object_new_object();
|
||||||
|
|
||||||
struct json_object *radv_filter = get_radv_filter();
|
json_object_object_add(ret, "gateway6", get_radv_filter());
|
||||||
if (radv_filter)
|
|
||||||
json_object_object_add(ret, "gateway6", radv_filter);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user