3 @@ -55,6 +55,8 @@ THE SOFTWARE.
11 unsigned char myid[8];
12 @@ -536,6 +538,9 @@ main(int argc, char **argv)
20 rc = resize_receive_buffer(1500);
22 @@ -635,6 +640,8 @@ main(int argc, char **argv)
23 FD_SET(local_sockets[i].fd, &readfds);
24 maxfd = MAX(maxfd, local_sockets[i].fd);
27 + maxfd = babeld_ubus_add_read_sock(&readfds, maxfd);
28 rc = select(maxfd + 1, &readfds, NULL, NULL, &tv);
31 @@ -703,6 +710,9 @@ main(int argc, char **argv)
36 + babeld_ubus_receive(&readfds);
39 kernel_dump_time = now.tv_sec;
40 check_neighbours_timeout = now;
43 @@ -11,11 +11,11 @@ LDLIBS = -lrt
45 SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \
46 route.c xroute.c message.c resend.c configuration.c local.c \
47 - disambiguation.c rule.c
48 + disambiguation.c rule.c ubus.c
50 OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \
51 route.o xroute.o message.o resend.o configuration.o local.o \
52 - disambiguation.o rule.o
53 + disambiguation.o rule.o ubus.o
56 $(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS)
57 --- a/generate-version.sh
58 +++ b/generate-version.sh
59 @@ -10,4 +10,4 @@ else
63 -echo "#define BABELD_VERSION \"$version\""
64 +echo "#define BABELD_VERSION \"$version-ubus-mod\""
67 @@ -41,6 +41,7 @@ THE SOFTWARE.
69 #include "configuration.h"
73 static struct filter *input_filters = NULL;
74 static struct filter *output_filters = NULL;
75 @@ -850,7 +851,8 @@ parse_option(int c, gnc_t gnc, void *clo
76 strcmp(token, "daemonise") == 0 ||
77 strcmp(token, "skip-kernel-setup") == 0 ||
78 strcmp(token, "ipv6-subtrees") == 0 ||
79 - strcmp(token, "reflect-kernel-metric") == 0) {
80 + strcmp(token, "reflect-kernel-metric") == 0 ||
81 + strcmp(token, "ubus-bindings") == 0) {
83 c = getbool(c, &b, gnc, closure);
85 @@ -868,6 +870,8 @@ parse_option(int c, gnc_t gnc, void *clo
86 has_ipv6_subtrees = b;
87 else if(strcmp(token, "reflect-kernel-metric") == 0)
88 reflect_kernel_metric = b;
89 + else if(strcmp(token, "ubus-bindings") == 0)
93 } else if(strcmp(token, "protocol-group") == 0) {
96 @@ -42,6 +42,8 @@ THE SOFTWARE.
102 int local_server_socket = -1;
103 struct local_socket local_sockets[MAX_LOCAL_SOCKETS];
104 int num_local_sockets = 0;
105 @@ -80,7 +82,7 @@ write_timeout(int fd, const void *buf, i
114 @@ -191,6 +193,8 @@ local_notify_neighbour(struct neighbour
115 if(local_sockets[i].monitor)
116 local_notify_neighbour_1(&local_sockets[i], neigh, kind);
119 + ubus_notify_neighbour(neigh, kind);
123 @@ -228,6 +232,8 @@ local_notify_xroute(struct xroute *xrout
124 if(local_sockets[i].monitor)
125 local_notify_xroute_1(&local_sockets[i], xroute, kind);
128 + ubus_notify_xroute(xroute, kind);
132 @@ -273,6 +279,8 @@ local_notify_route(struct babel_route *r
133 if(local_sockets[i].monitor)
134 local_notify_route_1(&local_sockets[i], route, kind);
137 + ubus_notify_route(route, kind);
143 @@ -55,3 +55,4 @@ int local_read(struct local_socket *s);
144 int local_header(struct local_socket *s);
145 struct local_socket *local_socket_create(int fd);
146 void local_socket_destroy(int i);
147 +const char * local_kind(int kind);