babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
--- a/babeld.c
|
|
|
|
+++ b/babeld.c
|
2021-05-29 19:17:32 +02:00
|
|
|
@@ -54,6 +54,8 @@ THE SOFTWARE.
|
|
|
|
#include "local.h"
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
+#include "ubus.h"
|
|
|
|
+
|
|
|
|
struct timeval now;
|
|
|
|
|
|
|
|
unsigned char myid[8];
|
2023-07-18 23:32:04 +02:00
|
|
|
@@ -505,6 +507,9 @@ main(int argc, char **argv)
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if(ubus_bindings)
|
|
|
|
+ babeld_add_ubus();
|
|
|
|
+
|
|
|
|
init_signals();
|
|
|
|
rc = resize_receive_buffer(1500);
|
|
|
|
if(rc < 0)
|
2023-07-18 23:32:04 +02:00
|
|
|
@@ -597,6 +602,8 @@ main(int argc, char **argv)
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
FD_SET(local_sockets[i].fd, &readfds);
|
|
|
|
maxfd = MAX(maxfd, local_sockets[i].fd);
|
|
|
|
}
|
|
|
|
+ if(ubus_bindings)
|
|
|
|
+ maxfd = babeld_ubus_add_read_sock(&readfds, maxfd);
|
|
|
|
rc = select(maxfd + 1, &readfds, NULL, NULL, &tv);
|
|
|
|
if(rc < 0) {
|
|
|
|
if(errno != EINTR) {
|
2023-07-18 23:32:04 +02:00
|
|
|
@@ -665,6 +672,9 @@ main(int argc, char **argv)
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if(ubus_bindings)
|
|
|
|
+ babeld_ubus_receive(&readfds);
|
|
|
|
+
|
|
|
|
if(reopening) {
|
|
|
|
kernel_dump_time = now.tv_sec;
|
|
|
|
check_neighbours_timeout = now;
|
|
|
|
--- a/generate-version.sh
|
|
|
|
+++ b/generate-version.sh
|
|
|
|
@@ -10,4 +10,4 @@ else
|
|
|
|
version="unknown"
|
|
|
|
fi
|
|
|
|
|
|
|
|
-echo "#define BABELD_VERSION \"$version\""
|
|
|
|
+echo "#define BABELD_VERSION \"$version-ubus-mod\""
|
|
|
|
--- a/configuration.c
|
|
|
|
+++ b/configuration.c
|
2022-03-30 19:30:17 +02:00
|
|
|
@@ -42,6 +42,8 @@ THE SOFTWARE.
|
|
|
|
#include "hmac.h"
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
#include "configuration.h"
|
|
|
|
|
2021-05-29 19:17:32 +02:00
|
|
|
+#include "ubus.h"
|
|
|
|
+
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
static struct filter *input_filters = NULL;
|
|
|
|
static struct filter *output_filters = NULL;
|
2021-05-29 19:17:32 +02:00
|
|
|
static struct filter *redistribute_filters = NULL;
|
2023-07-27 11:19:09 +02:00
|
|
|
@@ -1024,7 +1026,8 @@ parse_option(int c, gnc_t gnc, void *clo
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
strcmp(token, "daemonise") == 0 ||
|
|
|
|
strcmp(token, "skip-kernel-setup") == 0 ||
|
|
|
|
strcmp(token, "ipv6-subtrees") == 0 ||
|
|
|
|
- strcmp(token, "reflect-kernel-metric") == 0) {
|
|
|
|
+ strcmp(token, "reflect-kernel-metric") == 0 ||
|
|
|
|
+ strcmp(token, "ubus-bindings") == 0) {
|
|
|
|
int b;
|
|
|
|
c = getbool(c, &b, gnc, closure);
|
|
|
|
if(c < -1)
|
2023-07-27 11:19:09 +02:00
|
|
|
@@ -1042,6 +1045,8 @@ parse_option(int c, gnc_t gnc, void *clo
|
babeld: add ubus bindings
A better integration of babeld with OpenWrt is to connect the daemon to
the IPC. So far, we can only communicate via a websocket. With ubus we
can send and receive commands in json format.
The commit adds a ubus interface to babeld with following functions:
- get_info
- get_neighbours
- get_xroutes
- get_routes
All output is divided into IPv4 and IPv6.
Ubus has to be enabled by setting "config general"
option 'ubus_bindings' 'true'
Example:
root@OpenWrt:~# ubus call babeld get_info
{
"babeld-version": "babeld-1.9.2",
"my-id": "32:xx:xx:xx:xx:xx:xx:xx",
"host": "OpenWrt"
}
root@OpenWrt:~# ubus call babeld get_neighbours
{
"IPv4": {
},
"IPv6": {
"fe80::xx:xx:xx:xxx": {
"dev": "br-lan",
"hello-reach": 65408,
"uhello-reach": 0,
"rxcost": 96,
"txcost": 96,
"rtt": 4338271,
"channel": -2,
"if_up": true
}
}
}
root@OpenWrt:~# ubus call babeld get_xroutes
{
"IPv4": {
"10.0.0.3/32": {
"src-prefix": "0.0.0.0/0",
"metric": 0
},
"10.0.0.0/24": {
"src-prefix": "0.0.0.0/0",
"metric": 0
}
},
"IPv6": {
"fdfa:xx:xx::1/128": {
"src-prefix": "::/0",
"metric": 0
}
}
}
root@OpenWrt:~# ubus call babeld get_routes
{
"IPv4": {
"10.2.0.1/32": {
"src-prefix": "0.0.0.0/0",
"route_metric": 96,
"route_smoothed_metric": 96,
"refmetric": 0,
"id": "62:xx:xx:xx:xx:xx:xx:xx",
"seqno": 41381,
"channels": "",
"age": 17,
"via": "fe80::xx:xxxx:xxxx:xxxx",
"nexthop": " nexthop ",
"installed": true,
"feasible": true
},
"IPv6": {
}
}
Additional IPC functionality will follow.
Further, we changed the version to $version-ubus-mod.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-12-17 12:41:32 +01:00
|
|
|
has_ipv6_subtrees = b;
|
|
|
|
else if(strcmp(token, "reflect-kernel-metric") == 0)
|
|
|
|
reflect_kernel_metric = b;
|
|
|
|
+ else if(strcmp(token, "ubus-bindings") == 0)
|
|
|
|
+ ubus_bindings = b;
|
|
|
|
else
|
|
|
|
abort();
|
|
|
|
} else if(strcmp(token, "protocol-group") == 0) {
|
babeld: send events via ubus (#633)
* babeld: send events via ubus
Send a notification via the ubus bus if we experience any changes in
neighbours, routes or xroutes.
The format looks like this:
{route,xroute,neighbour}.add: Object was added
{route,xroute,neighbour}.change: Object was changed
{route,xroute,neighbour}.flush: Object was flushed
If ubus_bindings is turned off, it will minimally effect performance,
since only an if-statement has to be evaluated.
If no subscriber is available, it will minimally change the performance,
since only an if-statmenet that checks for subscribers has to be
evaluated.
Signed-off-by: Nick Hainke <vincent@systemli.org>
2021-02-01 15:26:44 +01:00
|
|
|
--- a/local.c
|
|
|
|
+++ b/local.c
|
|
|
|
@@ -42,6 +42,8 @@ THE SOFTWARE.
|
|
|
|
#include "local.h"
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
+#include "ubus.h"
|
|
|
|
+
|
|
|
|
int local_server_socket = -1;
|
|
|
|
struct local_socket local_sockets[MAX_LOCAL_SOCKETS];
|
|
|
|
int num_local_sockets = 0;
|
|
|
|
@@ -191,6 +193,8 @@ local_notify_neighbour(struct neighbour
|
|
|
|
if(local_sockets[i].monitor)
|
|
|
|
local_notify_neighbour_1(&local_sockets[i], neigh, kind);
|
|
|
|
}
|
|
|
|
+ if(ubus_bindings)
|
|
|
|
+ ubus_notify_neighbour(neigh, kind);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -228,6 +232,8 @@ local_notify_xroute(struct xroute *xrout
|
|
|
|
if(local_sockets[i].monitor)
|
|
|
|
local_notify_xroute_1(&local_sockets[i], xroute, kind);
|
|
|
|
}
|
|
|
|
+ if(ubus_bindings)
|
|
|
|
+ ubus_notify_xroute(xroute, kind);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -273,6 +279,8 @@ local_notify_route(struct babel_route *r
|
|
|
|
if(local_sockets[i].monitor)
|
|
|
|
local_notify_route_1(&local_sockets[i], route, kind);
|
|
|
|
}
|
|
|
|
+ if(ubus_bindings)
|
|
|
|
+ ubus_notify_route(route, kind);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-05-29 19:17:32 +02:00
|
|
|
--- a/Makefile
|
|
|
|
+++ b/Makefile
|
2022-03-30 19:30:17 +02:00
|
|
|
@@ -11,11 +11,11 @@ LDLIBS = -lrt
|
2021-05-29 19:17:32 +02:00
|
|
|
|
|
|
|
SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \
|
2022-03-30 19:30:17 +02:00
|
|
|
route.c xroute.c message.c resend.c configuration.c local.c \
|
|
|
|
- hmac.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c
|
|
|
|
+ hmac.c ubus.c rfc6234/sha224-256.c BLAKE2/ref/blake2s-ref.c
|
2021-05-29 19:17:32 +02:00
|
|
|
|
|
|
|
OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \
|
2022-03-30 19:30:17 +02:00
|
|
|
route.o xroute.o message.o resend.o configuration.o local.o \
|
|
|
|
- hmac.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o
|
|
|
|
+ hmac.o ubus.o rfc6234/sha224-256.o BLAKE2/ref/blake2s-ref.o
|
2021-05-29 19:17:32 +02:00
|
|
|
|
|
|
|
babeld: $(OBJS)
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS)
|