1
0
mirror of https://git.openwrt.org/feed/routing.git synced 2024-06-18 21:23:57 +02:00
openwrt-routing/olsrd/patches/600-add-ubus-support.patch
Nick Hainke c2e138d49f olsrd: add ubus ipc integration to olsrd
IPC integration of olsrd with OpenWrt. Allow dynamic adding and removing
of interfaces at run-time. We need to rename the avl-tree files, since
libubox also defines avl tree. Also add patch to allow meshing via
wireguard point-to-point links.

The ubus interface offers following functions:
  - add_inteface '{"ifname":"wg_51820"}'
  - del_inteface '{"ifname":"wg_51820"}'

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 0bffe620b4)
2022-01-17 09:41:46 +01:00

61 lines
1.3 KiB
Diff

--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -59,6 +59,8 @@
#include <assert.h>
#include <time.h>
+#include "ubus.h"
+
#ifdef __MACH__
#include "mach/clock_gettime.h"
#endif
@@ -363,6 +365,8 @@ poll_sockets(void)
}
OLSR_FOR_ALL_SOCKETS_END(entry);
+ hfd = olsrd_ubus_add_read_sock(&ibits, hfd);
+
/* Running select on the FD set */
do {
n = olsr_select(hfd, fdsets & SP_PR_READ ? &ibits : NULL, fdsets & SP_PR_WRITE ? &obits : NULL, NULL, &tvp);
@@ -395,6 +399,7 @@ poll_sockets(void)
}
}
OLSR_FOR_ALL_SOCKETS_END(entry);
+ olsrd_ubus_receive(&ibits);
}
static void
--- a/src/main.c
+++ b/src/main.c
@@ -74,6 +74,8 @@
#include "lock_file.h"
#include "cli.h"
+#include "ubus.h"
+
#if defined(__GLIBC__) && defined(__linux__) && !defined(__ANDROID__) && !defined(__UCLIBC__)
#define OLSR_HAVE_EXECINFO_H
#endif
@@ -771,6 +773,9 @@ int main(int argc, char *argv[]) {
signal(SIGUSR2, SIG_IGN);
#endif /* _WIN32 */
+ /* Adding ubus */
+ olsrd_add_ubus();
+
/* Starting scheduler */
olsr_scheduler();
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -252,7 +252,7 @@ else
ifeq ($(OS),win32)
LDFLAGS += -Wl,-export-all-symbols
else
- LDFLAGS += -Wl,-export-dynamic
+ LDFLAGS += -Wl,-export-dynamic,-lubus,-lubox
endif
ifeq ($(NORPATH),0)
LDFLAGS += -Wl,-rpath,$(LIBDIR)