Skip to content
Snippets Groups Projects
Commit 249c1a77 authored by Jan Luebbe's avatar Jan Luebbe Committed by chrissi^
Browse files

gluon-radv-filterd: never return NULL to respondd

respondd drops existing json object if any provider returns NULL, so we need to
return an empty object instead.
parent 3bc4dca8
No related branches found
No related tags found
No related merge requests found
......@@ -39,20 +39,20 @@ static struct json_object * get_radv_filter() {
}
static struct json_object * respondd_provider_statistics() {
struct json_object *ret = json_object_new_object();
char buf[6];
int fd = open("/sys/class/net/bat0/mesh/gw_mode", O_RDONLY);
if (fd == -1) {
perror("error opening gateway info file");
return NULL;
return ret;
}
memset(buf, 0, sizeof(buf));
read(fd, buf, sizeof(buf));
close(fd);
if (strncmp(buf, "server", 6) == 0) {
// We are a batman gateway, do not write gateway6
return NULL;
return ret;
}
struct json_object *ret = json_object_new_object();
json_object_object_add(ret, "gateway6", get_radv_filter());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment