include $(INCLUDE_DIR)/package.mk
-init-y := alfred
-
define Package/alfred
URL:=https://www.open-mesh.org/
SECTION:=net
source "$(SOURCE)/Config.in"
endef
-MAKE_ALFRED_FLAGS=\
+MAKE_FLAGS += \
CONFIG_ALFRED_VIS=$(if $(CONFIG_PACKAGE_ALFRED_VIS),y,n) \
CONFIG_ALFRED_GPSD=$(if $(CONFIG_PACKAGE_ALFRED_GPSD),y,n) \
CONFIG_ALFRED_CAPABILITIES=n \
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
TARGET_LDFLAGS += -Wl,--gc-sections -fuse-linker-plugin
-define Build/Compile
- CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
- $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) $(MAKE_ALFRED_FLAGS) all
-endef
-
define Package/alfred/install
$(INSTALL_DIR) $(1)/usr/sbin
cp -fpR $(PKG_BUILD_DIR)/alfred $(1)/usr/sbin/
PKG_NAME:=batctl
PKG_VERSION:=2019.2
-PKG_RELEASE:=0
+PKG_RELEASE:=1
PKG_HASH:=fb656208ff7d4cd8b1b422f60c9e6d8747302a347cbf6c199d7afa9b80f80ea3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
TARGET_CFLAGS += -flto
TARGET_LDFLAGS += -fuse-linker-plugin
-MAKE_BATCTL_ENV += \
- CPPFLAGS="$(TARGET_CPPFLAGS)" \
- CFLAGS="$(TARGET_CFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
+MAKE_VARS += \
LIBNL_NAME="libnl-tiny" \
LIBNL_GENL_NAME="libnl-tiny"
-MAKE_BATCTL_ARGS += \
- REVISION="$(PKG_BATCTL_SHORTREV)" \
- CC="$(TARGET_CC)" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- batctl install \
+MAKE_FLAGS += \
REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
config-n := \
claimtable \
dat_cache \
distributed_arp_table \
+ elp_interval \
event \
fragmentation \
gateways \
routing_algo \
statistics \
tcpdump \
+ throughput_override \
throughputmeter \
traceroute \
transglobal \
bonding \
bridge_loop_avoidance \
distributed_arp_table \
+ elp_interval \
fragmentation \
gw_mode \
hop_penalty \
network_coding \
orig_interval \
routing_algo \
+ throughput_override \
config-tables := \
backbonetable \
endef
$(eval $(call shexport,batctl_config))
-define Build/Compile
- $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS) \
- $$$$$(call shvar,batctl_config)
-endef
+MAKE_FLAGS += $$$$$(call shvar,batctl_config)
define Package/batctl-tiny/install
$(INSTALL_DIR) $(1)/usr/libexec
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 13 Jun 2019 21:12:14 +0200
+Subject: batctl: Make vlan setting explicit
+
+The requirement to have a VLAN master device on top of the batadv mesh
+interface is artificially limiting the capabilities of batctl. Not all
+master devices in linux which register a VLAN are from type "vlan" and are
+only registering a single VLAN.
+
+For example VLAN aware bridges can create multiple VLANs. These require
+that the VLAN is identified using the VID and not the vlan device.
+
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Forwarded: https://patchwork.open-mesh.org/patch/17947/
+
+diff --git a/ap_isolation.c b/ap_isolation.c
+index 71dcd00eac845d488c4969b17e1339f181c6c913..7c34649225dcc9cc557cc5bb4cbfa2343f8c0763 100644
+--- a/ap_isolation.c
++++ b/ap_isolation.c
+@@ -81,3 +81,8 @@ COMMAND_NAMED(SUBCOMMAND, ap_isolation, "ap", handle_sys_setting,
+ COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+ &batctl_settings_ap_isolation,
+ "[0|1] \tdisplay or modify ap_isolation setting");
++
++COMMAND_NAMED(SUBCOMMAND_VID, ap_isolation, "ap", handle_sys_setting,
++ COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
++ &batctl_settings_ap_isolation,
++ "[0|1] \tdisplay or modify ap_isolation setting for vlan device or id");
+diff --git a/main.c b/main.c
+index 278683c6080e3ff4a9f3225931d0c5eb44f89595..6ca13ac0ec4c82ee969be04737a339fd702b52bd 100644
+--- a/main.c
++++ b/main.c
+@@ -28,48 +28,75 @@ extern const struct command *__stop___command[];
+
+ static void print_usage(void)
+ {
+- enum command_type type[] = {
+- SUBCOMMAND,
+- DEBUGTABLE,
++ struct {
++ const char *label;
++ uint32_t types;
++ } type[] = {
++ {
++ .label = "commands:\n",
++ .types = BIT(SUBCOMMAND) |
++ BIT(SUBCOMMAND_VID),
++ },
++ {
++ .label = "debug tables: \tdisplay the corresponding debug table\n",
++ .types = BIT(DEBUGTABLE),
++ },
++ };
++ const char *default_prefixes[] = {
++ "",
++ NULL,
++ };
++ const char *vlan_prefixes[] = {
++ "vlan <vdev> ",
++ "vid <vid> ",
++ NULL,
+ };
+ const struct command **p;
+- char buf[32];
++ const char **prefixes;
++ const char **prefix;
++ char buf[64];
+ size_t i;
+
+ fprintf(stderr, "Usage: batctl [options] command|debug table [parameters]\n");
+ fprintf(stderr, "options:\n");
+- fprintf(stderr, " \t-m mesh interface or VLAN created on top of a mesh interface (default 'bat0')\n");
++ fprintf(stderr, " \t-m mesh interface (default 'bat0')\n");
+ fprintf(stderr, " \t-h print this help (or 'batctl <command|debug table> -h' for the parameter help)\n");
+ fprintf(stderr, " \t-v print version\n");
+
+ for (i = 0; i < sizeof(type) / sizeof(*type); i++) {
+ fprintf(stderr, "\n");
+
+- switch (type[i]) {
+- case SUBCOMMAND:
+- fprintf(stderr, "commands:\n");
+- break;
+- case DEBUGTABLE:
+- fprintf(stderr, "debug tables: \tdisplay the corresponding debug table\n");
+- break;
+- }
++ fprintf(stderr, "%s", type[i].label);
+
+ for (p = __start___command; p < __stop___command; p++) {
+ const struct command *cmd = *p;
+
+- if (cmd->type != type[i])
++ if (!(BIT(cmd->type) & type[i].types))
+ continue;
+
+ if (!cmd->usage)
+ continue;
+
+- if (strcmp(cmd->name, cmd->abbr) == 0)
+- snprintf(buf, sizeof(buf), "%s", cmd->name);
+- else
+- snprintf(buf, sizeof(buf), "%s|%s", cmd->name,
+- cmd->abbr);
++ switch (cmd->type) {
++ case SUBCOMMAND_VID:
++ prefixes = vlan_prefixes;
++ break;
++ default:
++ prefixes = default_prefixes;
++ break;
++ }
+
+- fprintf(stderr, " \t%-27s%s\n", buf, cmd->usage);
++ for (prefix = &prefixes[0]; *prefix; prefix++) {
++ if (strcmp(cmd->name, cmd->abbr) == 0)
++ snprintf(buf, sizeof(buf), "%s%s",
++ *prefix, cmd->name);
++ else
++ snprintf(buf, sizeof(buf), "%s%s|%s",
++ *prefix, cmd->name, cmd->abbr);
++
++ fprintf(stderr, " \t%-35s%s\n", buf,
++ cmd->usage);
++ }
+ }
+ }
+ }
+@@ -93,13 +120,19 @@ static void version(void)
+ exit(EXIT_SUCCESS);
+ }
+
+-static const struct command *find_command(const char *name)
++static const struct command *find_command(struct state *state, const char *name)
+ {
+ const struct command **p;
+
+ for (p = __start___command; p < __stop___command; p++) {
+ const struct command *cmd = *p;
+
++ if (state->vid >= 0 && cmd->type != SUBCOMMAND_VID)
++ continue;
++
++ if (state->vid < 0 && cmd->type == SUBCOMMAND_VID)
++ continue;
++
+ if (strcmp(cmd->name, name) == 0)
+ return cmd;
+
+@@ -110,6 +143,51 @@ static const struct command *find_command(const char *name)
+ return NULL;
+ }
+
++static int parse_dev_args(struct state *state, int argc, char *argv[])
++{
++ unsigned long vid;
++ char *endptr;
++
++ /* not enough arguments to parse */
++ if (argc < 2) {
++ translate_mesh_iface(state);
++ return 0;
++ }
++
++ if (strcmp(argv[0], "vid") == 0) {
++ if (argv[1] == '\0') {
++ fprintf(stderr, "Error - unparsable vid\n");
++ return -EINVAL;
++ }
++
++ vid = strtoul(argv[1], &endptr, 0);
++ if (!endptr || *endptr != '\0') {
++ fprintf(stderr, "Error - unparsable vid\n");
++ return -EINVAL;
++ }
++
++ if (vid > 4095) {
++ fprintf(stderr, "Error - too large vid (max 4095)\n");
++ return -ERANGE;
++ }
++
++ /* get mesh interface and overwrite vid afterwards */
++ translate_mesh_iface(state);
++ state->vid = vid;
++
++ return 2;
++ } else if (strcmp(argv[0], "vlan") == 0) {
++ state->arg_iface = argv[1];
++ translate_mesh_iface(state);
++
++ return 2;
++ } else {
++ /* parse vlan as part of -m parameter */
++ translate_mesh_iface(state);
++ return 0;
++ }
++}
++
+ int main(int argc, char **argv)
+ {
+ const struct command *cmd;
+@@ -117,6 +195,7 @@ int main(int argc, char **argv)
+ .arg_iface = mesh_dfl_iface,
+ .cmd = NULL,
+ };
++ int dev_arguments;
+ int opt;
+ int ret;
+
+@@ -152,7 +231,15 @@ int main(int argc, char **argv)
+ argc -= optind;
+ optind = 0;
+
+- cmd = find_command(argv[0]);
++ /* parse arguments to identify vlan, ... */
++ dev_arguments = parse_dev_args(&state, argc, argv);
++ if (dev_arguments < 0)
++ goto err;
++
++ argv += dev_arguments;
++ argc -= dev_arguments;
++
++ cmd = find_command(&state, argv[0]);
+ if (!cmd) {
+ fprintf(stderr,
+ "Error - no valid command or debug table specified: %s\n",
+@@ -162,8 +249,6 @@ int main(int argc, char **argv)
+
+ state.cmd = cmd;
+
+- translate_mesh_iface(&state);
+-
+ if (cmd->flags & COMMAND_FLAG_MESH_IFACE &&
+ check_mesh_iface(&state) < 0) {
+ fprintf(stderr,
+diff --git a/main.h b/main.h
+index 1a4701513c49ad8974b9c9189619f5dde622acd4..1d952610aefb8367bd52e24bea8c04c3d70b94ea 100644
+--- a/main.h
++++ b/main.h
+@@ -58,6 +58,7 @@ enum command_flags {
+
+ enum command_type {
+ SUBCOMMAND,
++ SUBCOMMAND_VID,
+ DEBUGTABLE,
+ };
+
+@@ -84,7 +85,7 @@ struct command {
+ };
+
+ #define COMMAND_NAMED(_type, _name, _abbr, _handler, _flags, _arg, _usage) \
+- static const struct command command_ ## _name = { \
++ static const struct command command_ ## _name ## _ ## _type = { \
+ .type = (_type), \
+ .name = (#_name), \
+ .abbr = _abbr, \
+@@ -93,8 +94,8 @@ struct command {
+ .arg = (_arg), \
+ .usage = (_usage), \
+ }; \
+- static const struct command *__command_ ## _name \
+- __attribute__((__used__)) __attribute__ ((__section__ ("__command"))) = &command_ ## _name
++ static const struct command *__command_ ## _name ## _ ## _type \
++ __attribute__((__used__)) __attribute__ ((__section__ ("__command"))) = &command_ ## _name ## _ ## _type
+
+ #define COMMAND(_type, _handler, _abbr, _flags, _arg, _usage) \
+ COMMAND_NAMED(_type, _handler, _abbr, _handler, _flags, _arg, _usage)
+diff --git a/man/batctl.8 b/man/batctl.8
+index 0b430313075b5a7a4c796eba0867954e10061002..acb4288c4e6f59b322d20631ef8e3aee6f2215e5 100644
+--- a/man/batctl.8
++++ b/man/batctl.8
+@@ -68,7 +68,7 @@ free all attached interfaces and remove batman-adv interface.
+ If no parameter is given the current originator interval setting is displayed otherwise the parameter is used to set the
+ originator interval. The interval is in units of milliseconds.
+ .br
+-.IP "\fBap_isolation\fP|\fBap\fP [\fB0\fP|\fB1\fP]"
++.IP "[\fBvlan <vdev>\fP|\fBvid <vid>\fP] \fBap_isolation\fP|\fBap\fP [\fB0\fP|\fB1\fP]"
+ If no parameter is given the current ap isolation setting is displayed. Otherwise the parameter is used to enable or
+ disable ap isolation. This command can be used in conjunction with "\-m" option to target per VLAN configurations.
+ .br
+diff --git a/sys.c b/sys.c
+index 39123db87d391b8898b7454eba7708515bfb3c78..f19719cfad61f36f2a5c1078305de83eb5be142a 100644
+--- a/sys.c
++++ b/sys.c
+@@ -141,9 +141,35 @@ int sys_simple_print_boolean(struct nl_msg *msg, void *arg,
+
+ static void settings_usage(struct state *state)
+ {
+- fprintf(stderr, "Usage: batctl [options] %s|%s [parameters] %s\n",
+- state->cmd->name, state->cmd->abbr,
+- state->cmd->usage ? state->cmd->usage : "");
++ const char *default_prefixes[] = {
++ "",
++ NULL,
++ };
++ const char *vlan_prefixes[] = {
++ "vlan <vdev> ",
++ "vid <vid> ",
++ NULL,
++ };
++ const char *linestart = "Usage:";
++ const char **prefixes;
++ const char **prefix;
++
++ switch (state->cmd->type) {
++ case SUBCOMMAND_VID:
++ prefixes = vlan_prefixes;
++ break;
++ default:
++ prefixes = default_prefixes;
++ break;
++ }
++
++ for (prefix = &prefixes[0]; *prefix; prefix++) {
++ fprintf(stderr, "%s batctl [options] %s%s|%s [parameters] %s\n",
++ linestart, *prefix, state->cmd->name, state->cmd->abbr,
++ state->cmd->usage ? state->cmd->usage : "");
++
++ linestart = " ";
++ }
+
+ fprintf(stderr, "parameters:\n");
+ fprintf(stderr, " \t -h print this help\n");
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 13 Jun 2019 21:12:15 +0200
+Subject: batctl: Integrate hardif setting framework
+
+batctl currently supports settings which are either mesh interface or vlan
+specific. But B.A.T.M.A.N. V introduced two additional settings which are
+hard (slave) interface specific.
+
+To support these, an additional command prefix called hardif is implemented
+for some sysfs commands:
+
+ $ batctl -m bat0 hardif eth0 ...
+
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Forwarded: https://patchwork.open-mesh.org/patch/17948/
+
+diff --git a/main.c b/main.c
+index 6ca13ac0ec4c82ee969be04737a339fd702b52bd..c806dbf4373fd082ff368cba391bdf14eebf4eae 100644
+--- a/main.c
++++ b/main.c
+@@ -35,7 +35,8 @@ static void print_usage(void)
+ {
+ .label = "commands:\n",
+ .types = BIT(SUBCOMMAND) |
+- BIT(SUBCOMMAND_VID),
++ BIT(SUBCOMMAND_VID) |
++ BIT(SUBCOMMAND_HIF),
+ },
+ {
+ .label = "debug tables: \tdisplay the corresponding debug table\n",
+@@ -51,6 +52,10 @@ static void print_usage(void)
+ "vid <vid> ",
+ NULL,
+ };
++ const char *hardif_prefixes[] = {
++ "hardif <netdev> ",
++ NULL,
++ };
+ const struct command **p;
+ const char **prefixes;
+ const char **prefix;
+@@ -81,6 +86,9 @@ static void print_usage(void)
+ case SUBCOMMAND_VID:
+ prefixes = vlan_prefixes;
+ break;
++ case SUBCOMMAND_HIF:
++ prefixes = hardif_prefixes;
++ break;
+ default:
+ prefixes = default_prefixes;
+ break;
+@@ -133,6 +141,12 @@ static const struct command *find_command(struct state *state, const char *name)
+ if (state->vid < 0 && cmd->type == SUBCOMMAND_VID)
+ continue;
+
++ if (state->hif > 0 && cmd->type != SUBCOMMAND_HIF)
++ continue;
++
++ if (state->hif == 0 && cmd->type == SUBCOMMAND_HIF)
++ continue;
++
+ if (strcmp(cmd->name, name) == 0)
+ return cmd;
+
+@@ -180,6 +194,18 @@ static int parse_dev_args(struct state *state, int argc, char *argv[])
+ state->arg_iface = argv[1];
+ translate_mesh_iface(state);
+
++ return 2;
++ } else if (strcmp(argv[0], "hardif") == 0) {
++ state->hif = if_nametoindex(argv[1]);
++ if (state->hif == 0) {
++ fprintf(stderr, "Error - hard interface not found\n");
++ return -ENODEV;
++ }
++
++ snprintf(state->hard_iface, sizeof(state->hard_iface), "%s",
++ argv[1]);
++
++ translate_mesh_iface(state);
+ return 2;
+ } else {
+ /* parse vlan as part of -m parameter */
+@@ -193,6 +219,7 @@ int main(int argc, char **argv)
+ const struct command *cmd;
+ struct state state = {
+ .arg_iface = mesh_dfl_iface,
++ .hif = 0,
+ .cmd = NULL,
+ };
+ int dev_arguments;
+diff --git a/main.h b/main.h
+index 1d952610aefb8367bd52e24bea8c04c3d70b94ea..a27d8486ef689206b27b1b50cb017b1b740e91c9 100644
+--- a/main.h
++++ b/main.h
+@@ -59,6 +59,7 @@ enum command_flags {
+ enum command_type {
+ SUBCOMMAND,
+ SUBCOMMAND_VID,
++ SUBCOMMAND_HIF,
+ DEBUGTABLE,
+ };
+
+@@ -66,6 +67,8 @@ struct state {
+ char *arg_iface;
+ char mesh_iface[IF_NAMESIZE];
+ unsigned int mesh_ifindex;
++ char hard_iface[IF_NAMESIZE];
++ unsigned int hif;
+ int vid;
+ const struct command *cmd;
+
+diff --git a/sys.c b/sys.c
+index f19719cfad61f36f2a5c1078305de83eb5be142a..fd34b2fa3bcf168a32bd53fc0df3f35d5532433f 100644
+--- a/sys.c
++++ b/sys.c
+@@ -150,6 +150,10 @@ static void settings_usage(struct state *state)
+ "vid <vid> ",
+ NULL,
+ };
++ const char *hardif_prefixes[] = {
++ "hardif <netdev> ",
++ NULL,
++ };
+ const char *linestart = "Usage:";
+ const char **prefixes;
+ const char **prefix;
+@@ -158,6 +162,9 @@ static void settings_usage(struct state *state)
+ case SUBCOMMAND_VID:
+ prefixes = vlan_prefixes;
+ break;
++ case SUBCOMMAND_HIF:
++ prefixes = hardif_prefixes;
++ break;
+ default:
+ prefixes = default_prefixes;
+ break;
+@@ -259,15 +266,23 @@ int handle_sys_setting(struct state *state, int argc, char **argv)
+ return EXIT_FAILURE;
+ }
+
+- /* if the specified interface is a VLAN then change the path to point
+- * to the proper "vlan%{vid}" subfolder in the sysfs tree.
+- */
+- if (state->vid >= 0)
++ if (state->hif > 0) {
++ /* if a hard interface was specified then change the path to
++ * point to the proper ${hardif}/batman-adv path in the sysfs
++ * tree.
++ */
++ snprintf(path_buff, PATH_BUFF_LEN, SYS_HARDIF_PATH,
++ state->hard_iface);
++ } else if (state->vid >= 0) {
++ /* if the specified interface is a VLAN then change the path to
++ * point to the proper "vlan%{vid}" subfolder in the sysfs tree.
++ */
+ snprintf(path_buff, PATH_BUFF_LEN, SYS_VLAN_PATH,
+ state->mesh_iface, state->vid);
+- else
++ } else {
+ snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT,
+ state->mesh_iface);
++ }
+
+ if (argc == 1) {
+ res = sys_read_setting(state, path_buff, settings->sysfs_name);
+diff --git a/sys.h b/sys.h
+index d4f2fcf542bc66b2b1c6ec55a9ac16e10fdc5cac..b6f0f9043a9af8e3c4d4f8bf7e4af4cab0aa5df9 100644
+--- a/sys.h
++++ b/sys.h
+@@ -21,8 +21,9 @@
+ #define SYS_BATIF_PATH_FMT "/sys/class/net/%s/mesh/"
+ #define SYS_IFACE_PATH "/sys/class/net"
+ #define SYS_IFACE_DIR SYS_IFACE_PATH"/%s/"
+-#define SYS_MESH_IFACE_FMT SYS_IFACE_PATH"/%s/batman_adv/mesh_iface"
+-#define SYS_IFACE_STATUS_FMT SYS_IFACE_PATH"/%s/batman_adv/iface_status"
++#define SYS_HARDIF_PATH SYS_IFACE_DIR "batman_adv/"
++#define SYS_MESH_IFACE_FMT SYS_HARDIF_PATH "mesh_iface"
++#define SYS_IFACE_STATUS_FMT SYS_HARDIF_PATH "iface_status"
+ #define SYS_VLAN_PATH SYS_IFACE_PATH"/%s/mesh/vlan%d/"
+ #define SYS_ROUTING_ALGO_FMT SYS_IFACE_PATH"/%s/mesh/routing_algo"
+ #define VLAN_ID_MAX_LEN 4
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 13 Jun 2019 21:12:16 +0200
+Subject: batctl: Add elp_interval setting command
+
+B.A.T.M.A.N. V introduced a hard interface specific setting called
+elp_interval. It defines the interval in milliseconds in which batman-adv
+emits probing packets for neighbor sensing (ELP).
+
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Forwarded: https://patchwork.open-mesh.org/patch/17949/
+
+diff --git a/Makefile b/Makefile
+index b7bd545e92963c62128efe60c0dc401bdd9fa023..f071da20f866bff6c162d697d2e43fa9d68ee08d 100755
+--- a/Makefile
++++ b/Makefile
+@@ -45,6 +45,7 @@ $(eval $(call add_command,bridge_loop_avoidance,y))
+ $(eval $(call add_command,claimtable,y))
+ $(eval $(call add_command,dat_cache,y))
+ $(eval $(call add_command,distributed_arp_table,y))
++$(eval $(call add_command,elp_interval,y))
+ $(eval $(call add_command,event,y))
+ $(eval $(call add_command,fragmentation,y))
+ $(eval $(call add_command,gateways,y))
+diff --git a/README.rst b/README.rst
+index bc54412bc77dae1889d4f05298c34efc1966776b..92983aa6030e2a890283bca448b9203cd4d56b51 100644
+--- a/README.rst
++++ b/README.rst
+@@ -386,6 +386,22 @@ Example::
+ 1000
+
+
++batctl elp interval
++===================
++
++display or modify the elp interval in ms for hard interface
++
++Usage::
++
++ batctl hardif $hardif elp_interval|et [interval]
++
++Example::
++
++ $ batctl hardif eth0 elp_interval 200
++ $ batctl hardif eth0 elp_interval
++ 200
++
++
+ batctl loglevel
+ ===============
+
+diff --git a/elp_interval.c b/elp_interval.c
+new file mode 100644
+index 0000000000000000000000000000000000000000..0a5e98923a622f52e523696b1ec1bfb856eeca9f
+--- /dev/null
++++ b/elp_interval.c
+@@ -0,0 +1,111 @@
++// SPDX-License-Identifier: GPL-2.0
++/* Copyright (C) 2009-2019 B.A.T.M.A.N. contributors:
++ *
++ * Marek Lindner <mareklindner@neomailbox.ch>
++ *
++ * License-Filename: LICENSES/preferred/GPL-2.0
++ */
++
++#include <errno.h>
++#include <stddef.h>
++#include <stdint.h>
++#include <string.h>
++
++#include "main.h"
++#include "sys.h"
++
++static struct elp_interval_data {
++ uint32_t elp_interval;
++} elp_interval;
++
++static int parse_elp_interval(struct state *state, int argc, char *argv[])
++{
++ struct settings_data *settings = state->cmd->arg;
++ struct elp_interval_data *data = settings->data;
++ char *endptr;
++
++ if (argc != 2) {
++ fprintf(stderr, "Error - incorrect number of arguments (expected 1)\n");
++ return -EINVAL;
++ }
++
++ data->elp_interval = strtoul(argv[1], &endptr, 0);
++ if (!endptr || *endptr != '\0') {
++ fprintf(stderr, "Error - the supplied argument is invalid: %s\n", argv[1]);
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
++static int print_elp_interval(struct nl_msg *msg, void *arg)
++{
++ struct nlattr *attrs[BATADV_ATTR_MAX + 1];
++ struct nlmsghdr *nlh = nlmsg_hdr(msg);
++ struct genlmsghdr *ghdr;
++ int *result = arg;
++
++ if (!genlmsg_valid_hdr(nlh, 0))
++ return NL_OK;
++
++ ghdr = nlmsg_data(nlh);
++
++ if (nla_parse(attrs, BATADV_ATTR_MAX, genlmsg_attrdata(ghdr, 0),
++ genlmsg_len(ghdr), batadv_netlink_policy)) {
++ return NL_OK;
++ }
++
++ if (!attrs[BATADV_ATTR_ELP_INTERVAL])
++ return NL_OK;
++
++ printf("%u\n", nla_get_u32(attrs[BATADV_ATTR_ELP_INTERVAL]));
++
++ *result = 0;
++ return NL_STOP;
++}
++
++static int get_attrs_elp_interval(struct nl_msg *msg, void *arg)
++{
++ struct state *state = arg;
++
++ nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX, state->hif);
++
++ return 0;
++}
++
++static int get_elp_interval(struct state *state)
++{
++ return sys_simple_nlquery(state, BATADV_CMD_GET_HARDIF,
++ get_attrs_elp_interval, print_elp_interval);
++}
++
++static int set_attrs_elp_interval(struct nl_msg *msg, void *arg)
++{
++ struct state *state = arg;
++ struct settings_data *settings = state->cmd->arg;
++ struct elp_interval_data *data = settings->data;
++
++ nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX, state->hif);
++ nla_put_u32(msg, BATADV_ATTR_ELP_INTERVAL, data->elp_interval);
++
++ return 0;
++}
++
++static int set_elp_interval(struct state *state)
++{
++ return sys_simple_nlquery(state, BATADV_CMD_SET_HARDIF,
++ set_attrs_elp_interval, NULL);
++}
++
++static struct settings_data batctl_settings_elp_interval = {
++ .sysfs_name = "elp_interval",
++ .data = &elp_interval,
++ .parse = parse_elp_interval,
++ .netlink_get = get_elp_interval,
++ .netlink_set = set_elp_interval,
++};
++
++COMMAND_NAMED(SUBCOMMAND_HIF, elp_interval, "et", handle_sys_setting,
++ COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
++ &batctl_settings_elp_interval,
++ "[interval] \tdisplay or modify elp_interval setting");
+diff --git a/man/batctl.8 b/man/batctl.8
+index acb4288c4e6f59b322d20631ef8e3aee6f2215e5..690da023fd1ac6f51915a9167e92030a650fe1bd 100644
+--- a/man/batctl.8
++++ b/man/batctl.8
+@@ -93,6 +93,10 @@ the bonding mode.
+ batctl will monitor for events from the netlink kernel interface of batman-adv. The local timestamp of the event will be printed
+ when parameter \fB\-t\fP is specified. Parameter \fB\-r\fP will do the same but with relative timestamps.
+ .br
++.IP "\fBhardif <hardif>\fP \fBelp_interval\fP|\fBet\fP [\fBinterval\fP]"
++If no parameter is given the current ELP interval setting of the hard interface is displayed otherwise the parameter is used to set the
++ELP interval. The interval is in units of milliseconds.
++.br
+ .IP "\fBfragmentation\fP|\fBf\fP [\fB0\fP|\fB1\fP]"
+ If no parameter is given the current fragmentation mode setting is displayed. Otherwise the parameter is used to enable or
+ disable fragmentation.
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 13 Jun 2019 21:12:17 +0200
+Subject: batctl: Add throughput_override setting command
+
+B.A.T.M.A.N. V introduced a hard interface specific setting called
+throughput. It defines the throughput value to be used by B.A.T.M.A.N. V
+when estimating the link throughput using this interface. If the value is
+set to 0 then batman-adv will try to estimate the throughput by itself.
+
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Forwarded: https://patchwork.open-mesh.org/patch/17950/
+
+diff --git a/Makefile b/Makefile
+index f071da20f866bff6c162d697d2e43fa9d68ee08d..e3747a2a28eb34323e34a1e22f5507dd1d7cd0f6 100755
+--- a/Makefile
++++ b/Makefile
+@@ -67,6 +67,7 @@ $(eval $(call add_command,ping,y))
+ $(eval $(call add_command,routing_algo,y))
+ $(eval $(call add_command,statistics,y))
+ $(eval $(call add_command,tcpdump,y))
++$(eval $(call add_command,throughput_override,y))
+ $(eval $(call add_command,throughputmeter,y))
+ $(eval $(call add_command,traceroute,y))
+ $(eval $(call add_command,transglobal,y))
+diff --git a/README.rst b/README.rst
+index 92983aa6030e2a890283bca448b9203cd4d56b51..128f539852fa085d023fb6d26ae436e76b617bb6 100644
+--- a/README.rst
++++ b/README.rst
+@@ -402,6 +402,23 @@ Example::
+ 200
+
+
++batctl throughput override
++==========================
++
++display or modify the throughput override in kbit/s for hard interface
++
++Usage::
++
++ batctl hardif $hardif throughput_override|to [kbit]
++
++Example::
++
++ $ batctl hardif eth0 throughput_override 15000
++ $ batctl hardif eth0 throughput_override 15mbit
++ $ batctl hardif eth0 throughput_override
++ 15.0 MBit
++
++
+ batctl loglevel
+ ===============
+
+diff --git a/man/batctl.8 b/man/batctl.8
+index 690da023fd1ac6f51915a9167e92030a650fe1bd..b8218963712bbf0cc9470459896fc904cd393748 100644
+--- a/man/batctl.8
++++ b/man/batctl.8
+@@ -203,6 +203,12 @@ supported routing algorithms are displayed.
+ Otherwise the parameter is used to select the routing algorithm for the following
+ batX interface to be created.
+ .br
++.IP "\fBhardif <hardif>\fP \fBthroughput_override|to\fP [\fBbandwidth\fP]\fP"
++If no parameter is given the current througput override is displayed otherwise
++the parameter is used to set the throughput override for the specified hard
++interface.
++Just enter any number (optionally followed by "kbit" or "mbit").
++.br
+ .IP "\fBisolation_mark\fP|\fBmark\fP"
+ If no parameter is given the current isolation mark value is displayed.
+ Otherwise the parameter is used to set or unset the isolation mark used by the
+diff --git a/throughput_override.c b/throughput_override.c
+new file mode 100644
+index 0000000000000000000000000000000000000000..28a6588b9417cca213ebde3545a3eb425592ad89
+--- /dev/null
++++ b/throughput_override.c
+@@ -0,0 +1,113 @@
++// SPDX-License-Identifier: GPL-2.0
++/* Copyright (C) 2009-2019 B.A.T.M.A.N. contributors:
++ *
++ * Marek Lindner <mareklindner@neomailbox.ch>
++ *
++ * License-Filename: LICENSES/preferred/GPL-2.0
++ */
++
++#include <errno.h>
++#include <stddef.h>
++#include <stdint.h>
++#include <string.h>
++
++#include "functions.h"
++#include "main.h"
++#include "sys.h"
++
++static struct throughput_override_data {
++ uint32_t throughput_override;
++} throughput_override;
++
++static int parse_throughput_override(struct state *state, int argc, char *argv[])
++{
++ struct settings_data *settings = state->cmd->arg;
++ struct throughput_override_data *data = settings->data;
++ bool ret;
++
++ if (argc != 2) {
++ fprintf(stderr, "Error - incorrect number of arguments (expected 1)\n");
++ return -EINVAL;
++ }
++
++ ret = parse_throughput(argv[1], "throughput override",
++ &data->throughput_override);
++ if (!ret)
++ return -EINVAL;
++
++ return 0;
++}
++
++static int print_throughput_override(struct nl_msg *msg, void *arg)
++{
++ struct nlattr *attrs[BATADV_ATTR_MAX + 1];
++ struct nlmsghdr *nlh = nlmsg_hdr(msg);
++ struct genlmsghdr *ghdr;
++ int *result = arg;
++ uint32_t mbit;
++
++ if (!genlmsg_valid_hdr(nlh, 0))
++ return NL_OK;
++
++ ghdr = nlmsg_data(nlh);
++
++ if (nla_parse(attrs, BATADV_ATTR_MAX, genlmsg_attrdata(ghdr, 0),
++ genlmsg_len(ghdr), batadv_netlink_policy)) {
++ return NL_OK;
++ }
++
++ if (!attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE])
++ return NL_OK;
++
++ mbit = nla_get_u32(attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE]);
++ printf("%u.%u MBit\n", mbit / 10, mbit % 10);
++
++ *result = 0;
++ return NL_STOP;
++}
++
++static int get_attrs_elp_isolation(struct nl_msg *msg, void *arg)
++{
++ struct state *state = arg;
++
++ nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX, state->hif);
++
++ return 0;
++}
++
++static int get_throughput_override(struct state *state)
++{
++ return sys_simple_nlquery(state, BATADV_CMD_GET_HARDIF,
++ get_attrs_elp_isolation, print_throughput_override);
++}
++
++static int set_attrs_throughput_override(struct nl_msg *msg, void *arg)
++{
++ struct state *state = arg;
++ struct settings_data *settings = state->cmd->arg;
++ struct throughput_override_data *data = settings->data;
++
++ nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX, state->hif);
++ nla_put_u32(msg, BATADV_ATTR_THROUGHPUT_OVERRIDE, data->throughput_override);
++
++ return 0;
++}
++
++static int set_throughput_override(struct state *state)
++{
++ return sys_simple_nlquery(state, BATADV_CMD_SET_HARDIF,
++ set_attrs_throughput_override, NULL);
++}
++
++static struct settings_data batctl_settings_throughput_override = {
++ .sysfs_name = "throughput_override",
++ .data = &throughput_override,
++ .parse = parse_throughput_override,
++ .netlink_get = get_throughput_override,
++ .netlink_set = set_throughput_override,
++};
++
++COMMAND_NAMED(SUBCOMMAND_HIF, throughput_override, "to", handle_sys_setting,
++ COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
++ &batctl_settings_throughput_override,
++ "[mbit] \tdisplay or modify throughput_override setting");
PKG_NAME:=batman-adv
PKG_VERSION:=2019.2
-PKG_RELEASE:=1
+PKG_RELEASE:=4
PKG_HASH:=70c3f6a6cf88d2b25681a76768a52ed92d9fe992ba8e358368b6a8088757adc8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
}
proto_batadv_hardif_init_config() {
+ proto_config_add_int 'elp_interval'
proto_config_add_string "master"
+ proto_config_add_string 'throughput_override'
}
proto_batadv_hardif_setup() {
local config="$1"
local iface="$2"
+ local elp_interval
local master
+ local throughput_override
+ json_get_vars elp_interval
json_get_vars master
+ json_get_vars throughput_override
( proto_add_host_dependency "$config" '' "$master" )
batctl -m "$master" interface -M add "$iface"
+ [ -n "$elp_interval" ] && batctl -m "$master" hardif "$iface" elp_interval "$elp_interval"
+ [ -n "$throughput_override" ] && batctl -m "$master" hardif "$iface" throughput_override "$throughput_override"
+
proto_init_update "$iface" 1
proto_send_update "$config"
}
init_proto "$@"
proto_batadv_vlan_init_config() {
- proto_config_add_string "ap_isolation"
+ proto_config_add_boolean 'ap_isolation:bool'
}
proto_batadv_vlan_setup() {
json_get_vars ap_isolation
- batctl -m "$iface" ap_isolation "$ap_isolation"
+ [ -n "$ap_isolation" ] && batctl -m "$iface" ap_isolation "$ap_isolation"
proto_init_update "$iface" 1
proto_send_update "$config"
}
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Thu, 23 May 2019 19:26:27 +0200
-Subject: Revert "batman-adv: convert stream-like files from nonseekable_open -> stream_open"
-
-OpenWrt's mac80211 package is not yet ready to support the generic netlink
-API of Linux 5.2.
-
-This reverts commit 337ae19a00d4455cf84afa58abfb432f78c882b9.
-
-diff --git a/compat-include/linux/fs.h b/compat-include/linux/fs.h
-index 480722f04ba7ddefc837d5e55a340271e0814b14..c52e0e8e87584d106ab64ef2c522e6ac1ff6e796 100644
---- a/compat-include/linux/fs.h
-+++ b/compat-include/linux/fs.h
-@@ -31,15 +31,4 @@ static inline struct dentry *batadv_file_dentry(const struct file *file)
-
- #endif /* < KERNEL_VERSION(4, 6, 0) */
-
--#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
--
--static inline int batadv_stream_open(struct inode *inode, struct file *filp)
--{
-- return nonseekable_open(inode, filp);
--}
--
--#define stream_open batadv_stream_open
--
--#endif /* < KERNEL_VERSION(5, 2, 0) */
--
- #endif /* _NET_BATMAN_ADV_COMPAT_LINUX_FS_H_ */
-diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
-index 0a91c8661357d4ddbea1ba20dcd0df67b8ba5a97..de81b5ecad91afd8d684edbf781c70a3bae38c60 100644
---- a/net/batman-adv/icmp_socket.c
-+++ b/net/batman-adv/icmp_socket.c
-@@ -65,7 +65,7 @@ static int batadv_socket_open(struct inode *inode, struct file *file)
-
- batadv_debugfs_deprecated(file, "");
-
-- stream_open(inode, file);
-+ nonseekable_open(inode, file);
-
- socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL);
- if (!socket_client) {
-diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c
-index f79ebd5b46e95b3b6de717c7ea1ecf44e5c96051..60ce11e16a905e790424a2d7aca81c1f945c1ec2 100644
---- a/net/batman-adv/log.c
-+++ b/net/batman-adv/log.c
-@@ -90,7 +90,7 @@ static int batadv_log_open(struct inode *inode, struct file *file)
- batadv_debugfs_deprecated(file,
- "Use tracepoint batadv:batadv_dbg instead\n");
-
-- stream_open(inode, file);
-+ nonseekable_open(inode, file);
- file->private_data = inode->i_private;
- return 0;
- }
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sun, 2 Jun 2019 10:57:31 +0200
+Subject: batman-adv: Fix duplicated OGMs on NETDEV_UP
+
+The state of slave interfaces are handled differently depending on whether
+the interface is up or not. All active interfaces (IFF_UP) will transmit
+OGMs. But for B.A.T.M.A.N. IV, also non-active interfaces are scheduling
+(low TTL) OGMs on active interfaces. The code which setups and schedules
+the OGMs must therefore already be called when the interfaces gets added as
+slave interface and the transmit function must then check whether it has to
+send out the OGM or not on the specific slave interface.
+
+But the commit 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule
+API calls") moved the setup code from the enable function to the activate
+function. The latter is called either when the added slave was already up
+when batadv_hardif_enable_interface processed the new interface or when a
+NETDEV_UP event was received for this slave interfac. As result, each
+NETDEV_UP would schedule a new OGM worker for the interface and thus OGMs
+would be send a lot more than expected.
+
+Fixes: 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule API calls")
+Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/c92331e0df3c0c5645ee5a897eb018c5da5e4aa5
+
+diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
+index bd4138ddf7e09a0020d9842d603dc98f21e225c7..240ed70912d6a014c0a48280741989133034396c 100644
+--- a/net/batman-adv/bat_iv_ogm.c
++++ b/net/batman-adv/bat_iv_ogm.c
+@@ -2337,7 +2337,7 @@ batadv_iv_ogm_neigh_is_sob(struct batadv_neigh_node *neigh1,
+ return ret;
+ }
+
+-static void batadv_iv_iface_activate(struct batadv_hard_iface *hard_iface)
++static void batadv_iv_iface_enabled(struct batadv_hard_iface *hard_iface)
+ {
+ /* begin scheduling originator messages on that interface */
+ batadv_iv_ogm_schedule(hard_iface);
+@@ -2683,8 +2683,8 @@ static void batadv_iv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
+ static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
+ .name = "BATMAN_IV",
+ .iface = {
+- .activate = batadv_iv_iface_activate,
+ .enable = batadv_iv_ogm_iface_enable,
++ .enabled = batadv_iv_iface_enabled,
+ .disable = batadv_iv_ogm_iface_disable,
+ .update_mac = batadv_iv_ogm_iface_update_mac,
+ .primary_set = batadv_iv_ogm_primary_iface_set,
+diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
+index 79d1731b83066c60f9aef958d2bc343233bce67a..3719cfd026f04093f5d86ffe1b41a41849b2af62 100644
+--- a/net/batman-adv/hard-interface.c
++++ b/net/batman-adv/hard-interface.c
+@@ -795,6 +795,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
+
+ batadv_hardif_recalc_extra_skbroom(soft_iface);
+
++ if (bat_priv->algo_ops->iface.enabled)
++ bat_priv->algo_ops->iface.enabled(hard_iface);
++
+ out:
+ return 0;
+
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
+index 74b644738a36bfe063eef6df016278b45a1a0256..e0b25104cbfa9f715df364658621c29faa7ad637 100644
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -2129,6 +2129,9 @@ struct batadv_algo_iface_ops {
+ /** @enable: init routing info when hard-interface is enabled */
+ int (*enable)(struct batadv_hard_iface *hard_iface);
+
++ /** @enabled: notification when hard-interface was enabled (optional) */
++ void (*enabled)(struct batadv_hard_iface *hard_iface);
++
+ /** @disable: de-init routing info when hard-interface is disabled */
+ void (*disable)(struct batadv_hard_iface *hard_iface);
+
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Thu, 23 May 2019 19:26:36 +0200
-Subject: Revert "batman-adv: compat: Drop support for genl_ops->start"
-
-OpenWrt's mac80211 package is not yet ready to support the generic netlink
-API of Linux 5.2.
-
-This reverts commit 1d30dbe3917d0d6fdb8ba473dfdd6265ac46670b.
-
-diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h
-index ee5b82288be97193c1a8e8340a2ea7e0c7ce112c..fbfdb733a3dd63c251def43cae416c7fe32cadab 100644
---- a/compat-include/net/genetlink.h
-+++ b/compat-include/net/genetlink.h
-@@ -42,6 +42,7 @@ enum genl_validate_flags {
- struct batadv_genl_ops {
- int (*doit)(struct sk_buff *skb,
- struct genl_info *info);
-+ int (*start)(struct netlink_callback *cb);
- int (*dumpit)(struct sk_buff *skb,
- struct netlink_callback *cb);
- int (*done)(struct netlink_callback *cb);
-@@ -104,6 +105,7 @@ static inline int batadv_genl_register_family(struct batadv_genl_family *family)
-
- for (i = 0; i < family->family.n_ops; i++) {
- ops[i].doit = family->ops[i].doit;
-+ ops[i].start = family->ops[i].start;
- ops[i].dumpit = family->ops[i].dumpit;
- ops[i].done = family->ops[i].done;
- ops[i].cmd = family->ops[i].cmd;
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Thu, 23 May 2019 19:26:45 +0200
-Subject: Revert "batman-adv: genetlink: optionally validate strictly/dumps"
-
-OpenWrt's mac80211 package is not yet ready to support the generic netlink
-API of Linux 5.2.
-
-This reverts commit 2ee47abaeb35ca62bb909830e10b0e973393b853.
-
-diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h
-index fbfdb733a3dd63c251def43cae416c7fe32cadab..7d17a705273650355f074788e9220fc4981b0db1 100644
---- a/compat-include/net/genetlink.h
-+++ b/compat-include/net/genetlink.h
-@@ -33,25 +33,6 @@ void batadv_genl_dump_check_consistent(struct netlink_callback *cb,
-
- #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
-
--enum genl_validate_flags {
-- GENL_DONT_VALIDATE_STRICT = BIT(0),
-- GENL_DONT_VALIDATE_DUMP = BIT(1),
-- GENL_DONT_VALIDATE_DUMP_STRICT = BIT(2),
--};
--
--struct batadv_genl_ops {
-- int (*doit)(struct sk_buff *skb,
-- struct genl_info *info);
-- int (*start)(struct netlink_callback *cb);
-- int (*dumpit)(struct sk_buff *skb,
-- struct netlink_callback *cb);
-- int (*done)(struct netlink_callback *cb);
-- u8 cmd;
-- u8 internal_flags;
-- u8 flags;
-- u8 validate;
--};
--
- struct batadv_genl_family {
- /* data handled by the actual kernel */
- struct genl_family family;
-@@ -69,7 +50,7 @@ struct batadv_genl_family {
- struct genl_info *info);
- void (*post_doit)(const struct genl_ops *ops, struct sk_buff *skb,
- struct genl_info *info);
-- const struct batadv_genl_ops *ops;
-+ const struct genl_ops *ops;
- const struct genl_multicast_group *mcgrps;
- unsigned int n_ops;
- unsigned int n_mcgrps;
-@@ -82,6 +63,8 @@ struct batadv_genl_family {
- struct genl_ops *copy_ops;
- };
-
-+#define genl_family batadv_genl_family
-+
- static inline int batadv_genl_register_family(struct batadv_genl_family *family)
- {
- struct genl_ops *ops;
-@@ -99,20 +82,12 @@ static inline int batadv_genl_register_family(struct batadv_genl_family *family)
- family->family.n_mcgrps = family->n_mcgrps;
- family->family.module = family->module;
-
-- ops = kzalloc(sizeof(*ops) * family->n_ops, GFP_KERNEL);
-+ ops = kmemdup(family->ops, sizeof(*ops) * family->n_ops, GFP_KERNEL);
- if (!ops)
- return -ENOMEM;
-
-- for (i = 0; i < family->family.n_ops; i++) {
-- ops[i].doit = family->ops[i].doit;
-- ops[i].start = family->ops[i].start;
-- ops[i].dumpit = family->ops[i].dumpit;
-- ops[i].done = family->ops[i].done;
-- ops[i].cmd = family->ops[i].cmd;
-- ops[i].internal_flags = family->ops[i].internal_flags;
-- ops[i].flags = family->ops[i].flags;
-+ for (i = 0; i < family->family.n_ops; i++)
- ops[i].policy = family->policy;
-- }
-
- family->family.ops = ops;
- family->copy_ops = ops;
-@@ -120,17 +95,6 @@ static inline int batadv_genl_register_family(struct batadv_genl_family *family)
- return genl_register_family(&family->family);
- }
-
--typedef struct genl_ops batadv_genl_ops_old;
--
--#define batadv_pre_doit(__x, __y, __z) \
-- batadv_pre_doit(const batadv_genl_ops_old *ops, __y, __z)
--
--#define batadv_post_doit(__x, __y, __z) \
-- batadv_post_doit(const batadv_genl_ops_old *ops, __y, __z)
--
--#define genl_ops batadv_genl_ops
--#define genl_family batadv_genl_family
--
- #define genl_register_family(family) \
- batadv_genl_register_family((family))
-
-diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
-index a67720fad46ca496c932c0306e2f7ec4ed496fc9..e7907308b331ddc3e4917ff7d648bca27a65536b 100644
---- a/net/batman-adv/netlink.c
-+++ b/net/batman-adv/netlink.c
-@@ -1343,34 +1343,29 @@ static void batadv_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
- static const struct genl_ops batadv_netlink_ops[] = {
- {
- .cmd = BATADV_CMD_GET_MESH,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- /* can be retrieved by unprivileged users */
- .doit = batadv_netlink_get_mesh,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_TP_METER,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .doit = batadv_netlink_tp_meter_start,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_TP_METER_CANCEL,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .doit = batadv_netlink_tp_meter_cancel,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_GET_ROUTING_ALGOS,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_algo_dump,
- },
- {
- .cmd = BATADV_CMD_GET_HARDIF,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- /* can be retrieved by unprivileged users */
- .dumpit = batadv_netlink_dump_hardif,
- .doit = batadv_netlink_get_hardif,
-@@ -1379,68 +1374,57 @@ static const struct genl_ops batadv_netlink_ops[] = {
- },
- {
- .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_tt_local_dump,
- },
- {
- .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_tt_global_dump,
- },
- {
- .cmd = BATADV_CMD_GET_ORIGINATORS,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_orig_dump,
- },
- {
- .cmd = BATADV_CMD_GET_NEIGHBORS,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_hardif_neigh_dump,
- },
- {
- .cmd = BATADV_CMD_GET_GATEWAYS,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_gw_dump,
- },
- {
- .cmd = BATADV_CMD_GET_BLA_CLAIM,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_bla_claim_dump,
- },
- {
- .cmd = BATADV_CMD_GET_BLA_BACKBONE,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_bla_backbone_dump,
- },
- {
- .cmd = BATADV_CMD_GET_DAT_CACHE,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_dat_cache_dump,
- },
- {
- .cmd = BATADV_CMD_GET_MCAST_FLAGS,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .dumpit = batadv_mcast_flags_dump,
- },
- {
- .cmd = BATADV_CMD_SET_MESH,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .doit = batadv_netlink_set_mesh,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_SET_HARDIF,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .doit = batadv_netlink_set_hardif,
- .internal_flags = BATADV_FLAG_NEED_MESH |
-@@ -1448,7 +1432,6 @@ static const struct genl_ops batadv_netlink_ops[] = {
- },
- {
- .cmd = BATADV_CMD_GET_VLAN,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- /* can be retrieved by unprivileged users */
- .doit = batadv_netlink_get_vlan,
- .internal_flags = BATADV_FLAG_NEED_MESH |
-@@ -1456,7 +1439,6 @@ static const struct genl_ops batadv_netlink_ops[] = {
- },
- {
- .cmd = BATADV_CMD_SET_VLAN,
-- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
- .doit = batadv_netlink_set_vlan,
- .internal_flags = BATADV_FLAG_NEED_MESH |
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Thu, 23 May 2019 19:26:58 +0200
-Subject: Revert "batman-adv: genetlink: make policy common to family"
-
-OpenWrt's mac80211 package is not yet ready to support the generic netlink
-API of Linux 5.2.
-
-This reverts commit acfc9a214d01695d1676313ca80cfd2d9309f633.
-
-diff --git a/compat-include/linux/cache.h b/compat-include/linux/cache.h
-index 9ddda31232ed4b58efcb57dc2ee99ae82d09d6e2..efe440d11d04a1c3999649ba52058ad82e4d6bea 100644
---- a/compat-include/linux/cache.h
-+++ b/compat-include/linux/cache.h
-@@ -13,8 +13,12 @@
- #include <linux/version.h>
- #include_next <linux/cache.h>
-
--#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
-
-+/* hack for netlink.c which marked the family ops as ro */
-+#ifdef __ro_after_init
-+#undef __ro_after_init
-+#endif
- #define __ro_after_init
-
- #endif /* < KERNEL_VERSION(4, 6, 0) */
-diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h
-index 7d17a705273650355f074788e9220fc4981b0db1..58fc24d7147a7f79c2db1976b36351d294f2aa4c 100644
---- a/compat-include/net/genetlink.h
-+++ b/compat-include/net/genetlink.h
-@@ -30,92 +30,4 @@ void batadv_genl_dump_check_consistent(struct netlink_callback *cb,
-
- #endif /* < KERNEL_VERSION(4, 15, 0) */
-
--
--#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
--
--struct batadv_genl_family {
-- /* data handled by the actual kernel */
-- struct genl_family family;
--
-- /* data which has to be copied to family by
-- * batadv_genl_register_family
-- */
-- unsigned int hdrsize;
-- char name[GENL_NAMSIZ];
-- unsigned int version;
-- unsigned int maxattr;
-- const struct nla_policy *policy;
-- bool netnsok;
-- int (*pre_doit)(const struct genl_ops *ops, struct sk_buff *skb,
-- struct genl_info *info);
-- void (*post_doit)(const struct genl_ops *ops, struct sk_buff *skb,
-- struct genl_info *info);
-- const struct genl_ops *ops;
-- const struct genl_multicast_group *mcgrps;
-- unsigned int n_ops;
-- unsigned int n_mcgrps;
-- struct module *module;
--
-- /* allocated by batadv_genl_register_family and free'd by
-- * batadv_genl_unregister_family. Used to modify the usually read-only
-- * ops
-- */
-- struct genl_ops *copy_ops;
--};
--
--#define genl_family batadv_genl_family
--
--static inline int batadv_genl_register_family(struct batadv_genl_family *family)
--{
-- struct genl_ops *ops;
-- unsigned int i;
--
-- family->family.hdrsize = family->hdrsize;
-- strncpy(family->family.name, family->name, sizeof(family->family.name));
-- family->family.version = family->version;
-- family->family.maxattr = family->maxattr;
-- family->family.netnsok = family->netnsok;
-- family->family.pre_doit = family->pre_doit;
-- family->family.post_doit = family->post_doit;
-- family->family.mcgrps = family->mcgrps;
-- family->family.n_ops = family->n_ops;
-- family->family.n_mcgrps = family->n_mcgrps;
-- family->family.module = family->module;
--
-- ops = kmemdup(family->ops, sizeof(*ops) * family->n_ops, GFP_KERNEL);
-- if (!ops)
-- return -ENOMEM;
--
-- for (i = 0; i < family->family.n_ops; i++)
-- ops[i].policy = family->policy;
--
-- family->family.ops = ops;
-- family->copy_ops = ops;
--
-- return genl_register_family(&family->family);
--}
--
--#define genl_register_family(family) \
-- batadv_genl_register_family((family))
--
--static inline void
--batadv_genl_unregister_family(struct batadv_genl_family *family)
--{
--
-- genl_unregister_family(&family->family);
-- kfree(family->copy_ops);
--}
--
--#define genl_unregister_family(family) \
-- batadv_genl_unregister_family((family))
--
--#define genlmsg_put(_skb, _pid, _seq, _family, _flags, _cmd) \
-- genlmsg_put(_skb, _pid, _seq, &(_family)->family, _flags, _cmd)
--
--#define genlmsg_multicast_netns(_family, _net, _skb, _portid, _group, _flags) \
-- genlmsg_multicast_netns(&(_family)->family, _net, _skb, _portid, \
-- _group, _flags)
--
--#endif /* < KERNEL_VERSION(5, 2, 0) */
--
- #endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */
-diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
-index e7907308b331ddc3e4917ff7d648bca27a65536b..daf56933223d478399c63360203bcf283d7686a3 100644
---- a/net/batman-adv/netlink.c
-+++ b/net/batman-adv/netlink.c
-@@ -1344,29 +1344,34 @@ static const struct genl_ops batadv_netlink_ops[] = {
- {
- .cmd = BATADV_CMD_GET_MESH,
- /* can be retrieved by unprivileged users */
-+ .policy = batadv_netlink_policy,
- .doit = batadv_netlink_get_mesh,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_TP_METER,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .doit = batadv_netlink_tp_meter_start,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_TP_METER_CANCEL,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .doit = batadv_netlink_tp_meter_cancel,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_GET_ROUTING_ALGOS,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_algo_dump,
- },
- {
- .cmd = BATADV_CMD_GET_HARDIF,
- /* can be retrieved by unprivileged users */
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_netlink_dump_hardif,
- .doit = batadv_netlink_get_hardif,
- .internal_flags = BATADV_FLAG_NEED_MESH |
-@@ -1375,57 +1380,68 @@ static const struct genl_ops batadv_netlink_ops[] = {
- {
- .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_tt_local_dump,
- },
- {
- .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_tt_global_dump,
- },
- {
- .cmd = BATADV_CMD_GET_ORIGINATORS,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_orig_dump,
- },
- {
- .cmd = BATADV_CMD_GET_NEIGHBORS,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_hardif_neigh_dump,
- },
- {
- .cmd = BATADV_CMD_GET_GATEWAYS,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_gw_dump,
- },
- {
- .cmd = BATADV_CMD_GET_BLA_CLAIM,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_bla_claim_dump,
- },
- {
- .cmd = BATADV_CMD_GET_BLA_BACKBONE,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_bla_backbone_dump,
- },
- {
- .cmd = BATADV_CMD_GET_DAT_CACHE,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_dat_cache_dump,
- },
- {
- .cmd = BATADV_CMD_GET_MCAST_FLAGS,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .dumpit = batadv_mcast_flags_dump,
- },
- {
- .cmd = BATADV_CMD_SET_MESH,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .doit = batadv_netlink_set_mesh,
- .internal_flags = BATADV_FLAG_NEED_MESH,
- },
- {
- .cmd = BATADV_CMD_SET_HARDIF,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .doit = batadv_netlink_set_hardif,
- .internal_flags = BATADV_FLAG_NEED_MESH |
- BATADV_FLAG_NEED_HARDIF,
-@@ -1433,6 +1449,7 @@ static const struct genl_ops batadv_netlink_ops[] = {
- {
- .cmd = BATADV_CMD_GET_VLAN,
- /* can be retrieved by unprivileged users */
-+ .policy = batadv_netlink_policy,
- .doit = batadv_netlink_get_vlan,
- .internal_flags = BATADV_FLAG_NEED_MESH |
- BATADV_FLAG_NEED_VLAN,
-@@ -1440,6 +1457,7 @@ static const struct genl_ops batadv_netlink_ops[] = {
- {
- .cmd = BATADV_CMD_SET_VLAN,
- .flags = GENL_ADMIN_PERM,
-+ .policy = batadv_netlink_policy,
- .doit = batadv_netlink_set_vlan,
- .internal_flags = BATADV_FLAG_NEED_MESH |
- BATADV_FLAG_NEED_VLAN,
-@@ -1451,7 +1469,6 @@ struct genl_family batadv_netlink_family __ro_after_init = {
- .name = BATADV_NL_NAME,
- .version = 1,
- .maxattr = BATADV_ATTR_MAX,
-- .policy = batadv_netlink_policy,
- .netnsok = true,
- .pre_doit = batadv_pre_doit,
- .post_doit = batadv_post_doit,
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Sun, 2 Jun 2019 10:57:31 +0200
-Subject: batman-adv: Fix duplicated OGMs on NETDEV_UP
-
-The state of slave interfaces are handled differently depending on whether
-the interface is up or not. All active interfaces (IFF_UP) will transmit
-OGMs. But for B.A.T.M.A.N. IV, also non-active interfaces are scheduling
-(low TTL) OGMs on active interfaces. The code which setups and schedules
-the OGMs must therefore already be called when the interfaces gets added as
-slave interface and the transmit function must then check whether it has to
-send out the OGM or not on the specific slave interface.
-
-But the commit 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule
-API calls") moved the setup code from the enable function to the activate
-function. The latter is called either when the added slave was already up
-when batadv_hardif_enable_interface processed the new interface or when a
-NETDEV_UP event was received for this slave interfac. As result, each
-NETDEV_UP would schedule a new OGM worker for the interface and thus OGMs
-would be send a lot more than expected.
-
-Fixes: 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule API calls")
-Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-
-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/c92331e0df3c0c5645ee5a897eb018c5da5e4aa5
-
-diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
-index bd4138ddf7e09a0020d9842d603dc98f21e225c7..240ed70912d6a014c0a48280741989133034396c 100644
---- a/net/batman-adv/bat_iv_ogm.c
-+++ b/net/batman-adv/bat_iv_ogm.c
-@@ -2337,7 +2337,7 @@ batadv_iv_ogm_neigh_is_sob(struct batadv_neigh_node *neigh1,
- return ret;
- }
-
--static void batadv_iv_iface_activate(struct batadv_hard_iface *hard_iface)
-+static void batadv_iv_iface_enabled(struct batadv_hard_iface *hard_iface)
- {
- /* begin scheduling originator messages on that interface */
- batadv_iv_ogm_schedule(hard_iface);
-@@ -2683,8 +2683,8 @@ static void batadv_iv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
- static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
- .name = "BATMAN_IV",
- .iface = {
-- .activate = batadv_iv_iface_activate,
- .enable = batadv_iv_ogm_iface_enable,
-+ .enabled = batadv_iv_iface_enabled,
- .disable = batadv_iv_ogm_iface_disable,
- .update_mac = batadv_iv_ogm_iface_update_mac,
- .primary_set = batadv_iv_ogm_primary_iface_set,
-diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
-index 79d1731b83066c60f9aef958d2bc343233bce67a..3719cfd026f04093f5d86ffe1b41a41849b2af62 100644
---- a/net/batman-adv/hard-interface.c
-+++ b/net/batman-adv/hard-interface.c
-@@ -795,6 +795,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
-
- batadv_hardif_recalc_extra_skbroom(soft_iface);
-
-+ if (bat_priv->algo_ops->iface.enabled)
-+ bat_priv->algo_ops->iface.enabled(hard_iface);
-+
- out:
- return 0;
-
-diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
-index 74b644738a36bfe063eef6df016278b45a1a0256..e0b25104cbfa9f715df364658621c29faa7ad637 100644
---- a/net/batman-adv/types.h
-+++ b/net/batman-adv/types.h
-@@ -2129,6 +2129,9 @@ struct batadv_algo_iface_ops {
- /** @enable: init routing info when hard-interface is enabled */
- int (*enable)(struct batadv_hard_iface *hard_iface);
-
-+ /** @enabled: notification when hard-interface was enabled (optional) */
-+ void (*enabled)(struct batadv_hard_iface *hard_iface);
-+
- /** @disable: de-init routing info when hard-interface is disabled */
- void (*disable)(struct batadv_hard_iface *hard_iface);
-
#
include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=batmand
PKG_SOURCE_URL:=https://git.open-mesh.org/batmand.git
PKG_REV:=b67a7087b51d7a5e90d27ac39116d1f57257c86e
PKG_VERSION:=1440
-PKG_RELEASE:=0
+PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_MIRROR_HASH:=ceb8e0e399f79b1b663594fcf9642e1efc40e696a7604daf709c77da9b6ec52f
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
-PKG_EXTRA_CFLAGS=-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE
-
-PKG_KMOD_BUILD_DIR:=$(PKG_BUILD_DIR)/linux/modules
-
include $(INCLUDE_DIR)/package.mk
-define Package/batmand/Default
+define Package/batmand
URL:=https://www.open-mesh.org/
MAINTAINER:=Corinna "Elektra" Aichele <onelektra@gmx.net>
-endef
-
-define Package/batmand
-$(call Package/batmand/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
B.A.T.M.A.N. layer 3 routing daemon
endef
-define KernelPackage/batgat
-$(call Package/batmand/Default)
- SUBMENU:=Network Support
- DEPENDS:=+batmand @BROKEN
- TITLE:=B.A.T.M.A.N. gateway module
- FILES:=$(PKG_KMOD_BUILD_DIR)/batgat.$(LINUX_KMOD_SUFFIX)
- AUTOLOAD:=$(call AutoLoad,50,batgat)
-endef
-
-
-define KernelPackage/batgat/description
-Kernel gateway module for B.A.T.M.A.N. for better tunnel performance
-endef
-
-MAKE_BATMAND_ARGS += \
- EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
- CCFLAGS="$(TARGET_CFLAGS)" \
- OFLAGS="$(TARGET_CFLAGS)" \
+MAKE_FLAGS += \
+ EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE' \
REVISION="$(PKG_REV)" \
CC="$(TARGET_CC)" \
- NODEBUG=1 \
UNAME="Linux" \
- INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
- STRIP="/bin/true" \
- batmand install
-
-MAKE_BATGAT_ARGS += \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- ARCH="$(LINUX_KARCH)" \
- PATH="$(TARGET_PATH)" \
- SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
- LINUX_VERSION="$(LINUX_VERSION)" \
- REVISION="$(PKG_REV)" modules
-
-
-define Build/Configure
-endef
-
-ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_batmand),)
- BUILD_BATMAND := $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_BATMAND_ARGS)
-endif
-
-ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_kmod-batgat),)
- BUILD_BATGAT := $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATGAT_ARGS)
-endif
-
-define Build/Compile
- $(BUILD_BATMAND)
- cp $(PKG_KMOD_BUILD_DIR)/Makefile.kbuild $(PKG_KMOD_BUILD_DIR)/Makefile
- $(BUILD_BATGAT)
-endef
+ batmand
define Package/batmand/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batmand $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/batmand $(1)/usr/sbin/
$(INSTALL_BIN) ./files/etc/init.d/batmand $(1)/etc/init.d
$(INSTALL_DATA) ./files/etc/config/batmand $(1)/etc/config
endef
endef
$(eval $(call BuildPackage,batmand))
-$(eval $(call KernelPackage,batgat))
#!/bin/sh /etc/rc.common
START=90
+USE_PROCD=1
-start () {
- interface=$(uci get batmand.general.interface)
+batmand_start() {
+ local config="$1"
+ local batman_args
+ local interface
+ local hnas
+ local gateway_class
+ local originator_interval
+ local preferred_gateway
+ local routing_class
+ local visualisation_srv
+ local local policy_routing_script
+ local disable_client_nat
+ local disable_aggregation
+
+ [ "$config" = "general" ] || return 1
+
+ config_get interface "$config" interface
if [ "$interface" = "" ]; then
echo $1 Error, you must specify at least a network interface
- exit
- fi
- hnas=$(uci get batmand.general.hna)
- gateway_class=$(uci get batmand.general.gateway_class)
- originator_interval=$(uci get batmand.general.originator_interval)
- preferred_gateway=$(uci get batmand.general.preferred_gateway)
- routing_class=$(uci get batmand.general.routing_class)
- visualisation_srv=$(uci get batmand.general.visualisation_srv)
- policy_routing_script=$(uci get batmand.general.policy_routing_script)
- disable_client_nat=$(uci get batmand.general.disable_client_nat)
- disable_aggregation=$(uci get batmand.general.disable_aggregation)
+ return 1
+ fi
+
+ config_get hnas "$config" hna
+ config_get gateway_class "$config" gateway_class
+ config_get originator_interval "$config" originator_interval
+ config_get preferred_gateway "$config" preferred_gateway
+ config_get routing_class "$config" routing_class
+ config_get visualisation_srv "$config" visualisation_srv
+ config_get policy_routing_script "$config" policy_routing_script
+ config_get disable_client_nat "$config" disable_client_nat
+ config_get disable_aggregation "$config" disable_aggregation
+
batman_args=""
for hna in $hnas; do
batman_args=${batman_args}'--disable-aggregation '
fi
- batman_args=${batman_args}$interface
- batmand $batman_args >/dev/null 2>&1
+ procd_open_instance "${config}"
+ procd_set_param command /usr/sbin/batmand
+ procd_append_param command --no-detach
+ procd_append_param command ${batman_args}
+ procd_append_param command ${interface}
+ procd_set_param netdev ${interface}
+ procd_close_instance
+}
+
+start_service() {
+ config_load "batmand"
+ config_foreach batmand_start batmand
}
-stop () {
- killall batmand
+service_triggers() {
+ procd_add_reload_trigger "batmand"
}
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sun, 1 Dec 2013 14:39:00 +0100
+Subject: Allow one to disable forking to background in debug_mode 0
+
+---
+ posix/init.c | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/posix/init.c b/posix/init.c
+index afd409f..901c65a 100644
+--- a/posix/init.c
++++ b/posix/init.c
+@@ -44,6 +44,7 @@
+ #define IOCSETDEV 1
+
+ int8_t stop;
++int no_detach = 0;
+
+
+
+@@ -159,6 +160,7 @@ void apply_init_args( int argc, char *argv[] ) {
+ {"purge-timeout", required_argument, 0, 'q'},
+ {"disable-aggregation", no_argument, 0, 'x'},
+ {"disable-client-nat", no_argument, 0, 'z'},
++ {"no-detach", no_argument, 0, 'D'},
+ {0, 0, 0, 0}
+ };
+
+@@ -166,7 +168,7 @@ void apply_init_args( int argc, char *argv[] ) {
+ stop = 0;
+ prog_name = argv[0];
+
+- while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vV", long_options, &option_index ) ) != -1 ) {
++ while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vVD", long_options, &option_index ) ) != -1 ) {
+
+ switch ( optchar ) {
+
+@@ -378,6 +380,11 @@ void apply_init_args( int argc, char *argv[] ) {
+ found_args++;
+ break;
+
++ case 'D':
++ no_detach = 1;
++ found_args++;
++ break;
++
+ case 'h':
+ default:
+ usage();
+@@ -536,12 +543,14 @@ void apply_init_args( int argc, char *argv[] ) {
+ /* daemonize */
+ if (debug_level == 0) {
+
+- if (my_daemon() < 0) {
++ if (!no_detach) {
++ if (my_daemon() < 0) {
+
+- printf("Error - can't fork to background: %s\n", strerror(errno));
+- restore_defaults();
+- exit(EXIT_FAILURE);
++ printf("Error - can't fork to background: %s\n", strerror(errno));
++ restore_defaults();
++ exit(EXIT_FAILURE);
+
++ }
+ }
+
+ openlog("batmand", LOG_PID, LOG_DAEMON);
+++ /dev/null
----
- batman/linux/modules/gateway.c | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
---- batmand-r1439.orig/linux/modules/gateway.c
-+++ batmand-r1439/linux/modules/gateway.c
-@@ -29,6 +29,7 @@ static struct class *batman_class;
- static int batgat_open(struct inode *inode, struct file *filp);
- static int batgat_release(struct inode *inode, struct file *file);
- static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg );
-+static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg );
-
-
- static void udp_data_ready(struct sock *sk, int len);
-@@ -53,7 +54,11 @@ static int proc_clients_read(char *buf,
- static struct file_operations fops = {
- .open = batgat_open,
- .release = batgat_release,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ .unlocked_ioctl = batgat_ioctl_unlocked,
-+#else
- .ioctl = batgat_ioctl,
-+#endif
- };
-
-
-@@ -166,6 +171,20 @@ static int batgat_release(struct inode *
- }
-
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+#include <linux/smp_lock.h>
-+static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg )
-+{
-+ int ret;
-+
-+ lock_kernel();
-+ ret = batgat_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
-+ unlock_kernel();
-+
-+ return ret;
-+}
-+#endif
-+
- static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg )
- {
- uint8_t tmp_ip[4];
include $(TOPDIR)/rules.mk
PKG_NAME:=bird1
-PKG_VERSION:=1.6.4
+PKG_VERSION:=1.6.6
PKG_RELEASE:=1
PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://bird.network.cz/pub/bird
-PKG_MD5SUM:=c26b8caae988dba81a9dbbee93502463d4326d1b749d728d62aa5529c605afc0
+PKG_HASH:=975b3b7aefbe1e0dc9c11e55517f0ca2d82cca1d544e2e926f78bc843aaf2d70
PKG_BUILD_DEPENDS:=ncurses readline
PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION)
define Package/bird1/Default
TITLE:=The BIRD Internet Routing Daemon (v1.6)
- URL:=http://bird.network.cz/
+ URL:=https://bird.network.cz/
DEPENDS:=+libpthread
endef
define Package/bird1c/Default
TITLE:=The BIRD command-line client (v1.6)
- URL:=http://bird.network.cz/
- DEPENDS:= +libreadline +libncurses
+ URL:=https://bird.network.cz/
+ DEPENDS:=+libreadline +libncurses
endef
define Package/bird1cl/Default
TITLE:=The BIRD lightweight command-line client (v1.6)
- URL:=http://bird.network.cz/
+ URL:=https://bird.network.cz/
endef
define Package/bird1/Default/description1
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE+= (IPv4)
- DEPENDS+= +bird1-ipv4
+ DEPENDS+=+bird1-ipv4
CONFLICTS+=birdc4
endef
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE+= (IPv4)
- DEPENDS+= +bird1-ipv4
+ DEPENDS+=+bird1-ipv4
CONFLICTS+=birdcl4
endef
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE+= (IPv6)
- DEPENDS+= +bird1-ipv6
+ DEPENDS+=+bird1-ipv6
CONFLICTS+=birdc6
endef
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE+= (IPv6)
- DEPENDS+= +bird1-ipv6
+ DEPENDS+=+bird1-ipv6
CONFLICTS+=birdcl6
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=bird2
-PKG_VERSION:=2.0.2
+PKG_VERSION:=2.0.4
PKG_RELEASE:=1
PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://bird.network.cz/pub/bird
-PKG_HASH:=035f91d6f568f8ed438a0814235ac4c5c79147cd2acf201322c307732883480f
+PKG_HASH:=676010b7517d4159b9af37401c26185f561ffcffeba73690a2ef2fad984714de
PKG_BUILD_DEPENDS:=ncurses readline
PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION)
+++ /dev/null
-From f3a8cf050e6181e158dcde2fe885d7bf220eedc3 Mon Sep 17 00:00:00 2001
-From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
-Date: Thu, 12 Apr 2018 16:55:56 +0200
-Subject: [PATCH] BGP: Fix extended next hop handling
-
-For IPv4 with extended next hop, we use MP-BGP format and therefore no
-independent NEXT_HOP attribute.
-
-Thanks to Arvin Gan for the bugreport.
----
- proto/bgp/attrs.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
-index 0f41f818..9003feb2 100644
---- a/proto/bgp/attrs.c
-+++ b/proto/bgp/attrs.c
-@@ -295,7 +295,7 @@ bgp_encode_next_hop(struct bgp_write_state *s, eattr *a, byte *buf, uint size)
- * store it and encode it later by AFI-specific hooks.
- */
-
-- if (s->channel->afi == BGP_AF_IPV4)
-+ if ((s->channel->afi == BGP_AF_IPV4) && !s->channel->ext_next_hop)
- {
- ASSERT(a->u.ptr->length == sizeof(ip_addr));
-
---
-2.17.0
-
--- /dev/null
+From 0ca3156f64a46c52c6d6fc913958f83970d3e57f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
+Date: Mon, 30 Apr 2018 11:13:02 +0200
+Subject: [PATCH] babel: Set onlink flag for IPv4 routes with unreachable next
+ hop
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If the next hop of a route is not a reachable address, the route should be
+installed as onlink. This enables a configuration common in mesh networks
+where the mesh interface is assigned a /32 and babel handles the routing by
+installing onlink routes.
+
+Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
+---
+ proto/babel/babel.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/proto/babel/babel.c b/proto/babel/babel.c
+index ce05191c..afd2eb19 100644
+--- a/proto/babel/babel.c
++++ b/proto/babel/babel.c
+@@ -640,6 +640,13 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
+ .nh.iface = r->neigh->ifa->iface,
+ };
+
++ /* If we cannot find a reachable neighbour, set the entry to be onlink. This
++ * makes it possible to, e.g., assign /32 addresses on a mesh interface and
++ * have routing work.
++ */
++ if (!neigh_find(&p->p, r->next_hop, r->neigh->ifa->iface, 0))
++ a0.nh.flags = RNF_ONLINK;
++
+ rta *a = rta_lookup(&a0);
+ rte *rte = rte_get_temp(a);
+ rte->u.babel.seqno = r->seqno;
+--
+2.17.0
+
+++ /dev/null
-From 823ad12191e66e243dd088a81c66e4a518563e40 Mon Sep 17 00:00:00 2001
-From: Jan Maria Matejka <mq@ucw.cz>
-Date: Fri, 27 Apr 2018 14:38:41 +0200
-Subject: [PATCH] Filter: Added missing instruction comparators.
-
-These instructions caused SIGABORTs on reconfiguration.
----
- filter/filter.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/filter/filter.c b/filter/filter.c
-index bb3146e7..881ba420 100644
---- a/filter/filter.c
-+++ b/filter/filter.c
-@@ -1712,7 +1712,10 @@ i_same(struct f_inst *f1, struct f_inst *f2)
- case FI_EA_SET: ONEARG; A2_SAME; break;
-
- case FI_RETURN: ONEARG; break;
-+ case FI_ROA_MAXLEN: ONEARG; break;
-+ case FI_ROA_ASN: ONEARG; break;
- case FI_IP: ONEARG; break;
-+ case FI_IS_V4: ONEARG; break;
- case FI_ROUTE_DISTINGUISHER: ONEARG; break;
- case FI_CALL: /* Call rewriting trickery to avoid exponential behaviour */
- ONEARG;
-@@ -1735,6 +1738,8 @@ i_same(struct f_inst *f1, struct f_inst *f2)
- ((struct f_inst_roa_check *) f2)->rtc->name))
- return 0;
- break;
-+ case FI_FORMAT: ONEARG; break;
-+ case FI_ASSERT: ONEARG; break;
- default:
- bug( "Unknown instruction %d in same (%c)", f1->fi_code, f1->fi_code & 0xff);
- }
---
-2.17.0
-
+++ /dev/null
-From 40e7bd0e39849a03bd3f6f44d6719a5f8b1dd291 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
-Date: Mon, 30 Apr 2018 16:29:20 +0200
-Subject: [PATCH] babel: Fix type of route entry router ID
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The router ID being assigned to routes was a uint, which discards the upper
-32 bits. This also has the nice side effect of echoing the wrong router ID
-back to other routers.
-
-Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
----
- proto/babel/babel.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/proto/babel/babel.c b/proto/babel/babel.c
-index 4fd88042..a8eb5ea8 100644
---- a/proto/babel/babel.c
-+++ b/proto/babel/babel.c
-@@ -2140,7 +2140,7 @@ babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
- uint internal = (new->attrs->src->proto == P);
- uint rt_seqno = internal ? new->u.babel.seqno : p->update_seqno;
- uint rt_metric = ea_get_int(attrs, EA_BABEL_METRIC, 0);
-- uint rt_router_id = internal ? new->u.babel.router_id : p->router_id;
-+ u64 rt_router_id = internal ? new->u.babel.router_id : p->router_id;
-
- if (rt_metric > BABEL_INFINITY)
- {
---
-2.17.0
-
+++ /dev/null
-From 70fab17837dbb4c5848681e4c6b9b90891891130 Mon Sep 17 00:00:00 2001
-From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
-Date: Thu, 3 May 2018 16:55:11 +0200
-Subject: [PATCH 1/2] Babel: Add option to randomize router ID
-
-When a Babel node restarts, it loses its sequence number, which can cause
-its routes to be rejected by peers until the state is cleared out by other
-nodes in the network (which can take on the order of minutes).
-
-There are two ways to fix this: Having stable storage to keep the sequence
-number across restarts, or picking a different router ID each time.
-
-This implements the latter, by introducing a new option that will cause
-BIRD to randomize a high 32 bits of router ID every time it starts up.
-This avoids the problem at the cost of not having stable router IDs in
-the network.
-
-Thanks to Toke Hoiland-Jorgensen for the patch.
----
- doc/bird.sgml | 10 ++++++++++
- proto/babel/babel.c | 11 +++++++++++
- proto/babel/babel.h | 1 +
- proto/babel/config.Y | 3 ++-
- 4 files changed, 24 insertions(+), 1 deletion(-)
-
-diff --git a/doc/bird.sgml b/doc/bird.sgml
-index 1191fa03..ae308d4c 100644
---- a/doc/bird.sgml
-+++ b/doc/bird.sgml
-@@ -1691,6 +1691,7 @@ supports the following per-interface configuration options:
- protocol babel [<name>] {
- ipv4 { <channel config> };
- ipv6 [sadr] { <channel config> };
-+ randomize router id <switch>;
- interface <interface pattern> {
- type <wired|wireless>;
- rxcost <number>;
-@@ -1713,6 +1714,15 @@ protocol babel [<name>] {
- <tag><label id="babel-channel">ipv4 | ipv6 [sadr] <m/channel config/</tag>
- The supported channels are IPv4, IPv6, and IPv6 SADR.
-
-+ <tag><label id="babel-random-router-id">randomize router id <m/switch/</tag>
-+ If enabled, Bird will randomize the top 32 bits of its router ID whenever
-+ the protocol instance starts up. If a Babel node restarts, it loses its
-+ sequence number, which can cause its routes to be rejected by peers until
-+ the state is cleared out by other nodes in the network (which can take on
-+ the order of minutes). Enabling this option causes Bird to pick a random
-+ router ID every time it starts up, which avoids this problem at the cost
-+ of not having stable router IDs in the network. Default: no.
-+
- <tag><label id="babel-type">type wired|wireless </tag>
- This option specifies the interface type: Wired or wireless. On wired
- interfaces a neighbor is considered unreachable after a small number of
-diff --git a/proto/babel/babel.c b/proto/babel/babel.c
-index 797a83d4..ce05191c 100644
---- a/proto/babel/babel.c
-+++ b/proto/babel/babel.c
-@@ -2226,6 +2226,14 @@ babel_init(struct proto_config *CF)
- return P;
- }
-
-+static inline void
-+babel_randomize_router_id(struct babel_proto *p)
-+{
-+ p->router_id &= (u64) 0xffffffff;
-+ p->router_id |= ((u64) random()) << 32;
-+ TRACE(D_EVENTS, "Randomized router ID to %lR", p->router_id);
-+}
-+
- static int
- babel_start(struct proto *P)
- {
-@@ -2244,6 +2252,9 @@ babel_start(struct proto *P)
- p->update_seqno = 1;
- p->router_id = proto_get_router_id(&cf->c);
-
-+ if (cf->randomize_router_id)
-+ babel_randomize_router_id(p);
-+
- p->route_slab = sl_new(P->pool, sizeof(struct babel_route));
- p->source_slab = sl_new(P->pool, sizeof(struct babel_source));
- p->msg_slab = sl_new(P->pool, sizeof(struct babel_msg_node));
-diff --git a/proto/babel/babel.h b/proto/babel/babel.h
-index b194ce30..e5c9cd5b 100644
---- a/proto/babel/babel.h
-+++ b/proto/babel/babel.h
-@@ -112,6 +112,7 @@ struct babel_config {
- struct proto_config c;
- list iface_list; /* List of iface configs (struct babel_iface_config) */
- uint hold_time; /* Time to hold stale entries and unreachable routes */
-+ u8 randomize_router_id;
-
- struct channel_config *ip4_channel;
- struct channel_config *ip6_channel;
-diff --git a/proto/babel/config.Y b/proto/babel/config.Y
-index 7adfb4bb..205b4e4f 100644
---- a/proto/babel/config.Y
-+++ b/proto/babel/config.Y
-@@ -25,7 +25,7 @@ CF_DECLS
- CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT,
- TYPE, WIRED, WIRELESS, RX, TX, BUFFER, PRIORITY, LENGTH, CHECK, LINK,
- NEXT, HOP, IPV4, IPV6, BABEL_METRIC, SHOW, INTERFACES, NEIGHBORS,
-- ENTRIES)
-+ ENTRIES, RANDOMIZE, ROUTER, ID)
-
- CF_GRAMMAR
-
-@@ -42,6 +42,7 @@ babel_proto_item:
- proto_item
- | proto_channel
- | INTERFACE babel_iface
-+ | RANDOMIZE ROUTER ID bool { BABEL_CFG->randomize_router_id = $4; }
- ;
-
- babel_proto_opts:
---
-2.17.0
-
+++ /dev/null
-From eaf63d314d50cba5b2cfa8f18de64a91d3131b94 Mon Sep 17 00:00:00 2001
-From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
-Date: Thu, 3 May 2018 17:07:39 +0200
-Subject: [PATCH 2/2] Better initialization of random generator
-
-Use full time precision to initialize random generator. The old
-code was prone to initialize it to the same values in specific
-circumstances (boot without RTC, multiple VMs starting at once).
----
- sysdep/unix/io.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
-index 012deaf0..11a0d6f1 100644
---- a/sysdep/unix/io.c
-+++ b/sysdep/unix/io.c
-@@ -2144,7 +2144,9 @@ io_init(void)
- // XXX init_times();
- // XXX update_times();
- boot_time = current_time();
-- srandom((uint) (current_real_time() TO_S));
-+
-+ u64 now = (u64) current_real_time();
-+ srandom((uint) (now ^ (now >> 32)));
- }
-
- static int short_loops = 0;
---
-2.17.0
-
+++ /dev/null
-From 0ca3156f64a46c52c6d6fc913958f83970d3e57f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
-Date: Mon, 30 Apr 2018 11:13:02 +0200
-Subject: [PATCH] babel: Set onlink flag for IPv4 routes with unreachable next
- hop
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-If the next hop of a route is not a reachable address, the route should be
-installed as onlink. This enables a configuration common in mesh networks
-where the mesh interface is assigned a /32 and babel handles the routing by
-installing onlink routes.
-
-Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
----
- proto/babel/babel.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/proto/babel/babel.c b/proto/babel/babel.c
-index ce05191c..afd2eb19 100644
---- a/proto/babel/babel.c
-+++ b/proto/babel/babel.c
-@@ -640,6 +640,13 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
- .nh.iface = r->neigh->ifa->iface,
- };
-
-+ /* If we cannot find a reachable neighbour, set the entry to be onlink. This
-+ * makes it possible to, e.g., assign /32 addresses on a mesh interface and
-+ * have routing work.
-+ */
-+ if (!neigh_find2(&p->p, &r->next_hop, r->neigh->ifa->iface, 0))
-+ a0.nh.flags = RNF_ONLINK;
-+
- rta *a = rta_lookup(&a0);
- rte *rte = rte_get_temp(a);
- rte->u.babel.seqno = r->seqno;
---
-2.17.0
-
+++ /dev/null
-diff --git a/Makefile.in b/Makefile.in
-index c8168bb..eb6cc5c 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -21,11 +21,6 @@ INSTALL=@INSTALL@
- INSTALL_PROGRAM=@INSTALL_PROGRAM@
- INSTALL_DATA=@INSTALL_DATA@
-
--git-label:=$(strip $(shell git describe --always --dirty=-x 2>/dev/null))
--ifneq ($(git-label),)
-- CFLAGS += -DGIT_LABEL="$(git-label)"
--endif
--
- client=$(addprefix $(exedir)/,@CLIENT@)
- daemon=$(exedir)/bird
- protocols=@protocols@
-@@ -42,6 +37,11 @@ srcdir := @srcdir@
- objdir := @objdir@
- exedir := @exedir@
-
-+git-label:=$(strip $(shell cd $(srcdir) && [ "$$(git rev-parse --show-toplevel)" = "$$(readlink -f .)" ] && git describe --always --dirty=-x 2>/dev/null))
-+ifneq ($(git-label),)
-+ CFLAGS += -DGIT_LABEL="$(git-label)"
-+endif
-+
- ifeq ($(objdir),.)
- objdir := $(realpath .)
- endif
+++ /dev/null
-From b24b781117179f301116837f0a39468343e4805b Mon Sep 17 00:00:00 2001
-From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
-Date: Wed, 16 May 2018 11:19:29 +0200
-Subject: [PATCH] Filter: Add support for src filter op to access SADR source
- prefix
-
-The patch allows to use 'net.src' to access SADR source prefix
-from filters.
-
-Thanks to Toke Hoiland-Jorgensen for the original patch for srclen.
----
- filter/config.Y | 3 ++-
- filter/filter.c | 15 +++++++++++++++
- filter/filter.h | 1 +
- lib/net.h | 2 ++
- 4 files changed, 20 insertions(+), 1 deletion(-)
-
-diff --git a/filter/config.Y b/filter/config.Y
-index f8170a83..e01e02ef 100644
---- a/filter/config.Y
-+++ b/filter/config.Y
-@@ -411,7 +411,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
- TRUE, FALSE, RT, RO, UNKNOWN, GENERIC,
- FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, DEST, IFNAME, IFINDEX,
- PREFERENCE,
-- ROA_CHECK, ASN,
-+ ROA_CHECK, ASN, SRC,
- IS_V4, IS_V6,
- LEN, MAXLEN,
- DEFINED,
-@@ -898,6 +898,7 @@ term:
- | term '.' LEN { $$ = f_new_inst(FI_LENGTH); $$->a1.p = $1; }
- | term '.' MAXLEN { $$ = f_new_inst(FI_ROA_MAXLEN); $$->a1.p = $1; }
- | term '.' ASN { $$ = f_new_inst(FI_ROA_ASN); $$->a1.p = $1; }
-+ | term '.' SRC { $$ = f_new_inst(FI_SADR_SRC); $$->a1.p = $1; }
- | term '.' MASK '(' term ')' { $$ = f_new_inst(FI_IP_MASK); $$->a1.p = $1; $$->a2.p = $5; }
- | term '.' FIRST { $$ = f_new_inst(FI_AS_PATH_FIRST); $$->a1.p = $1; }
- | term '.' LAST { $$ = f_new_inst(FI_AS_PATH_LAST); $$->a1.p = $1; }
-diff --git a/filter/filter.c b/filter/filter.c
-index 881ba420..3d7b5c9f 100644
---- a/filter/filter.c
-+++ b/filter/filter.c
-@@ -1241,6 +1241,20 @@ interpret(struct f_inst *what)
- default: runtime( "Prefix, path, clist or eclist expected" );
- }
- break;
-+ case FI_SADR_SRC: /* Get SADR src prefix */
-+ ONEARG;
-+ if (v1.type != T_NET || !net_is_sadr(v1.val.net))
-+ runtime( "SADR expected" );
-+
-+ {
-+ net_addr_ip6_sadr *net = (void *) v1.val.net;
-+ net_addr *src = lp_alloc(f_pool, sizeof(net_addr_ip6));
-+ net_fill_ip6(src, net->src_prefix, net->src_pxlen);
-+
-+ res.type = T_NET;
-+ res.val.net = src;
-+ }
-+ break;
- case FI_ROA_MAXLEN: /* Get ROA max prefix length */
- ONEARG;
- if (v1.type != T_NET || !net_is_roa(v1.val.net))
-@@ -1714,6 +1728,7 @@ i_same(struct f_inst *f1, struct f_inst *f2)
- case FI_RETURN: ONEARG; break;
- case FI_ROA_MAXLEN: ONEARG; break;
- case FI_ROA_ASN: ONEARG; break;
-+ case FI_SADR_SRC: ONEARG; break;
- case FI_IP: ONEARG; break;
- case FI_IS_V4: ONEARG; break;
- case FI_ROUTE_DISTINGUISHER: ONEARG; break;
-diff --git a/filter/filter.h b/filter/filter.h
-index d347924a..982276f0 100644
---- a/filter/filter.h
-+++ b/filter/filter.h
-@@ -55,6 +55,7 @@
- F(FI_LENGTH, 0, 'L') \
- F(FI_ROA_MAXLEN, 'R', 'M') \
- F(FI_ROA_ASN, 'R', 'A') \
-+ F(FI_SADR_SRC, 'n', 's') \
- F(FI_IP, 'c', 'p') \
- F(FI_ROUTE_DISTINGUISHER, 'R', 'D') \
- F(FI_AS_PATH_FIRST, 'a', 'f') \
-diff --git a/lib/net.h b/lib/net.h
-index ad4000fd..0cd5f735 100644
---- a/lib/net.h
-+++ b/lib/net.h
-@@ -268,6 +268,8 @@ static inline int net_is_roa(const net_addr *a)
- static inline int net_is_flow(const net_addr *a)
- { return (a->type == NET_FLOW4) || (a->type == NET_FLOW6); }
-
-+static inline int net_is_sadr(const net_addr *a)
-+{ return (a->type == NET_IP6_SADR); }
-
- static inline ip4_addr net4_prefix(const net_addr *a)
- { return ((net_addr_ip4 *) a)->prefix; }
---
-2.17.0
-
TITLE:=Encrypted near-zero-conf mesh routing protocol
URL:=https://github.com/cjdelisle/cjdns
MAINTAINER:=Lars Gierth <larsg@systemli.org>
- DEPENDS:=@IPV6 +kmod-tun +libnl-tiny +libpthread +librt \
+ DEPENDS:=@!arc @IPV6 +kmod-tun +libnl-tiny +libpthread +librt \
+libuci-lua +lua-bencode +dkjson +luasocket +lua-sha2
endef
TITLE:=cjdns test cases
URL:=https://github.com/cjdelisle/cjdns
MAINTAINER:=Lars Gierth <larsg@systemli.org>
- DEPENDS:=+libpthread +librt
+ DEPENDS:=+libpthread +librt @!arc
endef
define Package/cjdns-test/description
+++ /dev/null
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
+++ /dev/null
-# Copyright © 2011 Pau Escrich <pau@dabax.net>
-# Contributors Roger Pueyo Centelles <roger.pueyo@guifi.net>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# The full GNU General Public License is included in this distribution in
-# the file called "COPYING".
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=luci-app-bmx7
-PKG_RELEASE:=0.1-alpha
-
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-PKG_LICENSE:=GPL-2.0+
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/luci-app-bmx7
- SECTION:=luci
- CATEGORY:=LuCI
- SUBMENU:=3. Applications
- TITLE:= LuCI support for BMX7
- DEPENDS:=+luci-lib-json +luci-mod-admin-full +bmx7 +bmx7-json
- MAINTAINER:= Roger Pueyo <roger.pueyo@guifi.net> and Pau Escrich <p4u@dabax.net>
-endef
-
-define Package/luci-app-bmx7/description
- LuCI application for web-based configuration and visualization of the BMX7 routing daemon
-endef
-
-define Package/luci-app-bmx7/conffiles
- /etc/config/luci-bmx7
-endef
-
-define Build/Prepare
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
-endef
-
-define Package/luci-app-bmx7/install
- $(CP) ./files/* $(1)/
- chmod 755 $(1)/www/cgi-bin/bmx7-info
-endef
-
-$(eval $(call BuildPackage,luci-app-bmx7))
-
+++ /dev/null
-config 'bmx7' 'luci'
- option ignore '0'
- option place 'admin network BMX7'
- #option place 'qmp Mesh'
- option position '3'
- #option json 'http://127.0.0.1/cgi-bin/bmx7-info?'
- option json 'exec:/www/cgi-bin/bmx7-info -s'
+++ /dev/null
---[[
- Copyright (C) 2011 Pau Escrich <pau@dabax.net>
- Contributors Jo-Philipp Wich <xm@subsignal.org>
- Roger Pueyo Centelles <roger.pueyo@guifi.net>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- The full GNU General Public License is included in this distribution in
- the file called "COPYING".
---]]
-
-module("luci.controller.bmx7", package.seeall)
-
-function index()
- local place = {}
- local ucim = require "luci.model.uci"
- local uci = ucim.cursor()
-
- -- checking if ignore is on
- if uci:get("luci-bmx7","luci","ignore") == "1" then
- return nil
- end
-
- -- getting value from uci database
- local uci_place = uci:get("luci-bmx7","luci","place")
-
- -- default values
- if uci_place == nil then
- place = {"bmx7"}
- else
- local util = require "luci.util"
- place = util.split(uci_place," ")
- end
-
- -- getting position of menu
- local uci_position = uci:get("luci-bmx7","luci","position")
-
-
- ---------------------------
- -- Placing the pages in the menu
- ---------------------------
-
- -- Status (default)
- entry(place,call("action_status_j"),place[#place],tonumber(uci_position))
-
- table.insert(place,"Status")
- entry(place,call("action_status_j"),"Status",0)
- table.remove(place)
-
- -- Topology
- table.insert(place,"Topology")
- entry(place,call("topology"),"Topology",1)
- table.remove(place)
-
- -- Nodes
- table.insert(place,"Nodes")
- entry(place,call("action_nodes_j"),"Nodes",2)
- table.remove(place)
-
- -- Tunnels
- table.insert(place,"Gateways")
- entry(place,call("action_tunnels_j"),"Gateways",3)
- table.remove(place)
-
- -- Integrate bmx7-mdns if present
- if nixio.fs.stat("/usr/lib/lua/luci/model/cbi/bmx7-mdns.lua","type") ~= nil then
- table.insert(place,"mDNS")
- entry(place, cbi("bmx7-mdns"), "mesh DNS", 1).dependent=false
- table.remove(place)
- end
-
-end
-
-
-function action_status_j()
- luci.template.render("bmx7/status_j", {})
-end
-
-function action_tunnels_j()
- luci.template.render("bmx7/tunnels_j", {})
-end
-
-function topology()
- luci.template.render("bmx7/topology", {})
-end
-
-function action_nodes_j()
- luci.template.render("bmx7/nodes_j", {})
-end
+++ /dev/null
-<div class="cbi-map">
-<div class="cbi-section">
- <legend><%:Bmx7 mesh nodes%></legend>
- <div class="cbi-section-node">
- <div class="table" id="nodes_div">
- <div class="tr table-titles">
- <div class="th"><%:Name%></div>
- <div class="th"><%:Short ID%></div>
- <div class="th"><%:S/s/T/t%></div>
- <div class="th"><%:Primary IPv6%></div>
- <div class="th"><%:Via Neighbour%></div>
- <div class="th"><%:Device%></div>
- <div class="th"><%:Metric%></div>
- <div class="th"><%:Last Ref%></div>
- </div>
- </div>
- </div>
-</div>
-</div>
-
-<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
-<script type="text/javascript">//<![CDATA[
- new TablePooler(10,"/cgi-bin/bmx7-info", {'$originators':''}, "nodes_div", function(st){
- var originators = st.originators;
- var res = Array();
- originators.forEach(function(originator,i){
- var name = originator.name;
- var shortId = originator.shortId;
- var SsTt = originator.S+'/'+originator.s+'/'+originator.T+'/'+originator.t;
- var primaryIp = originator.primaryIp;
- var nbName = originator.nbName;
- var dev = originator.dev;
- var metric = originator.metric;
- var lastRef = originator.lastRef;
- res.push([name, shortId, SsTt, primaryIp,
- nbName, dev, metric, lastRef]);
- });
- return res;
- });
-//]]></script>
+++ /dev/null
-<%#
- Copyright © 2011 Pau Escrich <pau@dabax.net>
- Contributors Lluis Esquerda <eskerda@gmail.com>
- Roger Pueyo Centelles <roger.pueyo@guifi.net>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- The full GNU General Public License is included in this distribution in
- the file called "COPYING".
--%>
-
-<%+header%>
-<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
-<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
-
-
-<style>
- div.hideme{
- display: none;
- }
- div.info{
- background: #FFF;
- border: solid 0px;
- height: 190px;
- display: block;
- overflow: auto;
- }
- div.inforow{
- text-align:left;
- display:inline-block;
- margin:10px;
- vertical-align:top;
- float: left;
- white-space:nowrap;
- }
- div.inforow.newline{
- clear: both;
- }
- u {
- text-decoration: underline;
- }
-#extra-info ul { list-style: none outside none; margin-left: 0em; }
-</style>
-
-<div class="cbi-map">
-
-<h2>Mesh nodes</h2>
-<div class="cbi-map-descr"></div>
-<div id="extra-info" class="info">
- <br />
- <center>
- Tip: click the <img src="<%=resource%>/bmx7/world.png" /> icon to see individual node information.
- </center>
-</div>
-
-
-<div class="cbi-section">
- <legend><%:Originators%></legend>
- <div class="cbi-section-node">
- <div class="table" id="nodes_div">
- <div class="tr table-titles">
- <div class="th"></div>
- <div class="th"><%:Name%></div>
- <div class="th"><%:Short ID%></div>
- <div class="th"><%:S/s/T/t%></div>
- <div class="th"><%:Primary IPv6%></div>
- <div class="th"><%:Via Neighbour%></div>
- <div class="th"><%:Metric%></div>
- <div class="th"><%:Last Desc%></div>
- <div class="th"><%:Last Ref%></div>
- <div class="th"><%: %></div>
- </div>
- </div>
- </div>
-</div>
-
-</div>
-
-<script type="text/javascript">//<![CDATA[
- var displayExtraInfo = function ( id ) {
- document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
- }
- new TablePooler(5,"/cgi-bin/bmx7-info", {'$originators':''}, "nodes_div", function(st){
- var infoicon = "<%=resource%>/bmx7/world_small.png";
- var originators = st.originators;
- var res = Array();
- originators.forEach(function(originator,i){
- var name = originator.name;
- var shortId = originator.shortId;
- var nodeId = originator.nodeId;
- var extensions = originator.name;
- var SsTt = originator.S+'/'+originator.s+'/'+originator.T+'/'+originator.t;
- var nodeKey = originator.nodeKey;
- var descSize = originator.descSize;
- var primaryIp = originator.primaryIp;
- var nbName = originator.nbName;
- var dev = originator.dev;
- var nbLocalIp = originator.nbLocalIp;
- var metric = originator.metric;
- var lastDesc = originator.lastDesc;
- var lastRef = originator.lastRef;
-
- var extrainfo = '<a onclick="displayExtraInfo(\'ip-' + i + '\')"><img src="' + infoicon + '" / ></a>';
- var extrainfo_link = '<a onclick="displayExtraInfo(\'ip-' + i + '\')">' + '<img src="' + infoicon + '" />' + '</a>';
-
- extrainfo = '<div id="ip-'+ i +'" class="hideme">'
- + "<div class='inforow'>"
- + "<h4><u>" + name + '</u></h4>\n'
- + 'Node ID: ' + shortId + "</div>"
- + "<div class='inforow'>"
- + "<h5>Primary IPv6 address</h5>\n"
- + primaryIp + "</div>\n"
- + "<div class='inforow'>"
- + "<h5>Support & Trust</h5>\n"
- + SsTt + "</div>\n"
- + "<div class='inforow'>"
- + "<h5>Node key</h5>\n"
- + nodeKey + "</div>\n"
- + "<div class='inforow newline'>"
- + "<h5>Via neighbour</h5>\n"
- + nbName + "</div>\n"
- + "<div class='inforow'>"
- + "<h5>Via device</h5>\n"
- + dev + "</div>\n"
- + "<div class='inforow'>"
- + "<h5>Via link-local IPv6</h5>\n"
- + nbLocalIp + "</div>\n"
- + "<div class='inforow'>"
- + "<h5>Route metric</h5>\n"
- + metric + "</div>\n"
- + "<div class='inforow'>"
- + "<h5>Desc. size</h5>\n"
- + descSize + "</div>\n"
- + "\n</div>";
-
- res.push([extrainfo_link, name, shortId, SsTt, primaryIp,
- nbName, metric, lastDesc, lastRef, extrainfo]);
- });
- return res;
- });
-//]]></script>
-
-<%+footer%>
+++ /dev/null
-<%+header%>
-<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
-<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
-
-<div class="cbi-map">
- <center>
- <img src="<%=resource%>/bmx7/bmx7logo.png" />
- <br />
- <br />
- A mesh routing protocol for Linux devices.<br />
- Visit <a href="http://bmx6.net">bmx6.net</a> for more information.<br />
- <br />
- </center>
-
-<div class="cbi-map-descr"></div>
-
-<div class="cbi-section">
- <legend><%:Node configuration%></legend>
- <div class="cbi-section-node">
- <div class="table" id="config_div">
- <div class="tr table-titles">
- <div class="th"><%:Short ID%></div>
- <div class="th"><%:Node name%></div>
- <div class="th"><%:Primary IPv6 address%></div>
- <div class="th"><%:Node key%></div>
- <div class="th"><%:Short DHash%></div>
- <div class="th"><%:BMX7 revision%></div>
- </div>
- </div>
- </div>
-</div>
-
-
-<div class="cbi-section">
- <legend><%:Node status%></legend>
- <div class="cbi-section-node">
- <div class="table" id="status_div">
- <div class="tr table-titles">
- <div class="th"><%:Nodes seen%></div>
- <div class="th"><%:Neighbours%></div>
- <div class="th"><%:Tunnelled IPv6 address%></div>
- <div class="th"><%:Tunnelled IPv4 address%></div>
- <div class="th"><%:Uptime%></div>
- <div class="th"><%:CPU usage%></div>
- <div class="th"><%:Memory usage%></div>
- <div class="th"><%:Tx queue%></div>
- </div>
- </div>
- </div>
-</div>
-
-<div class="cbi-section">
- <legend><%:Network interfaces%></legend>
- <div class="cbi-section-node">
- <div class="table" id="ifaces_div">
- <div class="tr table-titles">
- <div class="th"><%:Interface%></div>
- <div class="th"><%:State%></div>
- <div class="th"><%:Type%></div>
- <div class="th"><%:Max rate%></div>
- <div class="th"><%:LinkLocal Ipv6%></div>
- <div class="th"><%:RX BpP%></div>
- <div class="th"><%:TX BpP%></div>
- </div>
- </div>
- </div>
-</div>
-
-
-<div class="cbi-section">
- <legend><%:Links%></legend>
- <div class="cbi-section-node">
- <div class="table" id="links_div">
- <div class="tr table-titles">
- <div class="th"><%:Short ID%></div>
- <div class="th"><%:Name%></div>
- <div class="th"><%:Link key%></div>
- <div class="th"><%:Remote linklocal IPv6%></div>
- <div class="th"><%:Device%></div>
- <div class="th"><%:RX rate%></div>
- <div class="th"><%:TX rate%></div>
- <div class="th"><%:Routes%></div>
- </div>
- </div>
- </div>
-</div>
-
-</div>
-
-<script type="text/javascript">//<![CDATA[
- new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "config_div", function(st){
- var res = Array();
- var sta = st.info[0].status;
- res.push([sta.shortId, sta.name, sta.primaryIp, sta.nodeKey, sta.shortDhash, sta.revision]);
- return res;
- });
-
- new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "status_div", function(st){
- var res = Array();
- var sta = st.info[0].status;
- var mem = st.info[3].memory.bmx7;
- var txQ = sta.txQ.split('/');
- var ptxQ = '<p style="color:rgb('+parseInt(255*txQ[0]/txQ[1])+','+parseInt(128*(txQ[1]-txQ[0])/txQ[1])+',0)")>'+sta.txQ+'</p>';
- res.push([sta.nodes, sta.nbs, sta.tun6Address, sta.tun4Address, sta.uptime, sta.cpu, mem, ptxQ]);
- return res;
- });
-
- new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "ifaces_div", function(st){
- var res = Array();
- var ifaces = st.info[1].interfaces;
-
- ifaces.forEach(function(iface){
- res.push([iface.dev, iface.state, iface.type, iface.rateMax, iface.localIp, iface.rxBpP, iface.txBpP]);
- });
- return res;
- });
-
- new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "links_div", function(st){
- var res = Array();
- links = st.info[2].links;
-
- links.forEach(function(link){
- res.push([link.shortId, link.name, link.linkKey, link.nbLocalIp, link.dev, link.rxRate, link.txRate, link.rts]);
- });
- return res;
- });
-
-//]]></script>
-
-<%+footer%>
+++ /dev/null
-<%+header%>
-<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.12/d3.min.js"></script>
-<script type="text/javascript" src="<%=resource%>/bmx7/js/netjsongraph.js"></script>
-
-<link href="<%=resource%>/bmx7/css/netjsongraph.css" rel="stylesheet">
- <style type="text/css">
- body {
- font-family: Arial, sans-serif;
- font-size: 13px;
- }
-
- .njg-overlay{
- width: auto;
- height: auto;
- min-width: 200px;
- max-width: 400px;
- border: 1px solid #000;
- border-radius: 2px;
- background: rgba(0, 0, 0, 0.7);
- top: 10px;
- right: 10px;
- padding: 0 15px;
- font-family: Arial, sans-serif;
- font-size: 14px;
- color: #fff
- }
-
- .njg-node {
- fill: #008000;
- fill-opacity: 0.8;
- stroke: #008000;
- stroke-width: 1px;
- cursor: pointer;
- }
- .njg-node:hover,
- .njg-node.njg-open{
- fill-opacity: 1;
- }
-
- .njg-link {
- stroke: #00ff00;
- stroke-width: 2;
- stroke-opacity: .5;
- cursor: pointer;
- }
- .njg-link:hover,
- .njg-link.njg-open{
- stroke-width: 3;
- stroke-opacity: 1
- }
-</style>
-<script>d3.netJsonGraph("/cgi-bin/bmx7-info?netjson/network-graph.json", { defaultStyle: false });</script>
-<%+footer%>
-
+++ /dev/null
-<%#
- Copyright (C) 2011 Pau Escrich <pau@dabax.net>
- Contributors Lluis Esquerda <eskerda@gmail.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- The full GNU General Public License is included in this distribution in
- the file called "COPYING".
--%>
-
-
-<%+header%>
-<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
-<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
-
-<div class="cbi-map">
-<h2>Gateway announcements</h2>
-<div class="cbi-map-descr">Networks announced by mesh nodes</div>
-
-<div class="cbi-section">
- <legend><%:Announcements%></legend>
- <div class="cbi-section-node">
- <div class="table" id="tunnels_div">
- <div class="tr table-titles">
- <div class="th"><%:Status%></div>
- <div class="th"><%:Name%></div>
- <div class="th"><%:Node%></div>
- <div class="th"><%:Network%></div>
- <div class="th"><%:Bandwith%></div>
- <div class="th"><%:Local net%></div>
- <div class="th"><%:Path Metric%></div>
- <div class="th"><%:Tun Metric%></div>
- <div class="th"><%:Rating%></div>
- </div>
- </div>
- </div>
-</div>
-
-</div>
-
-<script type="text/javascript">//<![CDATA[
- new TablePooler(5,"/cgi-bin/bmx7-info", {'$tunnels':''}, "tunnels_div", function(st){
- var tunicon = "<%=resource%>/icons/tunnel.png";
- var tunicon_dis = "<%=resource%>/icons/tunnel_disabled.png";
- var applyicon = "<%=resource%>/cbi/apply.gif";
- var res = Array();
- for ( var k in st.tunnels ) {
- var tunnel = st.tunnels[k];
- var nodename = tunnel.remoteName;
- var advnet = tunnel.advNet;
- var status = '<img src="'+tunicon_dis+'"/>';
- if ( tunnel.tunName != "---" ) status = '<img src="'+tunicon+'"/>';
- if ( advnet == "0.0.0.0/0" ) advnet = "<b>Internet IPv4</b>";
- if ( advnet == "::/0" ) advnet = "<b>Internet IPv6</b>";
- if (nodename != "---") {
- res.push([status, tunnel.tunName, nodename, advnet, tunnel.advBw, tunnel.net,
- tunnel.pathMtc, tunnel.tunMtc, tunnel.rating]);
- }
- }
- return res;
- });
-//]]></script>
-
-<%+footer%>
+++ /dev/null
-#!/bin/sh
-# Copyright © 2011 Pau Escrich
-# Contributors Jo-Philipp Wich <xm@subsignal.org>
-# Roger Pueyo Centelles <roger.pueyo@guifi.net>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# The full GNU General Public License is included in this distribution in
-# the file called "COPYING".
-#
-# This script gives information about bmx7
-# Can be executed from a linux shell: ./bmx7-info -s links
-# Or from web interfae (with cgi enabled): http://host/cgi-bin/bmx7-info?links
-# If you ask for a directory you wil get the directory contents in JSON forman
-
-BMX7_DIR="$(uci get bmx7.general.runtimeDir 2>/dev/null)" || BMX7_DIR="/var/run/bmx7/json"
-
-#Checking if shell mode or cgi-bin mode
-if [ "$1" == "-s" ]; then
- QUERY="$2"
-else
- QUERY="${QUERY_STRING%%=*}"
- echo "Content-type: application/json"
- echo ""
-fi
-
-check_path() {
- [ -d "$1" ] && path=$(cd $1; pwd)
- [ -f "$1" ] && path=$(cd $1/..; pwd)
- [ $(echo "$path" | grep -c "^$BMX7_DIR") -ne 1 ] && exit 1
-}
-
-print_mem() {
- echo -n '{ "memory": { "bmx7": "'
- cat /proc/$(cat /var/run/bmx7/pid)/status |grep -i VmSize | tr -s " " | cut -d " " -f 2,3 | tr -d "\n"
- echo '"}}'
-}
-
-print_query() {
- # If the query is a directory
- [ -d "$BMX7_DIR/$1" ] &&
- {
- # If /all has not been specified
- [ -z "$QALL" ] &&
- {
- total=$(ls $BMX7_DIR/$1 | wc -w)
- i=1
- echo -n "{ \"$1\": [ "
- for f in $(ls $BMX7_DIR/$1); do
- echo -n "{ \"name\": \"$f\" }"
- [ $i -lt $total ] && echo -n ','
- i=$(( $i + 1 ))
- done
- echo -n " ] }"
-
- # If /all has been specified, printing all the files together
- } || {
- comma=""
- echo -n "[ "
- for entry in "$BMX7_DIR/$1/"*; do
- [ -f "$entry" ] &&
- {
- ${comma:+echo "$comma"}
- tr -d '\n' < "$entry"
- comma=","
- }
- done
- echo -n " ]"
- }
- }
-
- # If the query is a file, just printing the file
- [ -f "$BMX7_DIR/$1" ] && [ -s "$BMX7_DIR/$1" ] && cat "$BMX7_DIR/$1" && return 0 || return 1
-}
-
-if [ "${QUERY##*/}" == "all" ]; then
- QUERY="${QUERY%/all}"
- QALL=1
-fi
-
-if [ "$QUERY" == '$info' ]; then
- echo '{ "info": [ '
- print_query status
- echo -n ","
- print_query interfaces && echo -n "," || echo -n '{ "interfaces": "" },'
- print_query links && echo -n "," || echo -n '{ "links": "" },'
- print_mem
- echo "] }"
-fi
-
-if [ "$QUERY" == '$neighbours' ]; then
- QALL=1
- echo '{ "neighbours": [ '
- echo '{ "originators": '
- print_query originators
- echo '}, '
- echo '{ "descriptions": '
- print_query descriptions
- echo "} ] }"
- exit 0
-
-else if [ "$QUERY" == '$tunnels' ]; then
- bmx7 -c --jshow tunnels /r=0
- exit 0
-
- else if [ "$QUERY" == '$originators' ]; then
- bmx7 -c --jshow originators /r=0
- exit 0
-
- else
- check_path "$BMX7_DIR/$QUERY"
- print_query $QUERY
- exit 0
- fi
- fi
-fi
-fi
-
-ls -1F "$BMX7_DIR"
-exit 0
-
+++ /dev/null
-.njg-overlay{
- background: #fbfbfb;
- border-radius: 2px;
- border: 1px solid #ccc;
- color: #6d6357;
- font-family: Arial, sans-serif;
- font-family: sans-serif;
- font-size: 14px;
- line-height: 20px;
- height: auto;
- max-width: 400px;
- min-width: 200px;
- padding: 0 15px;
- right: 10px;
- top: 10px;
- width: auto;
-}
-
-.njg-metadata{
- background: #fbfbfb;
- border-radius: 2px;
- border: 1px solid #ccc;
- color: #6d6357;
- display: none;
- font-family: Arial, sans-serif;
- font-family: sans-serif;
- font-size: 14px;
- height: auto;
- left: 10px;
- max-width: 500px;
- min-width: 200px;
- padding: 0 15px;
- top: 10px;
- width: auto;
-}
-
-.njg-node{
- stroke-opacity: 0.5;
- stroke-width: 7px;
- stroke: #fff;
-}
-
-.njg-node:hover,
-.njg-node.njg-open {
- stroke: rgba(0, 0, 0, 0.2);
-}
-
-.njg-link{
- cursor: pointer;
- stroke: #999;
- stroke-width: 2;
- stroke-opacity: 0.25;
-}
-
-.njg-link:hover,
-.njg-link.njg-open{
- stroke-width: 4 !important;
- stroke-opacity: 0.5;
-}
+++ /dev/null
-.njg-hidden {
- display: none !important;
- visibility: hidden !important;
-}
-
-.njg-tooltip{
- font-family: sans-serif;
- font-size: 10px;
- fill: #000;
- opacity: 0.5;
- text-anchor: middle;
-}
-
-.njg-overlay{
- display: none;
- position: absolute;
- z-index: 11;
-}
-
-.njg-close{
- cursor: pointer;
- position: absolute;
- right: 10px;
- top: 10px;
-}
-.njg-close:before { content: "\2716"; }
-
-.njg-metadata{
- display: none;
- position: absolute;
- z-index: 12;
-}
-
-.njg-node{ cursor: pointer }
-.njg-link{ cursor: pointer }
-
-#njg-select-group {
- text-align: center;
- box-shadow: 0 0 10px #ccc;
- position: fixed;
- left: 50%;
- top: 50%;
- width: 50%;
- margin-top: -7.5em;
- margin-left: -25%;
- padding: 5em 2em;
-}
-
-#njg-select-group select {
- font-size: 2em;
- padding: 10px 15px;
- width: 50%;
- cursor: pointer;
-}
-
-#njg-select-group option {
- padding: 0.5em;
-}
-
-#njg-select-group option[value=""] {
- color: #aaa;
-}
+++ /dev/null
-// version 0.1
-(function () {
- /**
- * vanilla JS implementation of jQuery.extend()
- */
- d3._extend = function(defaults, options) {
- var extended = {},
- prop;
- for(prop in defaults) {
- if(Object.prototype.hasOwnProperty.call(defaults, prop)) {
- extended[prop] = defaults[prop];
- }
- }
- for(prop in options) {
- if(Object.prototype.hasOwnProperty.call(options, prop)) {
- extended[prop] = options[prop];
- }
- }
- return extended;
- };
-
- /**
- * @function
- * @name d3._pxToNumber
- * Convert strings like "10px" to 10
- *
- * @param {string} val The value to convert
- * @return {int} The converted integer
- */
- d3._pxToNumber = function(val) {
- return parseFloat(val.replace('px'));
- };
-
- /**
- * @function
- * @name d3._windowHeight
- *
- * Get window height
- *
- * @return {int} The window innerHeight
- */
- d3._windowHeight = function() {
- return window.innerHeight || document.documentElement.clientHeight || 600;
- };
-
- /**
- * @function
- * @name d3._getPosition
- *
- * Get the position of `element` relative to `container`
- *
- * @param {object} element
- * @param {object} container
- */
- d3._getPosition = function(element, container) {
- var n = element.node(),
- nPos = n.getBoundingClientRect();
- cPos = container.node().getBoundingClientRect();
- return {
- top: nPos.top - cPos.top,
- left: nPos.left - cPos.left,
- width: nPos.width,
- bottom: nPos.bottom - cPos.top,
- height: nPos.height,
- right: nPos.right - cPos.left
- };
- };
-
- /**
- * netjsongraph.js main function
- *
- * @constructor
- * @param {string} url The NetJSON file url
- * @param {object} opts The object with parameters to override {@link d3.netJsonGraph.opts}
- */
- d3.netJsonGraph = function(url, opts) {
- /**
- * Default options
- *
- * @param {string} el "body" The container element el: "body" [description]
- * @param {bool} metadata true Display NetJSON metadata at startup?
- * @param {bool} defaultStyle true Use css style?
- * @param {bool} animationAtStart false Animate nodes or not on load
- * @param {array} scaleExtent [0.25, 5] The zoom scale's allowed range. @see {@link https://github.com/mbostock/d3/wiki/Zoom-Behavior#scaleExtent}
- * @param {int} charge -130 The charge strength to the specified value. @see {@link https://github.com/mbostock/d3/wiki/Force-Layout#charge}
- * @param {int} linkDistance 50 The target distance between linked nodes to the specified value. @see {@link https://github.com/mbostock/d3/wiki/Force-Layout#linkDistance}
- * @param {float} linkStrength 0.2 The strength (rigidity) of links to the specified value in the range. @see {@link https://github.com/mbostock/d3/wiki/Force-Layout#linkStrength}
- * @param {float} friction 0.9 The friction coefficient to the specified value. @see {@link https://github.com/mbostock/d3/wiki/Force-Layout#friction}
- * @param {string} chargeDistance Infinity The maximum distance over which charge forces are applied. @see {@link https://github.com/mbostock/d3/wiki/Force-Layout#chargeDistance}
- * @param {float} theta 0.8 The Barnes–Hut approximation criterion to the specified value. @see {@link https://github.com/mbostock/d3/wiki/Force-Layout#theta}
- * @param {float} gravity 0.1 The gravitational strength to the specified numerical value. @see {@link https://github.com/mbostock/d3/wiki/Force-Layout#gravity}
- * @param {int} circleRadius 8 The radius of circles (nodes) in pixel
- * @param {string} labelDx "0" SVG dx (distance on x axis) attribute of node labels in graph
- * @param {string} labelDy "-1.3em" SVG dy (distance on y axis) attribute of node labels in graph
- * @param {function} onInit Callback function executed on initialization
- * @param {function} onLoad Callback function executed after data has been loaded
- * @param {function} onEnd Callback function executed when initial animation is complete
- * @param {function} linkDistanceFunc By default high density areas have longer links
- * @param {function} redraw Called when panning and zooming
- * @param {function} prepareData Used to convert NetJSON NetworkGraph to the javascript data
- * @param {function} onClickNode Called when a node is clicked
- * @param {function} onClickLink Called when a link is clicked
- */
- opts = d3._extend({
- el: "body",
- metadata: true,
- defaultStyle: true,
- animationAtStart: true,
- scaleExtent: [0.25, 5],
- charge: -130,
- linkDistance: 50,
- linkStrength: 0.2,
- friction: 0.9, // d3 default
- chargeDistance: Infinity, // d3 default
- theta: 0.8, // d3 default
- gravity: 0.1,
- circleRadius: 8,
- labelDx: "0",
- labelDy: "-1.3em",
- nodeClassProperty: null,
- linkClassProperty: null,
- /**
- * @function
- * @name onInit
- *
- * Callback function executed on initialization
- * @param {string|object} url The netJson remote url or object
- * @param {object} opts The object of passed arguments
- * @return {function}
- */
- onInit: function(url, opts) {},
- /**
- * @function
- * @name onLoad
- *
- * Callback function executed after data has been loaded
- * @param {string|object} url The netJson remote url or object
- * @param {object} opts The object of passed arguments
- * @return {function}
- */
- onLoad: function(url, opts) {},
- /**
- * @function
- * @name onEnd
- *
- * Callback function executed when initial animation is complete
- * @param {string|object} url The netJson remote url or object
- * @param {object} opts The object of passed arguments
- * @return {function}
- */
- onEnd: function(url, opts) {},
- /**
- * @function
- * @name linkDistanceFunc
- *
- * By default, high density areas have longer links
- */
- linkDistanceFunc: function(d){
- var val = opts.linkDistance;
- if(d.source.linkCount >= 4 && d.target.linkCount >= 4) {
- return val * 2;
- }
- return val;
- },
- /**
- * @function
- * @name redraw
- *
- * Called on zoom and pan
- */
- redraw: function() {
- panner.attr("transform",
- "translate(" + d3.event.translate + ") " +
- "scale(" + d3.event.scale + ")"
- );
- },
- /**
- * @function
- * @name prepareData
- *
- * Convert NetJSON NetworkGraph to the data structure consumed by d3
- *
- * @param graph {object}
- */
- prepareData: function(graph) {
- var nodesMap = {},
- nodes = graph.nodes.slice(), // copy
- links = graph.links.slice(), // copy
- nodes_length = graph.nodes.length,
- links_length = graph.links.length;
-
- for(var i = 0; i < nodes_length; i++) {
- // count how many links every node has
- nodes[i].linkCount = 0;
- nodesMap[nodes[i].id] = i;
- }
- for(var c = 0; c < links_length; c++) {
- var sourceIndex = nodesMap[links[c].source],
- targetIndex = nodesMap[links[c].target];
- // ensure source and target exist
- if(!nodes[sourceIndex]) { throw("source '" + links[c].source + "' not found"); }
- if(!nodes[targetIndex]) { throw("target '" + links[c].target + "' not found"); }
- links[c].source = nodesMap[links[c].source];
- links[c].target = nodesMap[links[c].target];
- // add link count to both ends
- nodes[sourceIndex].linkCount++;
- nodes[targetIndex].linkCount++;
- }
- return { "nodes": nodes, "links": links };
- },
- /**
- * @function
- * @name onClickNode
- *
- * Called when a node is clicked
- */
- onClickNode: function(n) {
- var overlay = d3.select(".njg-overlay"),
- overlayInner = d3.select(".njg-overlay > .njg-inner"),
- html = "<p><b>id</b>: " + n.id + "</p>";
- if(n.label) { html += "<p><b>label</b>: " + n.label + "</p>"; }
- if(n.properties) {
- for(var key in n.properties) {
- if(!n.properties.hasOwnProperty(key)) { continue; }
- html += "<p><b>"+key.replace(/_/g, " ")+"</b>: " + n.properties[key] + "</p>";
- }
- }
- if(n.linkCount) { html += "<p><b>links</b>: " + n.linkCount + "</p>"; }
- if(n.local_addresses) {
- html += "<p><b>local addresses</b>:<br>" + n.local_addresses.join('<br>') + "</p>";
- }
- overlayInner.html(html);
- overlay.classed("njg-hidden", false);
- overlay.style("display", "block");
- // set "open" class to current node
- removeOpenClass();
- d3.select(this).classed("njg-open", true);
- },
- /**
- * @function
- * @name onClickLink
- *
- * Called when a node is clicked
- */
- onClickLink: function(l) {
- var overlay = d3.select(".njg-overlay"),
- overlayInner = d3.select(".njg-overlay > .njg-inner"),
- html = "<p><b>source</b>: " + (l.source.label || l.source.id) + "</p>";
- html += "<p><b>target</b>: " + (l.target.label || l.target.id) + "</p>";
- html += "<p><b>cost</b>: " + l.cost + "</p>";
- if(l.properties) {
- for(var key in l.properties) {
- if(!l.properties.hasOwnProperty(key)) { continue; }
- html += "<p><b>"+ key.replace(/_/g, " ") +"</b>: " + l.properties[key] + "</p>";
- }
- }
- overlayInner.html(html);
- overlay.classed("njg-hidden", false);
- overlay.style("display", "block");
- // set "open" class to current link
- removeOpenClass();
- d3.select(this).classed("njg-open", true);
- }
- }, opts);
-
- // init callback
- opts.onInit(url, opts);
-
- if(!opts.animationAtStart) {
- opts.linkStrength = 2;
- opts.friction = 0.3;
- opts.gravity = 0;
- }
- if(opts.el == "body") {
- var body = d3.select(opts.el),
- rect = body.node().getBoundingClientRect();
- if (d3._pxToNumber(d3.select("body").style("height")) < 60) {
- body.style("height", d3._windowHeight() - rect.top - rect.bottom + "px");
- }
- }
- var el = d3.select(opts.el).style("position", "relative"),
- width = d3._pxToNumber(el.style('width')),
- height = d3._pxToNumber(el.style('height')),
- force = d3.layout.force()
- .charge(opts.charge)
- .linkStrength(opts.linkStrength)
- .linkDistance(opts.linkDistanceFunc)
- .friction(opts.friction)
- .chargeDistance(opts.chargeDistance)
- .theta(opts.theta)
- .gravity(opts.gravity)
- // width is easy to get, if height is 0 take the height of the body
- .size([width, height]),
- zoom = d3.behavior.zoom().scaleExtent(opts.scaleExtent),
- // panner is the element that allows zooming and panning
- panner = el.append("svg")
- .attr("width", width)
- .attr("height", height)
- .call(zoom.on("zoom", opts.redraw))
- .append("g")
- .style("position", "absolute"),
- svg = d3.select(opts.el + " svg"),
- drag = force.drag(),
- overlay = d3.select(opts.el).append("div").attr("class", "njg-overlay"),
- closeOverlay = overlay.append("a").attr("class", "njg-close"),
- overlayInner = overlay.append("div").attr("class", "njg-inner"),
- metadata = d3.select(opts.el).append("div").attr("class", "njg-metadata"),
- metadataInner = metadata.append("div").attr("class", "njg-inner"),
- closeMetadata = metadata.append("a").attr("class", "njg-close"),
- // container of ungrouped networks
- str = [],
- selected = [],
- /**
- * @function
- * @name removeOpenClass
- *
- * Remove open classes from nodes and links
- */
- removeOpenClass = function () {
- d3.selectAll("svg .njg-open").classed("njg-open", false);
- };
- processJson = function(graph) {
- /**
- * Init netJsonGraph
- */
- init = function(url, opts) {
- d3.netJsonGraph(url, opts);
- };
- /**
- * Remove all instances
- */
- destroy = function() {
- force.stop();
- d3.select("#selectGroup").remove();
- d3.select(".njg-overlay").remove();
- d3.select(".njg-metadata").remove();
- overlay.remove();
- overlayInner.remove();
- metadata.remove();
- svg.remove();
- node.remove();
- link.remove();
- nodes = [];
- links = [];
- };
- /**
- * Destroy and e-init all instances
- * @return {[type]} [description]
- */
- reInit = function() {
- destroy();
- init(url, opts);
- };
-
- var data = opts.prepareData(graph),
- links = data.links,
- nodes = data.nodes;
-
- // disable some transitions while dragging
- drag.on('dragstart', function(n){
- d3.event.sourceEvent.stopPropagation();
- zoom.on('zoom', null);
- })
- // re-enable transitions when dragging stops
- .on('dragend', function(n){
- zoom.on('zoom', opts.redraw);
- })
- .on("drag", function(d) {
- // avoid pan & drag conflict
- d3.select(this).attr("x", d.x = d3.event.x).attr("y", d.y = d3.event.y);
- });
-
- force.nodes(nodes).links(links).start();
-
- var link = panner.selectAll(".link")
- .data(links)
- .enter().append("line")
- .attr("class", function (link) {
- var baseClass = "njg-link",
- addClass = null;
- value = link.properties && link.properties[opts.linkClassProperty];
- if (opts.linkClassProperty && value) {
- // if value is stirng use that as class
- if (typeof(value) === "string") {
- addClass = value;
- }
- else if (typeof(value) === "number") {
- addClass = opts.linkClassProperty + value;
- }
- else if (value === true) {
- addClass = opts.linkClassProperty;
- }
- return baseClass + " " + addClass;
- }
- return baseClass;
- })
- .on("click", opts.onClickLink),
- groups = panner.selectAll(".node")
- .data(nodes)
- .enter()
- .append("g");
- node = groups.append("circle")
- .attr("class", function (node) {
- var baseClass = "njg-node",
- addClass = null;
- value = node.properties && node.properties[opts.nodeClassProperty];
- if (opts.nodeClassProperty && value) {
- // if value is stirng use that as class
- if (typeof(value) === "string") {
- addClass = value;
- }
- else if (typeof(value) === "number") {
- addClass = opts.nodeClassProperty + value;
- }
- else if (value === true) {
- addClass = opts.nodeClassProperty;
- }
- return baseClass + " " + addClass;
- }
- return baseClass;
- })
- .attr("r", opts.circleRadius)
- .on("click", opts.onClickNode)
- .call(drag);
-
- var labels = groups.append('text')
- .text(function(n){ return n.label || n.id })
- .attr('dx', opts.labelDx)
- .attr('dy', opts.labelDy)
- .attr('class', 'njg-tooltip');
-
- // Close overlay
- closeOverlay.on("click", function() {
- removeOpenClass();
- overlay.classed("njg-hidden", true);
- });
- // Close Metadata panel
- closeMetadata.on("click", function() {
- // Reinitialize the page
- if(graph.type === "NetworkCollection") {
- reInit();
- }
- else {
- removeOpenClass();
- metadata.classed("njg-hidden", true);
- }
- });
- // default style
- // TODO: probably change defaultStyle
- // into something else
- if(opts.defaultStyle) {
- var colors = d3.scale.category20c();
- node.style({
- "fill": function(d){ return colors(d.linkCount); },
- "cursor": "pointer"
- });
- }
- // Metadata style
- if(opts.metadata) {
- metadata.attr("class", "njg-metadata").style("display", "block");
- }
-
- var attrs = ["protocol",
- "version",
- "revision",
- "metric",
- "router_id",
- "topology_id"],
- html = "";
- if(graph.label) {
- html += "<h3>" + graph.label + "</h3>";
- }
- for(var i in attrs) {
- var attr = attrs[i];
- if(graph[attr]) {
- html += "<p><b>" + attr + "</b>: <span>" + graph[attr] + "</span></p>";
- }
- }
- // Add nodes and links count
- html += "<p><b>nodes</b>: <span>" + graph.nodes.length + "</span></p>";
- html += "<p><b>links</b>: <span>" + graph.links.length + "</span></p>";
- metadataInner.html(html);
- metadata.classed("njg-hidden", false);
-
- // onLoad callback
- opts.onLoad(url, opts);
-
- force.on("tick", function() {
- link.attr("x1", function(d) {
- return d.source.x;
- })
- .attr("y1", function(d) {
- return d.source.y;
- })
- .attr("x2", function(d) {
- return d.target.x;
- })
- .attr("y2", function(d) {
- return d.target.y;
- });
-
- node.attr("cx", function(d) {
- return d.x;
- })
- .attr("cy", function(d) {
- return d.y;
- });
-
- labels.attr("transform", function(d) {
- return "translate(" + d.x + "," + d.y + ")";
- });
- })
- .on("end", function(){
- force.stop();
- // onEnd callback
- opts.onEnd(url, opts);
- });
-
- return force;
- };
-
- if(typeof(url) === "object") {
- processJson(url);
- }
- else {
- /**
- * Parse the provided json file
- * and call processJson() function
- *
- * @param {string} url The provided json file
- * @param {function} error
- */
- d3.json(url, function(error, graph) {
- if(error) { throw error; }
- /**
- * Check if the json contains a NetworkCollection
- */
- if(graph.type === "NetworkCollection") {
- var selectGroup = body.append("div").attr("id", "njg-select-group"),
- select = selectGroup.append("select")
- .attr("id", "select");
- str = graph;
- select.append("option")
- .attr({
- "value": "",
- "selected": "selected",
- "name": "default",
- "disabled": "disabled"
- })
- .html("Choose the network to display");
- graph.collection.forEach(function(structure) {
- select.append("option").attr("value", structure.type).html(structure.type);
- // Collect each network json structure
- selected[structure.type] = structure;
- });
- select.on("change", function() {
- selectGroup.attr("class", "njg-hidden");
- // Call selected json structure
- processJson(selected[this.options[this.selectedIndex].value]);
- });
- }
- else {
- processJson(graph);
- }
- });
- }
- };
-})();
+++ /dev/null
-/*
- Copyright © 2011 Pau Escrich <pau@dabax.net>
- Contributors Lluis Esquerda <eskerda@gmail.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- The full GNU General Public License is included in this distribution in
- the file called "COPYING".
-*/
-
-
-/*
- Table pooler is a function to easy call XHR poller.
-
- new TablePooler(5,"/cgi-bin/bmx7-info", {'status':''}, "status_table", function(st){
- var table = Array()
- table.push(st.first,st.second)
- return table
- }
-
- The parameters are:
- polling_time: time between pollings
- json_url: the json url to fetch the data
- json_call: the json call
- output_table_id: the table where javascript will put the data
- callback_function: the function that will be executed each polling_time
-
- The callback_function must return an array of arrays (matrix).
- In the code st is the data obtained from the json call
-*/
-
-function TablePooler (time, jsonurl, getparams, div_id, callback) {
- this.div_id = div_id;
- this.div = document.getElementById(div_id);
- this.callback = callback;
- this.jsonurl = jsonurl;
- this.getparams = getparams;
- this.time = time;
-
- this.start = function(){
- XHR.poll(this.time, this.jsonurl, this.getparams, function(x, st){
- var data = this.callback(st);
- var content;
- for (var i = 0; i < data.length; i++){
- rowId = "trDiv_" + this.div_id + i;
- rowDiv = document.getElementById(rowId);
- if (rowDiv === null) {
- rowDiv = document.createElement("div");
- rowDiv.id = rowId;
- rowDiv.className = "tr";
- this.div.appendChild(rowDiv);
- }
- for (var j = 0; j < data[i].length; j++){
- cellId = "tdDiv_" + this.div_id + i + j;
- cellDiv = document.getElementById(cellId);
- if (cellDiv === null) {
- cellDiv = document.createElement("div");
- cellDiv.id = cellId;
- cellDiv.className = "td";
- rowDiv.appendChild(cellDiv);
- }
- if (typeof data[i][j] !== 'undefined' && data[i][j].length == 2) {
- content = data[i][j][0] + "/" + data[i][j][1];
- }
- else content = data[i][j];
- cellDiv.innerHTML = content;
- }
- }
- }.bind(this));
- }
-
-
- this.start();
-}
PKG_NAME:=mcproxy
PKG_SOURCE_VERSION:=93b5ace42268160ebbfff4c61818fb15fa2d9b99
PKG_VERSION:=2017-08-24-$(PKG_SOURCE_VERSION)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/mcproxy/mcproxy.git
#include <numeric>
#include <unistd.h>
-+#ifndef __GLIBC__
++#if !defined(__GLIBC__) || defined(__UCLIBC__)
+#include "sourcefilter.cpp"
+#endif /* __GLIBC__ */
+
@@ -38,6 +38,8 @@
#include <unistd.h>
- #ifndef __GLIBC__
+ #if !defined(__GLIBC__) || defined(__UCLIBC__)
+#define IP_MULTICAST_ALL 49
+
#include "sourcefilter.cpp"
PKG_NAME:=nodogsplash
PKG_FIXUP:=autoreconf
-PKG_VERSION:=3.3.2
+PKG_VERSION:=4.0.0
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://codeload.github.com/nodogsplash/nodogsplash/tar.gz/v$(PKG_VERSION)?
PKG_SOURCE:=nodogsplash-$(PKG_VERSION).tar.gz
-PKG_HASH:=5a7b14dd2cce6a8ca261a720d87948565fc2f05d4926bf155b9e0db483ff6bcb
+PKG_HASH:=4cc3a9200380f03c8c3a71afc1fda0006b8e7bf70129f2419768a767b734da21
PKG_BUILD_DIR:=$(BUILD_DIR)/nodogsplash-$(PKG_VERSION)
PKG_MAINTAINER:=Moritz Warning <moritzwarning@web.de>
$(CP) $(PKG_BUILD_DIR)/openwrt/nodogsplash/files/etc/uci-defaults/40_nodogsplash $(1)/etc/uci-defaults/
$(CP) $(PKG_BUILD_DIR)/openwrt/nodogsplash/files/usr/lib/nodogsplash/restart.sh $(1)/usr/lib/nodogsplash/
$(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/demo-preauth.sh $(1)/usr/lib/nodogsplash/login.sh
+ $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-aes/fas-aes.php $(1)/etc/nodogsplash/
endef
define Package/nodogsplash/postrm
PKG_SOURCE_URL:=https://git.open-mesh.org/vis.git
PKG_REV:=e141311c6a4fc824efbad536c137ed279905d825
PKG_VERSION:=1440
-PKG_RELEASE:=0
+PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_MIRROR_HASH:=fd4b337a56993eec9a03ad8e7918bccc7691aa8b2e5ab6dd7863350f07503285
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
-PKG_EXTRA_CFLAGS=-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE
-
include $(INCLUDE_DIR)/package.mk
define Package/vis
visualization server for B.A.T.M.A.N. layer 3
endef
-MAKE_VIS_ARGS += \
- EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
- CCFLAGS="$(TARGET_CFLAGS)" \
- OFLAGS="$(TARGET_CFLAGS)" \
+MAKE_FLAGS += \
+ EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE' \
REVISION="$(PKG_REV)" \
CC="$(TARGET_CC)" \
- NODEBUG=1 \
- UNAME="Linux" \
- INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
- STRIP="/bin/true" \
- vis install
-
-
-define Build/Configure
-endef
-
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_VIS_ARGS)
-endef
+ vis
define Package/vis/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/vis $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/vis $(1)/usr/sbin/
$(INSTALL_BIN) ./files/etc/init.d/vis $(1)/etc/init.d
$(INSTALL_DATA) ./files/etc/config/vis $(1)/etc/config
endef
#!/bin/sh /etc/rc.common
START=90
+USE_PROCD=1
-start () {
- interface=$(uci get vis.general.interface)
+vis_start() {
+ local config="$1"
+ local interface
+
+ [ "$config" = "general" ] || return 1
+
+ config_get interface "$config" interface
if [ "$interface" = "" ]; then
echo $1 Error, you must specify at least a network interface
- exit
+ return 1
fi
- vis_args=$interface
- vis $vis_args >/dev/null 2>&1
+ procd_open_instance "${config}"
+ procd_set_param command /usr/sbin/vis
+ procd_append_param command -D
+ procd_append_param command ${interface}
+ procd_set_param netdev $interface
+ procd_close_instance
}
-stop () {
- killall vis
+start_service() {
+ config_load "vis"
+ config_foreach vis_start vis
}
-
+service_triggers() {
+ procd_add_reload_trigger "vis"
+
+ procd_open_trigger
+ procd_add_raw_trigger "interface.*" 1000 /etc/init.d/vis reload
+ procd_close_trigger
+}
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sun, 1 Dec 2013 14:39:00 +0100
+Subject: Allow one to disable forking to background in debug_mode 0
+
+---
+ posix/init.c | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+--- a/vis.c
++++ b/vis.c
+@@ -58,6 +58,7 @@ buffer_t *fillme = NULL;
+
+ static int8_t stop;
+ uint8_t debug_level = 0;
++static int no_detach = 0;
+
+ formats selected_formats = dot_draw;
+
+@@ -716,6 +717,7 @@ void print_usage() {
+ printf( "Usage: vis <interface(s)> \n" );
+ printf( "\t-j output mesh topology as json on port %d\n", JSON_PORT );
+ printf( "\t-d debug level\n" );
++ printf( "\t-D run in foreground\n" );
+ printf( "\t-h help\n" );
+ printf( "\t-v Version\n\n" );
+ printf( "Olsrs3d / Meshs3d is an application to visualize a mesh network.\nIt is a part of s3d, have a look at s3d.berlios.de\n\n" );
+@@ -736,7 +738,7 @@ int main( int argc, char **argv ) {
+ fd_set wait_sockets, tmp_wait_sockets;
+
+
+- while ( ( optchar = getopt ( argc, argv, "jd:hv" ) ) != -1 ) {
++ while ( ( optchar = getopt ( argc, argv, "jd:hvD" ) ) != -1 ) {
+
+ switch( optchar ) {
+
+@@ -771,6 +773,11 @@ int main( int argc, char **argv ) {
+ selected_formats |= json;
+ found_args++;
+ break;
++
++ case 'D':
++ no_detach = 1;
++ found_args++;
++ break;
+
+ default:
+ print_usage();
+@@ -889,7 +896,7 @@ int main( int argc, char **argv ) {
+
+
+ /* daemonize */
+- if ( debug_level == 0 ) {
++ if ( debug_level == 0 && !no_detach) {
+
+ if ( my_daemon() < 0 )
+ exit_error( "Error - can't fork to background: %s\n", strerror(errno) );