diff --git a/package/gluon-radv-filterd/src/respondd.c b/package/gluon-radv-filterd/src/respondd.c index bfa9257aebf0c25e9b4379a5707fa50f2a23dfc7..9a2a9fc0e15aa6266b25dceeb5640ff85b93d96e 100644 --- a/package/gluon-radv-filterd/src/respondd.c +++ b/package/gluon-radv-filterd/src/respondd.c @@ -5,6 +5,8 @@ #include <net/ethernet.h> #include <stdio.h> #include <string.h> +#include <unistd.h> +#include <fcntl.h> #include "mac.h" @@ -37,6 +39,19 @@ static struct json_object * get_radv_filter() { } static struct json_object * respondd_provider_statistics() { + 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; + } + 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; + } struct json_object *ret = json_object_new_object(); json_object_object_add(ret, "gateway6", get_radv_filter());