Skip to content
Snippets Groups Projects
Commit 9ff40509 authored by Kasalehlia's avatar Kasalehlia Committed by chrissi^
Browse files

gluon-radvd-filterd: Do not write respondd info if batman server

parent e640fa39
No related branches found
No related tags found
No related merge requests found
......@@ -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());
......
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