include $(TOPDIR)/rules.mk
PKG_NAME:=alfred
-PKG_VERSION:=2018.4
+PKG_VERSION:=2019.2
PKG_RELEASE:=0
-PKG_HASH:=8d6595201d5d21b4e3824d408dc9ed705789af1d8831692efa8ffe69a3e1cc58
+PKG_HASH:=b656f0e9a97a99c7531b6d49ebfd663451c16cdd275bbf7d48ff8daed3880bf2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
PKG_NAME:=batctl
-PKG_VERSION:=2018.4
+PKG_VERSION:=2019.2
PKG_RELEASE:=1
-PKG_HASH:=e43827a5e868b4e134e77ca04da989fde1981463166bf1b6f2053acc3edd6257
+PKG_HASH:=fb656208ff7d4cd8b1b422f60c9e6d8747302a347cbf6c199d7afa9b80f80ea3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
include $(INCLUDE_DIR)/package.mk
-define Package/batctl
+define Package/batctl/Default
URL:=https://www.open-mesh.org/
SECTION:=net
CATEGORY:=Network
- DEPENDS:=+kmod-batman-adv +libnl-tiny +libc +librt
- TITLE:=B.A.T.M.A.N. Advanced user space configuration tool batctl
+ DEPENDS:=+libnl-tiny +libc +librt
+ PROVIDES:=batctl
MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
endef
version $(PKG_VERSION) of the user space utility.
endef
+define Package/batctl-tiny
+$(call Package/batctl/Default)
+ TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
+ VARIANT:=tiny
+ PROVIDES:=batctl
+ ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny
+endef
+
+define Package/batctl-tiny/description
+$(Package/batctl/description)
+Only configuration relevant subcommands are enabled.
+endef
+
+define Package/batctl-default
+$(call Package/batctl/Default)
+ TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default)
+ VARIANT:=default
+ ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default
+endef
+
+define Package/batctl-default/description
+$(Package/batctl/description)
+Standard subcommands for configuration and online debugging are enabled.
+endef
+
+define Package/batctl-full
+$(call Package/batctl/Default)
+ TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full)
+ VARIANT:=full
+ ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
+endef
+
+define Package/batctl-full/description
+$(Package/batctl/description)
+Subcommands for configuration, online and offline debugging are enabled.
+endef
+
# The linker can identify unused sections of a binary when each symbol is stored
# in a separate section. This mostly removes unused linker sections and reduces
# the size by ~3% on mipsel.
batctl install \
REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
+config-n := \
+ aggregation \
+ ap_isolation \
+ backbonetable \
+ bisect_iv \
+ bonding \
+ bridge_loop_avoidance \
+ claimtable \
+ dat_cache \
+ distributed_arp_table \
+ elp_interval \
+ event \
+ fragmentation \
+ gateways \
+ gw_mode \
+ hop_penalty \
+ interface \
+ isolation_mark \
+ loglevel \
+ mcast_flags \
+ multicast_fanout \
+ multicast_forceflood \
+ multicast_mode \
+ nc_nodes \
+ neighbors \
+ network_coding \
+ orig_interval \
+ originators \
+ ping \
+ routing_algo \
+ statistics \
+ tcpdump \
+ throughput_override \
+ throughputmeter \
+ traceroute \
+ transglobal \
+ translate \
+ translocal \
+
+config-settings := \
+ aggregation \
+ ap_isolation \
+ bonding \
+ bridge_loop_avoidance \
+ distributed_arp_table \
+ elp_interval \
+ fragmentation \
+ gw_mode \
+ hop_penalty \
+ interface \
+ isolation_mark \
+ loglevel \
+ multicast_fanout \
+ multicast_forceflood \
+ multicast_mode \
+ network_coding \
+ orig_interval \
+ routing_algo \
+ throughput_override \
+
+config-tables := \
+ backbonetable \
+ claimtable \
+ dat_cache \
+ gateways \
+ loglevel \
+ nc_nodes \
+ neighbors \
+ originators \
+ statistics \
+ transglobal \
+ translocal \
+
+config-tools := \
+ event \
+ ping \
+ tcpdump \
+ throughputmeter \
+ traceroute \
+ translate \
+
+config-extratools := \
+ bisect_iv \
+
+ifeq ($(BUILD_VARIANT),tiny)
+
+config-y := \
+ $(config-settings) \
+
+endif
+
+ifeq ($(BUILD_VARIANT),default)
+
+config-y := \
+ $(config-settings) \
+ $(config-tables) \
+ $(config-tools) \
+
+endif
+
+ifeq ($(BUILD_VARIANT),full)
+
+config-y := \
+ $(config-settings) \
+ $(config-tables) \
+ $(config-tools) \
+ $(config-extratools) \
+
+endif
+
+define ConfigVars
+$(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
+))
+endef
+
+define batctl_config
+$(call ConfigVars,n)$(call ConfigVars,y)
+endef
+$(eval $(call shexport,batctl_config))
define Build/Compile
- $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS)
+ $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS) \
+ $$$$$(call shvar,batctl_config)
+endef
+
+define Package/batctl-tiny/install
+ $(INSTALL_DIR) $(1)/usr/libexec
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
+endef
+
+define Package/batctl-default/install
+ $(INSTALL_DIR) $(1)/usr/libexec
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
endef
-define Package/batctl/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/sbin/
+define Package/batctl-full/install
+ $(INSTALL_DIR) $(1)/usr/libexec
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
endef
-$(eval $(call BuildPackage,batctl))
+$(eval $(call BuildPackage,batctl-default))
+$(eval $(call BuildPackage,batctl-tiny))
+$(eval $(call BuildPackage,batctl-full))
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Thu, 6 Dec 2018 07:31:59 +0100
-Subject: [PATCH] batctl: Fix parsing of optional debug table command parameters
-
-The commands which should have no support for -t/-u/-m/-i were allowed to
-accept these parameters but commands which should have accepted them were
-denying them.
-
-Fixes: cd2b4047ead9 ("batctl: Convert debug table to command infrastructure")
-Reported-by: Andreas Ziegler <dev@andreas-ziegler.de>
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-
-Forwarded: https://patchwork.open-mesh.org/patch/17667/
----
- debug.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/debug.c b/debug.c
-index 2979dff99af0b1c98f56931e8650e298dd9eac9b..316312f7162dbe0dc38ced2df1444887482e7bad 100644
---- a/debug.c
-+++ b/debug.c
-@@ -89,7 +89,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
- }
- break;
- case 't':
-- if (debug_table->option_watch_interval) {
-+ if (!debug_table->option_watch_interval) {
- fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
- debug_table_usage(state);
- return EXIT_FAILURE;
-@@ -105,7 +105,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
- read_opt |= SKIP_HEADER;
- break;
- case 'u':
-- if (debug_table->option_unicast_only) {
-+ if (!debug_table->option_unicast_only) {
- fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
- debug_table_usage(state);
- return EXIT_FAILURE;
-@@ -114,7 +114,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
- read_opt |= UNICAST_ONLY;
- break;
- case 'm':
-- if (debug_table->option_multicast_only) {
-+ if (!debug_table->option_multicast_only) {
- fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
- debug_table_usage(state);
- return EXIT_FAILURE;
-@@ -123,7 +123,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
- read_opt |= MULTICAST_ONLY;
- break;
- case 'i':
-- if (debug_table->option_orig_iface) {
-+ if (!debug_table->option_orig_iface) {
- fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
- debug_table_usage(state);
- return EXIT_FAILURE;
--- /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");
# SPDX-License-Identifier: GPL-2.0
-# Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
+# Copyright (C) 2007-2019 B.A.T.M.A.N. contributors:
#
# Marek Lindner, Simon Wunderlich
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# 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, see <http://www.gnu.org/licenses/>.
#
# B.A.T.M.A.N meshing protocol
config BATMAN_ADV_DEBUG
bool "B.A.T.M.A.N. debugging"
- depends on BATMAN_ADV_DEBUGFS
+ depends on PACKAGE_kmod-batman-adv
help
This is an option for use by developers; most people should
say N here. This enables compilation of support for
- outputting debugging information to the kernel log. The
- output is controlled via the module parameter debug.
+ outputting debugging information to the debugfs log or tracing
+ buffer. The output is controlled via the batadv netdev specific
+ log_level setting.
+
+config BATMAN_ADV_SYSFS
+ bool "batman-adv sysfs entries"
+ depends on PACKAGE_kmod-batman-adv
+ default y
+ help
+ Say Y here if you want to enable batman-adv device configuration and
+ status interface through sysfs attributes. It is replaced by the
+ batadv generic netlink family but still used by various userspace
+ tools and scripts.
+
+ If unsure, say Y.
config BATMAN_ADV_TRACING
bool "B.A.T.M.A.N. tracing support"
PKG_NAME:=batman-adv
-PKG_VERSION:=2018.4
-PKG_RELEASE:=0
-PKG_HASH:=3500b4bc7d41ce1adef0b0684972a439d48b454ba78282e94df13ba90605484d
+PKG_VERSION:=2019.2
+PKG_RELEASE:=3
+PKG_HASH:=70c3f6a6cf88d2b25681a76768a52ed92d9fe992ba8e358368b6a8088757adc8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
URL:=https://www.open-mesh.org/
MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
SUBMENU:=Network Support
- DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211
+ DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl
TITLE:=B.A.T.M.A.N. Adv
FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoProbe,batman-adv)
CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \
CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_BATMAN_ADV_NC),y,n) \
CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \
+ CONFIG_BATMAN_ADV_SYSFS=$(if $(CONFIG_BATMAN_ADV_SYSFS),y,n) \
CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \
PKG_EXTRA_CFLAGS:= \
+++ /dev/null
-
-config 'mesh' 'bat0'
- #option 'aggregated_ogms' 1
- #option 'ap_isolation' 0
- #option 'bonding' 0
- #option 'fragmentation' 1
- #option 'gw_bandwidth' '10000/2000'
- #option 'gw_mode' 'off'
- #option 'gw_sel_class' 20
- #option 'log_level' 0
- #option 'orig_interval' 1000
- #option 'bridge_loop_avoidance' 1
- #option 'distributed_arp_table' 1
- #option 'multicast_mode' 1
- #option 'network_coding' 0
- #option 'hop_penalty' 30
- #option 'isolation_mark' '0x00000000/0x00000000'
-
-# yet another batX instance
-# config 'mesh' 'bat5'
+++ /dev/null
-#!/bin/sh
-
-. /lib/batman-adv/config.sh
-
-bat_load_module
-config_load batman-adv
-
-case "$ACTION" in
- add)
- [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE"
- ;;
-esac
--- /dev/null
+#!/bin/sh
+
+# This UCI-Defaults script will split the batadv proto network interfaces
+# in batadv_hardif and batadv proto. The configuration options from
+# /etc/config/batman-adv will be moved to the latter.
+
+. /lib/functions.sh
+
+proto_batadv_to_batadv_hardif() {
+ local section="$1"
+ local proto
+ local mesh
+ local routing_algo
+
+ config_get proto "${section}" proto
+ config_get mesh "${section}" mesh
+ config_get routing_algo "${section}" routing_algo
+
+ if [ -z "$mesh" -o "${proto}" != "batadv" ]; then
+ continue
+ fi
+
+ uci set network."${section}".proto="batadv_hardif"
+ uci rename network."${section}".mesh="master"
+ uci delete network."${section}".routing_algo
+
+ # create new section or adjust existing one
+ uci set network."${mesh}"=interface
+ uci set network."${mesh}".proto=batadv
+ [ -n "${routing_algo}" ] && uci set network."${mesh}".routing_algo="${routing_algo}"
+}
+
+mv_batadv_config_section() {
+ local section="$1"
+ local aggregated_ogms
+ local ap_isolation
+ local bonding
+ local bridge_loop_avoidance
+ local distributed_arp_table
+ local fragmentation
+ local gw_bandwidth
+ local gw_mode
+ local gw_sel_class
+ local hop_penalty
+ local isolation_mark
+ local log_level
+ local multicast_mode
+ local network_coding
+ local orig_interval
+
+ config_get aggregated_ogms "${section}" aggregated_ogms
+ config_get ap_isolation "${section}" ap_isolation
+ config_get bonding "${section}" bonding
+ config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance
+ config_get distributed_arp_table "${section}" distributed_arp_table
+ config_get fragmentation "${section}" fragmentation
+ config_get gw_bandwidth "${section}" gw_bandwidth
+ config_get gw_mode "${section}" gw_mode
+ config_get gw_sel_class "${section}" gw_sel_class
+ config_get hop_penalty "${section}" hop_penalty
+ config_get isolation_mark "${section}" isolation_mark
+ config_get log_level "${section}" log_level
+ config_get multicast_mode "${section}" multicast_mode
+ config_get network_coding "${section}" network_coding
+ config_get orig_interval "${section}" orig_interval
+
+ # update section in case it exists
+ [ -n "${aggregated_ogms}" ] && uci set network."${section}".aggregated_ogms="${aggregated_ogms}"
+ [ -n "${ap_isolation}" ] && uci set network."${section}".ap_isolation="${ap_isolation}"
+ [ -n "${bonding}" ] && uci set network."${section}".bonding="${bonding}"
+ [ -n "${bridge_loop_avoidance}" ] && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}"
+ [ -n "${distributed_arp_table}" ] && uci set network."${section}".distributed_arp_table="${distributed_arp_table}"
+ [ -n "${fragmentation}" ] && uci set network."${section}".fragmentation="${fragmentation}"
+ [ -n "${gw_bandwidth}" ] && uci set network."${section}".gw_bandwidth="${gw_bandwidth}"
+ [ -n "${gw_mode}" ] && uci set network."${section}".gw_mode="${gw_mode}"
+ [ -n "${gw_sel_class}" ] && uci set network."${section}".gw_sel_class="${gw_sel_class}"
+ [ -n "${hop_penalty}" ] && uci set network."${section}".hop_penalty="${hop_penalty}"
+ [ -n "${isolation_mark}" ] && uci set network."${section}".isolation_mark="${isolation_mark}"
+ [ -n "${log_level}" ] && uci set network."${section}".log_level="${log_level}"
+ [ -n "${multicast_mode}" ] && uci set network."${section}".multicast_mode="${multicast_mode}"
+ [ -n "${network_coding}" ] && uci set network."${section}".network_coding="${network_coding}"
+ [ -n "${orig_interval}" ] && uci set network."${section}".orig_interval="${orig_interval}"
+}
+
+if [ -f /etc/config/batman-adv ]; then
+ config_load network
+ config_foreach proto_batadv_to_batadv_hardif 'interface'
+ uci commit network
+
+ config_load batman-adv
+ config_foreach mv_batadv_config_section 'mesh'
+ uci commit network
+
+ rm -f /etc/config/batman-adv
+fi
+
+exit 0
+++ /dev/null
-#!/bin/sh
-
-bat_load_module()
-{
- [ -d "/sys/module/batman_adv/" ] && return
-
- . /lib/functions.sh
- load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv*
-}
-
-bat_config()
-{
- local mesh="$1"
- local aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation
- local gw_bandwidth gw_mode gw_sel_class isolation_mark hop_penalty multicast_mode network_coding log_level
- local orig_interval
-
- config_get aggregated_ogms "$mesh" aggregated_ogms
- config_get ap_isolation "$mesh" ap_isolation
- config_get bonding "$mesh" bonding
- config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance
- config_get distributed_arp_table "$mesh" distributed_arp_table
- config_get fragmentation "$mesh" fragmentation
- config_get gw_bandwidth "$mesh" gw_bandwidth
- config_get gw_mode "$mesh" gw_mode
- config_get gw_sel_class "$mesh" gw_sel_class
- config_get hop_penalty "$mesh" hop_penalty
- config_get isolation_mark "$mesh" isolation_mark
- config_get multicast_mode "$mesh" multicast_mode
- config_get network_coding "$mesh" network_coding
- config_get log_level "$mesh" log_level
- config_get orig_interval "$mesh" orig_interval
-
- [ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
-
- [ -n "$aggregated_ogms" ] && echo $aggregated_ogms > /sys/class/net/$mesh/mesh/aggregated_ogms
- [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
- [ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding
- [ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance 2>&-
- [ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$mesh/mesh/distributed_arp_table 2>&-
- [ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation
- [ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
- [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
- [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
- [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
- [ -n "$isolation_mark" ] && echo $isolation_mark > /sys/class/net/$mesh/mesh/isolation_mark
- [ -n "$multicast_mode" ] && echo $multicast_mode > /sys/class/net/$mesh/mesh/multicast_mode 2>&-
- [ -n "$network_coding" ] && echo $network_coding > /sys/class/net/$mesh/mesh/network_coding 2>&-
- [ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&-
- [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval
-}
#!/bin/sh
-. /lib/functions.sh
-. ../netifd-proto.sh
-init_proto "$@"
+[ -n "$INCLUDE_ONLY" ] || {
+ . /lib/functions.sh
+ . ../netifd-proto.sh
+ init_proto "$@"
+}
proto_batadv_init_config() {
- proto_config_add_string "mesh"
- proto_config_add_string "routing_algo"
+ no_device=1
+ available=1
+
+ proto_config_add_boolean 'aggregated_ogms:bool'
+ proto_config_add_boolean 'ap_isolation:bool'
+ proto_config_add_boolean 'bonding:bool'
+ proto_config_add_boolean 'bridge_loop_avoidance:bool'
+ proto_config_add_boolean 'distributed_arp_table:bool'
+ proto_config_add_boolean 'fragmentation:bool'
+ proto_config_add_string 'gw_bandwidth'
+ proto_config_add_string 'gw_mode'
+ proto_config_add_int 'gw_sel_class'
+ proto_config_add_int 'hop_penalty'
+ proto_config_add_string 'isolation_mark'
+ proto_config_add_string 'log_level'
+ proto_config_add_int 'multicast_fanout'
+ proto_config_add_boolean 'multicast_mode:bool'
+ proto_config_add_boolean 'network_coding:bool'
+ proto_config_add_int 'orig_interval'
+ proto_config_add_string 'routing_algo'
}
proto_batadv_setup() {
local config="$1"
- local iface="$2"
+ local iface="$config"
+
+ local aggregated_ogms
+ local ap_isolation
+ local bonding
+ local bridge_loop_avoidance
+ local distributed_arp_table
+ local fragmentation
+ local gw_bandwidth
+ local gw_mode
+ local gw_sel_class
+ local hop_penalty
+ local isolation_mark
+ local log_level
+ local multicast_fanout
+ local multicast_mode
+ local network_coding
+ local orig_interval
+ local routing_algo
+
+ json_get_vars aggregated_ogms
+ json_get_vars ap_isolation
+ json_get_vars bonding
+ json_get_vars bridge_loop_avoidance
+ json_get_vars distributed_arp_table
+ json_get_vars fragmentation
+ json_get_vars gw_bandwidth
+ json_get_vars gw_mode
+ json_get_vars gw_sel_class
+ json_get_vars hop_penalty
+ json_get_vars isolation_mark
+ json_get_vars log_level
+ json_get_vars multicast_fanout
+ json_get_vars multicast_mode
+ json_get_vars network_coding
+ json_get_vars orig_interval
+ json_get_vars routing_algo
+
+ set_default routing_algo 'BATMAN_IV'
+
+ batctl routing_algo "$routing_algo"
+ batctl -m "$iface" interface create
+
+ [ -n "$aggregated_ogms" ] && batctl -m "$iface" aggregation "$aggregated_ogms"
+ [ -n "$ap_isolation" ] && batctl -m "$iface" ap_isolation "$ap_isolation"
+ [ -n "$bonding" ] && batctl -m "$iface" bonding "$bonding"
+ [ -n "$bridge_loop_avoidance" ] && batctl -m "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
+ [ -n "$distributed_arp_table" ] && batctl -m "$iface" distributed_arp_table "$distributed_arp_table" 2>&-
+ [ -n "$fragmentation" ] && batctl -m "$iface" fragmentation "$fragmentation"
- local mesh routing_algo
- json_get_vars mesh routing_algo
+ case "$gw_mode" in
+ server)
+ if [ -n "$gw_bandwidth" ]; then
+ batctl -m "$iface" gw_mode "server" "$gw_bandwidth"
+ else
+ batctl -m "$iface" gw_mode "server"
+ fi
+ ;;
+ client)
+ if [ -n "$gw_sel_class" ]; then
+ batctl -m "$iface" gw_mode "client" "$gw_sel_class"
+ else
+ batctl -m "$iface" gw_mode "client"
+ fi
+ ;;
+ *)
+ batctl -m "$iface" gw_mode "off"
+ ;;
+ esac
- [ -n "$routing_algo" ] || routing_algo="BATMAN_IV"
- echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo"
+ [ -n "$hop_penalty" ] && batctl -m "$iface" hop_penalty "$hop_penalty"
+ [ -n "$isolation_mark" ] && batctl -m "$iface" isolation_mark "$isolation_mark"
+ [ -n "$multicast_fanout" ] && batctl -m "$iface" multicast_fanout "$multicast_fanout"
+ [ -n "$multicast_mode" ] && batctl -m "$iface" multicast_mode "$multicast_mode" 2>&-
+ [ -n "$network_coding" ] && batctl -m "$iface" network_coding "$network_coding" 2>&-
+ [ -n "$log_level" ] && batctl -m "$iface" loglevel "$log_level" 2>&-
+ [ -n "$orig_interval" ] && batctl -m "$iface" orig_interval "$orig_interval"
- echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
proto_init_update "$iface" 1
proto_send_update "$config"
}
proto_batadv_teardown() {
local config="$1"
- local iface="$2"
+ local iface="$config"
- echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true
+ batctl -m "$iface" interface destroy
}
add_protocol batadv
--- /dev/null
+#!/bin/sh
+
+[ -n "$INCLUDE_ONLY" ] || {
+ . /lib/functions.sh
+ . ../netifd-proto.sh
+ init_proto "$@"
+}
+
+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"
+}
+
+proto_batadv_hardif_teardown() {
+ local config="$1"
+ local iface="$2"
+
+ local master
+
+ json_get_vars master
+
+ batctl -m "$master" interface -M del "$iface" || true
+}
+
+add_protocol batadv_hardif
init_proto "$@"
proto_batadv_vlan_init_config() {
- proto_config_add_string "ap_isolation"
+ proto_config_add_boolean 'ap_isolation:bool'
}
proto_batadv_vlan_setup() {
local config="$1"
local iface="$2"
- # VLAN specific variables
- local device="${iface%.*}"
- local vid="${iface#*.}"
-
# batadv_vlan options
local ap_isolation
json_get_vars ap_isolation
- echo "$ap_isolation" > "/sys/class/net/${device}/mesh/vlan${vid}/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
---- a/net/batman-adv/main.c
-+++ b/net/batman-adv/main.c
-@@ -19,7 +19,7 @@
- #include "main.h"
-
- #include <linux/atomic.h>
--#include <linux/build_bug.h>
-+#include <linux/bug.h>
- #include <linux/byteorder/generic.h>
- #include <linux/crc32c.h>
- #include <linux/errno.h>
---- a/net/batman-adv/tp_meter.c
-+++ b/net/batman-adv/tp_meter.c
-@@ -20,7 +20,7 @@
- #include "main.h"
-
- #include <linux/atomic.h>
--#include <linux/build_bug.h>
-+#include <linux/bug.h>
- #include <linux/byteorder/generic.h>
- #include <linux/cache.h>
- #include <linux/compiler.h>
---- a/net/batman-adv/translation-table.c
-+++ b/net/batman-adv/translation-table.c
-@@ -21,7 +21,7 @@
-
- #include <linux/atomic.h>
- #include <linux/bitops.h>
--#include <linux/build_bug.h>
-+#include <linux/bug.h>
- #include <linux/byteorder/generic.h>
- #include <linux/cache.h>
- #include <linux/compiler.h>
--- /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);
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
-/* for batadv_v_elp_get_throughput which would have used
- * STATION_INFO_EXPECTED_THROUGHPUT in Linux 4.0.0
- */
-#define NL80211_STA_INFO_EXPECTED_THROUGHPUT 28
-
/* wild hack for batadv_getlink_net only */
#define get_link_net get_xstats_size || 1 ? fallback_net : (struct net*)netdev->rtnl_link_ops->get_xstats_size
unsigned int transport_len,
__sum16(*skb_chkf)(struct sk_buff *skb));
-int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed);
+int ip_mc_check_igmp(struct sk_buff *skb);
+int ipv6_mc_check_mld(struct sk_buff *skb);
+
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
+
+#include_next <linux/igmp.h>
+#include_next <net/addrconf.h>
+
+static inline int batadv_ipv6_mc_check_mld1(struct sk_buff *skb)
+{
+ return ipv6_mc_check_mld(skb, NULL);
+}
+
+static inline int batadv_ipv6_mc_check_mld2(struct sk_buff *skb,
+ struct sk_buff **skb_trimmed)
+{
+ return ipv6_mc_check_mld(skb, skb_trimmed);
+}
+
+#define ipv6_mc_check_mld_get(_1, _2, ipv6_mc_check_mld_name, ...) ipv6_mc_check_mld_name
+#define ipv6_mc_check_mld(...) \
+ ipv6_mc_check_mld_get(__VA_ARGS__, batadv_ipv6_mc_check_mld2, batadv_ipv6_mc_check_mld1)(__VA_ARGS__)
+
+static inline int batadv_ip_mc_check_igmp1(struct sk_buff *skb)
+{
+ return ip_mc_check_igmp(skb, NULL);
+}
+
+static inline int batadv_ip_mc_check_igmp2(struct sk_buff *skb,
+ struct sk_buff **skb_trimmed)
+{
+ return ip_mc_check_igmp(skb, skb_trimmed);
+}
-int ipv6_mc_check_mld(struct sk_buff *skb, struct sk_buff **skb_trimmed);
+#define ip_mc_check_igmp_get(_1, _2, ip_mc_check_igmp_name, ...) ip_mc_check_igmp_name
+#define ip_mc_check_igmp(...) \
+ ip_mc_check_igmp_get(__VA_ARGS__, batadv_ip_mc_check_igmp2, batadv_ip_mc_check_igmp1)(__VA_ARGS__)
#endif /* < KERNEL_VERSION(4, 2, 0) */
#endif /* < KERNEL_VERSION(4, 6, 0) */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
-
-#ifdef netif_trans_update
-#undef netif_trans_update
-#endif
-
-#define netif_trans_update batadv_netif_trans_update
-static inline void batadv_netif_trans_update(struct net_device *dev)
-{
- dev->trans_start = jiffies;
-}
-
-#endif /* < KERNEL_VERSION(4, 7, 0) */
-
-
-#include_next <linux/netlink.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
-
-#include_next <net/netlink.h>
-
-static inline bool batadv_nla_need_padding_for_64bit(struct sk_buff *skb);
-
-static inline int batadv_nla_align_64bit(struct sk_buff *skb, int padattr)
-{
- if (batadv_nla_need_padding_for_64bit(skb) &&
- !nla_reserve(skb, padattr, 0))
- return -EMSGSIZE;
-
- return 0;
-}
-
-static inline struct nlattr *batadv__nla_reserve_64bit(struct sk_buff *skb,
- int attrtype,
- int attrlen, int padattr)
-{
- if (batadv_nla_need_padding_for_64bit(skb))
- batadv_nla_align_64bit(skb, padattr);
-
- return __nla_reserve(skb, attrtype, attrlen);
-}
-
-static inline void batadv__nla_put_64bit(struct sk_buff *skb, int attrtype,
- int attrlen, const void *data,
- int padattr)
-{
- struct nlattr *nla;
-
- nla = batadv__nla_reserve_64bit(skb, attrtype, attrlen, padattr);
- memcpy(nla_data(nla), data, attrlen);
-}
-
-static inline bool batadv_nla_need_padding_for_64bit(struct sk_buff *skb)
-{
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
- /* The nlattr header is 4 bytes in size, that's why we test
- * if the skb->data _is_ aligned. A NOP attribute, plus
- * nlattr header for next attribute, will make nla_data()
- * 8-byte aligned.
- */
- if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8))
- return true;
-#endif
- return false;
-}
-
-static inline int batadv_nla_total_size_64bit(int payload)
-{
- return NLA_ALIGN(nla_attr_size(payload))
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
- + NLA_ALIGN(nla_attr_size(0))
-#endif
- ;
-}
-
-static inline int batadv_nla_put_64bit(struct sk_buff *skb, int attrtype,
- int attrlen, const void *data,
- int padattr)
-{
- size_t len;
-
- if (batadv_nla_need_padding_for_64bit(skb))
- len = batadv_nla_total_size_64bit(attrlen);
- else
- len = nla_total_size(attrlen);
- if (unlikely(skb_tailroom(skb) < len))
- return -EMSGSIZE;
-
- batadv__nla_put_64bit(skb, attrtype, attrlen, data, padattr);
- return 0;
-}
-
-#ifdef nla_put_u64_64bit
-#undef nla_put_u64_64bit
-#endif
-
-#define nla_put_u64_64bit(_skb, _attrtype, _value, _padattr) \
- batadv_nla_put_u64_64bit(_skb, _attrtype, _value, _padattr)
-static inline int batadv_nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
- u64 value, int padattr)
-{
- return batadv_nla_put_64bit(skb, attrtype, sizeof(u64), &value,
- padattr);
-}
-
-#endif /* < KERNEL_VERSION(4, 7, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
#endif /* < KERNEL_VERSION(4, 11, 9) */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
-
-static inline void *batadv_skb_put(struct sk_buff *skb, unsigned int len)
-{
- return (void *)skb_put(skb, len);
-}
-#ifdef skb_put
-#undef skb_put
-#endif
-
-#define skb_put batadv_skb_put
-
-static inline void *batadv_skb_put_zero(struct sk_buff *skb, unsigned int len)
-{
- void *tmp = skb_put(skb, len);
-
- memset(tmp, 0, len);
-
- return tmp;
-}
-#ifdef skb_put_zero
-#undef skb_put_zero
-#endif
-
-#define skb_put_zero batadv_skb_put_zero
-
-static inline void *batadv_skb_put_data(struct sk_buff *skb, const void *data,
- unsigned int len)
-{
- void *tmp = skb_put(skb, len);
-
- memcpy(tmp, data, len);
-
- return tmp;
-}
-#ifdef skb_put_data
-#undef skb_put_data
-#endif
-
-#define skb_put_data batadv_skb_put_data
-
-#endif /* < KERNEL_VERSION(4, 13, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#endif /* < KERNEL_VERSION(4, 15, 0) */
-#ifndef from_timer
-#define TIMER_DATA_TYPE unsigned long
-#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
-static inline void timer_setup(struct timer_list *timer,
- void (*callback)(struct timer_list *),
- unsigned int flags)
+static inline int batadv_access_ok(int type, const void __user *p,
+ unsigned long size)
{
- __setup_timer(timer, (TIMER_FUNC_TYPE)callback,
- (TIMER_DATA_TYPE)timer, flags);
+ return access_ok(type, p, size);
}
-#define from_timer(var, callback_timer, timer_fieldname) \
- container_of(callback_timer, typeof(*var), timer_fieldname)
-
-#endif /* !from_timer */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
-
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
-
-#include <net/cfg80211.h>
-
-/* cfg80211 fix: https://patchwork.kernel.org/patch/10449857/ */
-static inline int batadv_cfg80211_get_station(struct net_device *dev,
- const u8 *mac_addr,
- struct station_info *sinfo)
-{
- memset(sinfo, 0, sizeof(*sinfo));
- return cfg80211_get_station(dev, mac_addr, sinfo);
-}
-
-#define cfg80211_get_station(dev, mac_addr, sinfo) \
- batadv_cfg80211_get_station(dev, mac_addr, sinfo)
-
-#endif /* < KERNEL_VERSION(4, 18, 0) */
+#ifdef access_ok
+#undef access_ok
+#endif
+#define access_ok_get(_1, _2, _3 , access_ok_name, ...) access_ok_name
+#define access_ok(...) \
+ access_ok_get(__VA_ARGS__, access_ok3, access_ok2)(__VA_ARGS__)
-#ifdef __CHECK_POLL
-typedef unsigned __bitwise __poll_t;
-#else
-typedef unsigned __poll_t;
-#endif
+#define access_ok2(addr, size) batadv_access_ok(VERIFY_WRITE, (addr), (size))
+#define access_ok3(type, addr, size) batadv_access_ok((type), (addr), (size))
-#endif /* < KERNEL_VERSION(4, 16, 0) */
+#endif /* < KERNEL_VERSION(5, 0, 0) */
/* <DECLARE_EWMA> */
PATH="$(TARGET_PATH)" \
SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
LINUX_VERSION="$(LINUX_VERSION)" \
- REVISION="$(PKG_REV)" modules
+ REVISION="$(PKG_REV)" modules
define Build/Configure
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
config batmand general
option interface ath0
- option hna
- option gateway_class
+ option hna
+ option gateway_class
option originator_interval
- option preferred_gateway
+ option preferred_gateway
option routing_class
option visualisation_srv
option policy_routing_script
option disable_client_nat
option disable_aggregation
-
disable_aggregation=$(uci get batmand.general.disable_aggregation)
batman_args=""
- for hna in $hnas
- do
- batman_args=${batman_args}'-a '$hna' '
- done
+ for hna in $hnas; do
+ batman_args=${batman_args}'-a '$hna' '
+ done
if [ $gateway_class ]; then
batman_args=${batman_args}'-g '$gateway_class' '
if [ $routing_class ]; then
batman_args=${batman_args}'-r '$routing_class' '
fi
-
+
if [ $visualisation_srv ]; then
batman_args=${batman_args}'-s '$visualisation_srv' '
fi
-
+
if [ $policy_routing_script ]; then
batman_args=${batman_args}'--policy-routing-script '$policy_routing_script' '
fi
-
+
if [ $disable_client_nat ]; then
batman_args=${batman_args}'--disable-client-nat '
fi
-
+
if [ $disable_aggregation ]; then
batman_args=${batman_args}'--disable-aggregation '
fi
}
stop () {
- killall batmand
+ killall batmand
}
-
-
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
PKG_SOURCE_URL:=https://github.com/bmx-routing/bmx7.git
-PKG_REV:=9883383dc26df16da67b9ef7ba99efe62f79c4e7
-PKG_MIRROR_HASH:=012178aba42016d3e0961715f99bf1e322c2c6c22b1cc6635375468360cb4d68
-PKG_VERSION:=r2018042501
-PKG_RELEASE:=3
+PKG_REV:=cc245a22e54b5e110384485f18d9b805c91d8b71
+PKG_MIRROR_HASH:=378228450b7790bb07b1d478f123e9196c1040d9f55ec42e83090249574a3d6b
+PKG_VERSION:=r2019030802
+PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_SOURCE_VERSION:=$(PKG_REV)
TARGET_CFLAGS += $(FPIC)
-MAKE_ARGS += EXTRA_CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/usr/include -DCRYPTLIB=MBEDTLS_2_4_0 -DCORE_LIMIT=20000 -DTRAFFIC_DUMP -DNO_TRACE_FUNCTION_CALLS -DBMX7_LIB_IWINFO"
+MAKE_ARGS += EXTRA_CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/usr/include -DCRYPTLIB=MBEDTLS_2_8_0 -DCORE_LIMIT=20000 -DTRAFFIC_DUMP -DNO_TRACE_FUNCTION_CALLS -DBMX7_LIB_IWINFO"
MAKE_ARGS += \
EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib -liwinfo" \
+++ /dev/null
-From 53f5a6ef74acff4c7294f4346a3d88fa04ad49c9 Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel@makrotopia.org>
-Date: Tue, 14 Aug 2018 12:19:49 +0200
-Subject: [PATCH] rename list_add_tail and struct list_head
-
-Rename some list stuff to avoid namespace collision with libubox
----
- control.c | 18 +++++++++---------
- control.h | 12 ++++++------
- lib/bmx7_tun/tun.c | 2 +-
- list.c | 26 +++++++++++++-------------
- list.h | 36 ++++++++++++++++++------------------
- msg.h | 2 +-
- plugin.c | 8 ++++----
- plugin.h | 2 +-
- schedule.c | 2 +-
- tun.h | 2 +-
- 10 files changed, 55 insertions(+), 55 deletions(-)
-
-diff --git a/control.c b/control.c
-index ee9df30..9ab778d 100644
---- a/control.c
-+++ b/control.c
-@@ -73,7 +73,7 @@ uint32_t My_pid = 0;
-
- LIST_SIMPEL(ctrl_list, struct ctrl_node, list, list);
-
--struct list_head dbgl_clients[DBGL_MAX + 1];
-+struct bmx_list_head dbgl_clients[DBGL_MAX + 1];
- static struct dbg_histogram dbgl_history[2][DBG_HIST_SIZE];
-
- static uint8_t debug_system_active = NO;
-@@ -136,7 +136,7 @@ void add_dbgl_node(struct ctrl_node *cn, int dbgl)
-
- dn->cn = cn;
- cn->dbgl = dbgl;
-- list_add_tail(&dbgl_clients[dbgl], &dn->list);
-+ bmx_list_add_tail(&dbgl_clients[dbgl], &dn->list);
-
- if (dbgl == DBGL_SYS || dbgl == DBGL_CHANGES) {
- dbgf_all(DBGT_INFO, "resetting muted dbg history");
-@@ -255,7 +255,7 @@ struct ctrl_node *create_ctrl_node(int fd, void (*cn_fd_handler) (struct ctrl_no
- {
- struct ctrl_node *cn = debugMallocReset(sizeof(struct ctrl_node), -300010);
-
-- list_add_tail(&ctrl_list, &cn->list);
-+ bmx_list_add_tail(&ctrl_list, &cn->list);
-
- cn->fd = fd;
- cn->cn_fd_handler = cn_fd_handler;
-@@ -571,7 +571,7 @@ void debug_output(uint32_t check_len, struct ctrl_node *cn, int8_t dbgl, int8_t
- if (level == DBGL_SYS && mute_dbgl_sys == DBG_HIST_MUTED)
- continue;
-
-- list_for_each(list_pos, /*(struct list_head *)*/&(dbgl_clients[level]))
-+ list_for_each(list_pos, /*(struct bmx_list_head *)*/&(dbgl_clients[level]))
- {
-
- struct dbgl_node *dn = list_entry(list_pos, struct dbgl_node, list);
-@@ -990,7 +990,7 @@ void register_option(struct opt_type *opt, const char * category_name)
-
- opt->d.parent_opt = tmp_opt;
-
-- list_add_tail(&tmp_opt->d.childs_type_list, &opt->d.list);
-+ bmx_list_add_tail(&tmp_opt->d.childs_type_list, &opt->d.list);
-
- } else {
-
-@@ -1017,7 +1017,7 @@ void register_option(struct opt_type *opt, const char * category_name)
- }
-
- if (!tmp_opt)
-- list_add_tail(&opt_list, &opt->d.list);
-+ bmx_list_add_tail(&opt_list, &opt->d.list);
-
- }
-
-@@ -1094,7 +1094,7 @@ struct opt_type *get_option(struct opt_type *parent_opt, uint8_t short_opt, char
-
- struct list_node *list_pos;
- int32_t len = 0;
-- struct list_head *list;
-+ struct bmx_list_head *list;
- struct opt_type *opt = NULL;
- char *equalp = NULL;
- char s[MAX_ARG_SIZE] = "";
-@@ -1305,7 +1305,7 @@ struct opt_child *add_opt_child(struct opt_type *opt, struct opt_parent *p)
-
- c->opt = opt;
- c->parent_instance = p;
-- list_add_tail(&p->childs_instance_list, &c->list);
-+ bmx_list_add_tail(&p->childs_instance_list, &c->list);
-
- return c;
- }
-@@ -1347,7 +1347,7 @@ struct opt_parent *add_opt_parent(struct opt_type *opt)
-
- LIST_INIT_HEAD(p->childs_instance_list, struct opt_child, list, list);
-
-- list_add_tail(&opt->d.parents_instance_list, &p->list);
-+ bmx_list_add_tail(&opt->d.parents_instance_list, &p->list);
-
- return p;
- }
-diff --git a/control.h b/control.h
-index df0176f..4ef0854 100644
---- a/control.h
-+++ b/control.h
-@@ -49,7 +49,7 @@ typedef uint32_t TIME_SEC_T;
-
- extern int unix_sock;
-
--extern struct list_head ctrl_list;
-+extern struct bmx_list_head ctrl_list;
-
- extern int32_t Client_mode;
-
-@@ -115,7 +115,7 @@ struct ctrl_node {
- int8_t dbgl;
- };
-
--extern struct list_head dbgl_clients[DBGL_MAX + 1];
-+extern struct bmx_list_head dbgl_clients[DBGL_MAX + 1];
-
- struct dbgl_node {
- struct list_node list;
-@@ -227,7 +227,7 @@ struct ctrl_node *create_ctrl_node(int fd, void (*cn_fd_handler) (struct ctrl_no
-
- #define MAX_UNIX_MSG_SIZE 2000
-
--extern struct list_head opt_list;
-+extern struct bmx_list_head opt_list;
-
-
- /* opt_t types:
-@@ -292,7 +292,7 @@ struct opt_child {
- struct opt_parent {
- struct list_node list;
-
-- struct list_head childs_instance_list;
-+ struct bmx_list_head childs_instance_list;
-
- char *val; //key
-
-@@ -311,9 +311,9 @@ struct opt_data {
-
- struct opt_type *parent_opt; //REMOVE THIS and use casting instead !
-
-- struct list_head childs_type_list; //if this opt is a section type, then further sub-opts types can be listed here
-+ struct bmx_list_head childs_type_list; //if this opt is a section type, then further sub-opts types can be listed here
-
-- struct list_head parents_instance_list; //
-+ struct bmx_list_head parents_instance_list; //
- };
-
- struct opt_type {
-diff --git a/lib/bmx7_tun/tun.c b/lib/bmx7_tun/tun.c
-index 2aa740c..265c47a 100644
---- a/lib/bmx7_tun/tun.c
-+++ b/lib/bmx7_tun/tun.c
-@@ -126,7 +126,7 @@ void set_tunXin6_net_adv_list_handl(uint8_t del, void **adv_list_ptr)
- n = debugMallocReset(sizeof( struct tunXin6_net_adv_list_node), -300517);
-
- n->adv_list = adv_list;
-- list_add_tail((&tunXin6_net_adv_list_list), &n->list);
-+ bmx_list_add_tail((&tunXin6_net_adv_list_list), &n->list);
- }
-
- STATIC_FUNC
-diff --git a/list.c b/list.c
-index 5e0665d..b698874 100644
---- a/list.c
-+++ b/list.c
-@@ -39,7 +39,7 @@
- * @head: list head of maintained nodes
- * @node: a node maintained in the list or NULL
- */
--void * list_iterate(struct list_head *head, void *node)
-+void * list_iterate(struct bmx_list_head *head, void *node)
- {
- struct list_node *ln = (node ?
- ((struct list_node*) (((char*) node) + head->list_node_offset)) :
-@@ -53,7 +53,7 @@ void * list_iterate(struct list_head *head, void *node)
- return(((char*) ln->next) - head->list_node_offset);
- }
-
--void *list_find_next(struct list_head *head, void* key, void *node)
-+void *list_find_next(struct bmx_list_head *head, void* key, void *node)
- {
- while ((node = list_iterate(head, node))) {
-
-@@ -68,7 +68,7 @@ void *list_find_next(struct list_head *head, void* key, void *node)
- * @head: list head to add it after
- * @new: new entry to be added
- */
--void list_add_head(struct list_head *head, struct list_node *new)
-+void list_add_head(struct bmx_list_head *head, struct list_node *new)
- {
-
- new->next = head->next;
-@@ -82,12 +82,12 @@ void list_add_head(struct list_head *head, struct list_node *new)
- }
-
- /**
-- * list_add_tail - add a new entry
-+ * bmx_list_add_tail - add a new entry
- * @head: list head to add it before
- * @new: new entry to be added
- */
-
--void list_add_tail(struct list_head *head, struct list_node *new)
-+void bmx_list_add_tail(struct bmx_list_head *head, struct list_node *new)
- {
- new->next = (struct list_node *) head;
- head->last->next = new;
-@@ -96,7 +96,7 @@ void list_add_tail(struct list_head *head, struct list_node *new)
- head->items++;
- }
-
--void list_add_after(struct list_head *head, struct list_node *ln, struct list_node *new)
-+void list_add_after(struct bmx_list_head *head, struct list_node *ln, struct list_node *new)
- {
- new->next = ln->next;
- ln->next = new;
-@@ -112,7 +112,7 @@ void list_add_after(struct list_head *head, struct list_node *ln, struct list_no
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
- */
--void list_del_next(struct list_head *head, struct list_node *ln)
-+void list_del_next(struct bmx_list_head *head, struct list_node *ln)
- {
- assertion(-502641, (ln->next != (struct list_node*) head));
-
-@@ -126,7 +126,7 @@ void list_del_next(struct list_head *head, struct list_node *ln)
- head->items--;
- }
-
--void *list_del_head(struct list_head *head)
-+void *list_del_head(struct bmx_list_head *head)
- {
- if (LIST_EMPTY(head))
- return NULL;
-@@ -147,7 +147,7 @@ void *list_del_head(struct list_head *head)
- */
-
- /* UNTESTED
--void * plist_iterate(struct list_head *head, struct plist_node **pln)
-+void * plist_iterate(struct bmx_list_head *head, struct plist_node **pln)
- {
-
- if (head->last == (struct list_node*)
-@@ -169,17 +169,17 @@ static struct plist_node *plist_node_create(void *item)
- return plh;
- }
-
--void plist_add_head(struct list_head *head, void *item)
-+void plist_add_head(struct bmx_list_head *head, void *item)
- {
- list_add_head(head, &((plist_node_create(item))->list));
- }
-
--void plist_add_tail(struct list_head *head, void *item)
-+void plist_add_tail(struct bmx_list_head *head, void *item)
- {
-- list_add_tail(head, &((plist_node_create(item))->list));
-+ bmx_list_add_tail(head, &((plist_node_create(item))->list));
- }
-
--void * plist_del_head(struct list_head *head)
-+void * plist_del_head(struct bmx_list_head *head)
- {
- struct plist_node *pln = list_del_head(head);
-
-diff --git a/list.h b/list.h
-index d40306c..770dc9f 100644
---- a/list.h
-+++ b/list.h
-@@ -28,7 +28,7 @@
-
-
- #ifndef _LIST_H
--#define _LIST_H
-+#define _LIST_H_
-
- #include <stdint.h>
-
-@@ -36,7 +36,7 @@ struct list_node {
- struct list_node *next;
- };
-
--struct list_head {
-+struct bmx_list_head {
- struct list_node *next;
- struct list_node *last;
- uint16_t items;
-@@ -52,7 +52,7 @@ struct plist_node {
-
-
-
--#define LIST_SIMPEL(ptr, element_type, list_field, key_field ) struct list_head ptr = { \
-+#define LIST_SIMPEL(ptr, element_type, list_field, key_field ) struct bmx_list_head ptr = { \
- .next = (struct list_node *)&ptr, \
- .last = (struct list_node *)&ptr, \
- .items = 0, \
-@@ -75,14 +75,14 @@ struct plist_node {
- #define list_get_first(head) ((void*)((LIST_EMPTY(head)) ? NULL : (((char*) (head)->next) - (head)->list_node_offset) ))
- #define list_get_last(head) ((void*)((LIST_EMPTY(head)) ? NULL : (((char*) (head)->last) - (head)->list_node_offset) ))
-
--void *list_iterate(struct list_head *head, void *node);
--void *list_find_next(struct list_head *head, void* key, void *node);
-+void *list_iterate(struct bmx_list_head *head, void *node);
-+void *list_find_next(struct bmx_list_head *head, void* key, void *node);
-
--void list_add_head(struct list_head *head, struct list_node * new);
--void list_add_tail(struct list_head *head, struct list_node * new);
--void list_add_after(struct list_head *head, struct list_node *pos, struct list_node * new);
--void list_del_next(struct list_head *head, struct list_node *pos);
--void *list_del_head(struct list_head *head);
-+void list_add_head(struct bmx_list_head *head, struct list_node * new);
-+void bmx_list_add_tail(struct bmx_list_head *head, struct list_node * new);
-+void list_add_after(struct bmx_list_head *head, struct list_node *pos, struct list_node * new);
-+void list_del_next(struct bmx_list_head *head, struct list_node *pos);
-+void *list_del_head(struct bmx_list_head *head);
-
-
- #define plist_get_first(head) (LIST_EMPTY(head) ? NULL : \
-@@ -91,17 +91,17 @@ void *list_del_head(struct list_head *head);
- #define plist_get_last(head) (LIST_EMPTY(head) ? NULL : \
- ((struct plist_node*)(((char*) (head)->prev) - (head)->list_node_offset))-item )
-
--void * plist_iterate(struct list_head *head, struct plist_node **pln);
-+void * plist_iterate(struct bmx_list_head *head, struct plist_node **pln);
-
--void plist_add_head(struct list_head *head, void *item);
--void plist_add_tail(struct list_head *head, void *item);
--void *plist_del_head(struct list_head *head);
-+void plist_add_head(struct bmx_list_head *head, void *item);
-+void plist_add_tail(struct bmx_list_head *head, void *item);
-+void *plist_del_head(struct bmx_list_head *head);
-
-
-
- /**
- * list_entry - get the struct for this entry
-- * @ptr: the &struct list_head pointer.
-+ * @ptr: the &struct bmx_list_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_struct within the struct.
- */
-@@ -109,7 +109,7 @@ void *plist_del_head(struct list_head *head);
-
- /**
- * list_for_each - iterate over a list
-- * @pos: the &struct list_head to use as a loop counter.
-+ * @pos: the &struct bmx_list_head to use as a loop counter.
- * @head: the head for your list.
- */
- #define list_for_each(pos, head) \
-@@ -123,8 +123,8 @@ void *plist_del_head(struct list_head *head);
-
- /**
- * list_for_each_safe - iterate over a list safe against removal of list entry
-- * @pos: the &struct list_head to use as a loop counter.
-- * @n: another &struct list_head to use as temporary storage
-+ * @pos: the &struct bmx_list_head to use as a loop counter.
-+ * @n: another &struct bmx_list_head to use as temporary storage
- * @head: the head for your list.
- */
- #define list_for_each_safe(pos, n, head) \
-diff --git a/msg.h b/msg.h
-index d36f6e2..b881cef 100644
---- a/msg.h
-+++ b/msg.h
-@@ -357,7 +357,7 @@ struct tx_frame_iterator {
- // MUST be initialized:
- // remains unchanged:
- const char *caller;
-- struct list_head *tx_task_list;
-+ struct bmx_list_head *tx_task_list;
- struct tx_task_node *ttn;
- // struct desc_contents *descContents;
- struct frame_db *db;
-diff --git a/plugin.c b/plugin.c
-index 5016956..102cdba 100644
---- a/plugin.c
-+++ b/plugin.c
-@@ -74,7 +74,7 @@ void _set_thread_hook(int32_t cb_type, void (*cb_handler) (void), int8_t del, st
- cleanup_all(-500143);
- }
-
-- list_for_each_safe(list_pos, tmp_pos, (struct list_head*) cb_list)
-+ list_for_each_safe(list_pos, tmp_pos, (struct bmx_list_head*) cb_list)
- {
- cbn = list_entry(list_pos, struct cb_node, list);
-
-@@ -82,7 +82,7 @@ void _set_thread_hook(int32_t cb_type, void (*cb_handler) (void), int8_t del, st
-
- if (del) {
-
-- list_del_next(((struct list_head*) cb_list), prev_pos);
-+ list_del_next(((struct bmx_list_head*) cb_list), prev_pos);
- debugFree(cbn, -300069);
- return;
-
-@@ -103,7 +103,7 @@ void _set_thread_hook(int32_t cb_type, void (*cb_handler) (void), int8_t del, st
-
- cbn->cb_type = cb_type;
- cbn->cb_handler = cb_handler;
-- list_add_tail(((struct list_head*) cb_list), &cbn->list);
-+ bmx_list_add_tail(((struct bmx_list_head*) cb_list), &cbn->list);
-
- }
-
-@@ -261,7 +261,7 @@ int activate_plugin(struct plugin *p, void *dlhandle, const char *dl_name)
- pn->plugin = p;
- pn->dlhandle = dlhandle;
-
-- list_add_tail(&plugin_list, &pn->list);
-+ bmx_list_add_tail(&plugin_list, &pn->list);
-
- dbgf_all(DBGT_INFO, "%s SUCCESS", pn->plugin->plugin_name);
-
-diff --git a/plugin.h b/plugin.h
-index 5028d4e..b5c9727 100644
---- a/plugin.h
-+++ b/plugin.h
-@@ -74,7 +74,7 @@ struct cb_fd_node {
- void (*cb_fd_handler) (int32_t fd);
- };
-
--extern struct list_head cb_fd_list;
-+extern struct bmx_list_head cb_fd_list;
- // cb_fd_handler is called when fd received data
- // called function may remove itself
- void set_fd_hook(int32_t fd, void (*cb_fd_handler) (int32_t fd), int8_t del);
-diff --git a/schedule.c b/schedule.c
-index 8e3f7a6..8868b01 100644
---- a/schedule.c
-+++ b/schedule.c
-@@ -205,7 +205,7 @@ void task_register(TIME_T timeout, void (* task) (void *), void *data, int32_t t
- }
-
- if ((tmp_tn == NULL) || (U32_LE(tmp_tn->expire, tn->expire)))
-- list_add_tail(&task_list, &tn->list);
-+ bmx_list_add_tail(&task_list, &tn->list);
-
- }
-
-diff --git a/tun.h b/tun.h
-index 06b8c6f..102ee87 100644
---- a/tun.h
-+++ b/tun.h
-@@ -309,7 +309,7 @@ struct tunXin6_net_adv_list_node {
- };
-
-
--extern struct list_head tunXin6_net_adv_list_list;
-+extern struct bmx_list_head tunXin6_net_adv_list_list;
-
- struct tun_bit_key_nodes {
- struct tun_search_node *tsn;
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
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"
+++ /dev/null
-#
-# Copyright (C) 2014-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=nat46
-PKG_VERSION:=11
-PKG_RELEASE:=$(PKG_SOURCE_VERSION)
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=18b36fcb30c6c56e39c20f3363f806f909d08bb21041ac5c930c9216b6d3e2aa
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=683fbd2b765506332a1af141545652bf58f03166
-PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
-PKG_LICENSE:=GPL-2.0
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/map-t
- SECTION:=net
- CATEGORY:=Network
- DEPENDS:=+map +kmod-nat46
- TITLE:=MAP-T configuration support
-endef
-
-define Package/464xlat
- SECTION:=net
- CATEGORY:=Network
- DEPENDS:=+kmod-nat46 +ip
- TITLE:=464xlat CLAT support
-endef
-
-define KernelPackage/nat46
- DEPENDS:=@IPV6
- TITLE:=Stateless NAT46 translation kernel module
- SECTION:=kernel
- SUBMENU:=Network Support
- FILES:=$(PKG_BUILD_DIR)/nat46/modules/nat46.ko
- AUTOLOAD:=$(call AutoLoad,33,nat46)
-endef
-
-include $(INCLUDE_DIR)/kernel-defaults.mk
-
-define Build/Prepare
- $(call Build/Prepare/Default)
- $(CP) ./src/* $(PKG_BUILD_DIR)/
-endef
-
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) \
- CC="$(TARGET_CC)" \
- CFLAGS="$(TARGET_CFLAGS) -Wall" \
- LDFLAGS="$(TARGET_LDFLAGS)"
- $(MAKE) $(KERNEL_MAKEOPTS) SUBDIRS="$(PKG_BUILD_DIR)/nat46/modules" \
- MODFLAGS="-DMODULE -mlong-calls" \
- EXTRA_CFLAGS="-DNAT46_VERSION=\\\"$(PKG_SOURCE_VERSION)\\\"" \
- modules
-endef
-
-define Package/map-t/install
- true
-endef
-
-define Package/464xlat/install
- $(INSTALL_DIR) $(1)/lib/netifd/proto
- $(INSTALL_BIN) ./files/464xlat.sh $(1)/lib/netifd/proto/464xlat.sh
- $(INSTALL_DIR) $(1)/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/464xlatcfg $(1)/sbin
-endef
-
-$(eval $(call KernelPackage,nat46))
-$(eval $(call BuildPackage,map-t))
-$(eval $(call BuildPackage,464xlat))
+++ /dev/null
-#!/bin/sh
-# 464xlat.sh - 464xlat CLAT
-#
-# Copyright (c) 2015 Steven Barth <cyrus@openwrt.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2
-# as published by the Free Software Foundation
-#
-# 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.
-
-[ -n "$INCLUDE_ONLY" ] || {
- . /lib/functions.sh
- . /lib/functions/network.sh
- . ../netifd-proto.sh
- init_proto "$@"
-}
-
-proto_464xlat_setup() {
- local cfg="$1"
- local iface="$2"
- local link="464-$cfg"
-
- local ip6addr ip6prefix tunlink zone
- json_get_vars ip6addr ip6prefix tunlink zone
-
- [ -z "$zone" ] && zone="wan"
-
- ( proto_add_host_dependency "$cfg" "::" "$tunlink" )
-
- if [ -z "$tunlink" ] && ! network_find_wan6 tunlink; then
- proto_notify_error "$cfg" "NO_WAN_LINK"
- return
- fi
- network_get_device tundev "$tunlink"
-
- ip6addr=$(464xlatcfg "$link" "$tundev" "$ip6prefix" 192.0.0.1 $ip6addr)
- if [ -z "$ip6addr" ]; then
- proto_notify_error "$cfg" "CLAT_CONFIG_FAILED"
- return
- fi
-
- ip -6 rule del from all lookup local
- ip -6 rule add from all lookup local pref 1
- ip -6 rule add to $ip6addr lookup prelocal pref 0
- echo "$ip6addr" > /tmp/464-$cfg-anycast
-
- proto_init_update "$link" 1
- proto_add_ipv4_route "0.0.0.0" 0 "" "" 2048
- proto_add_ipv6_route $ip6addr 128 "" "" "" "" 128
-
- proto_add_data
- [ "$zone" != "-" ] && json_add_string zone "$zone"
-
- json_add_array firewall
- json_add_object ""
- json_add_string type nat
- json_add_string target SNAT
- json_add_string family inet
- json_add_string snat_ip 192.0.0.1
- json_close_object
- json_add_object ""
- json_add_string type rule
- json_add_string family inet6
- json_add_string proto all
- json_add_string direction in
- json_add_string dest "$zone"
- json_add_string src "$zone"
- json_add_string src_ip $ip6addr
- json_add_string target ACCEPT
- json_close_object
- json_close_array
- proto_close_data
-
- proto_send_update "$cfg"
-}
-
-proto_464xlat_teardown() {
- local cfg="$1"
- local link="464-$cfg"
-
- [ -f /tmp/464-$cfg-anycast ] || return
- local ip6addr=$(cat /tmp/464-$cfg-anycast)
-
- 464xlatcfg "$link"
-
- rm -rf /tmp/464-$cfg-anycast
- [ -n "$ip6addr" ] && ip -6 rule del to $ip6addr lookup prelocal
-
- if [ -z "$(ls /tmp/464-*-anycast 2>&-)" ]; then
- ip -6 rule del from all lookup local
- ip -6 rule add from all lookup local pref 0
- fi
-}
-
-proto_464xlat_init_config() {
- no_device=1
- available=1
-
- proto_config_add_string "ip6prefix"
- proto_config_add_string "ip6addr"
- proto_config_add_string "tunlink"
- proto_config_add_string "zone"
-}
-
-[ -n "$INCLUDE_ONLY" ] || {
- add_protocol 464xlat
-}
+++ /dev/null
-/* 464xlatcfg.c
- *
- * Copyright (c) 2015 Steven Barth <cyrus@openwrt.org>
- * Copyright (c) 2017 Hans Dedecker <dedeckeh@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation
- *
- * 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.
- */
-
-#include <netinet/icmp6.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <stdio.h>
-#include <netdb.h>
-
-static void sighandler(__attribute__((unused)) int signal)
-{
-}
-
-int main(int argc, const char *argv[])
-{
- char buf[INET6_ADDRSTRLEN], prefix[INET6_ADDRSTRLEN + 4];
- int pid;
-
- if (argc <= 1) {
- fprintf(stderr, "Usage: %s <name> [ifname] [ipv6prefix] [ipv4addr] [ipv6addr]\n", argv[0]);
- return 1;
- }
-
- snprintf(buf, sizeof(buf), "/var/run/%s.pid", argv[1]);
- FILE *fp = fopen(buf, "r");
- if (fp) {
- if (fscanf(fp, "%d", &pid) == 1)
- kill(pid, SIGTERM);
-
- unlink(buf);
- fclose(fp);
- }
-
- if (!argv[2])
- return 0;
-
- if (!argv[3] || !argv[4] || !(fp = fopen(buf, "wx")))
- return 1;
-
- signal(SIGTERM, SIG_DFL);
- setvbuf(fp, NULL, _IOLBF, 0);
- fprintf(fp, "%d\n", getpid());
-
- prefix[sizeof(prefix) - 1] = 0;
- strncpy(prefix, argv[3], sizeof(prefix) - 1);
-
- if (!prefix[0]) {
- struct addrinfo hints = { .ai_family = AF_INET6 }, *res;
- if (getaddrinfo("ipv4only.arpa", NULL, &hints, &res) || !res) {
- sleep(3);
- if (getaddrinfo("ipv4only.arpa", NULL, &hints, &res) || !res)
- return 2;
- }
-
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)res->ai_addr;
- inet_ntop(AF_INET6, &sin6->sin6_addr, prefix, sizeof(prefix) - 4);
- strcat(prefix, "/96");
- freeaddrinfo(res);
- }
-
- int i = 0;
- int sock;
- struct sockaddr_in6 saddr;
-
- do {
- socklen_t saddrlen = sizeof(saddr);
- struct icmp6_filter filt;
-
- sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
- ICMP6_FILTER_SETBLOCKALL(&filt);
- setsockopt(sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filt, sizeof(filt));
- setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, argv[2], strlen(argv[2]));
- memset(&saddr, 0, sizeof(saddr));
- saddr.sin6_family = AF_INET6;
- saddr.sin6_addr.s6_addr32[0] = htonl(0x2001);
- saddr.sin6_addr.s6_addr32[1] = htonl(0xdb8);
- if (connect(sock, (struct sockaddr*)&saddr, sizeof(saddr)) ||
- getsockname(sock, (struct sockaddr*)&saddr, &saddrlen))
- return 3;
-
- if (!IN6_IS_ADDR_LINKLOCAL(&saddr.sin6_addr) || argv[5])
- break;
-
- close(sock);
- sleep(3);
- i++;
- } while (i < 3);
-
- struct ipv6_mreq mreq = {saddr.sin6_addr, if_nametoindex(argv[2])};
- if (!argv[5]) {
- if (IN6_IS_ADDR_LINKLOCAL(&mreq.ipv6mr_multiaddr))
- return 5;
-
- srandom(mreq.ipv6mr_multiaddr.s6_addr32[0] ^ mreq.ipv6mr_multiaddr.s6_addr32[1] ^
- mreq.ipv6mr_multiaddr.s6_addr32[2] ^ mreq.ipv6mr_multiaddr.s6_addr32[3]);
- mreq.ipv6mr_multiaddr.s6_addr32[2] = random();
- mreq.ipv6mr_multiaddr.s6_addr32[3] = random();
- } else if (inet_pton(AF_INET6, argv[5], &mreq.ipv6mr_multiaddr) != 1) {
- return 1;
- }
-
- if (setsockopt(sock, SOL_IPV6, IPV6_JOIN_ANYCAST, &mreq, sizeof(mreq)))
- return 3;
-
- inet_ntop(AF_INET6, &mreq.ipv6mr_multiaddr, buf, sizeof(buf));
- fputs(buf, stdout);
- fputc('\n', stdout);
- fflush(stdout);
-
- FILE *nat46 = fopen("/proc/net/nat46/control", "w");
- if (!nat46 || fprintf(nat46, "add %s\nconfig %s local.style NONE local.v4 %s/32 local.v6 %s/128 "
- "remote.style RFC6052 remote.v6 %s\n", argv[1], argv[1], argv[4], buf, prefix) < 0 ||
- fclose(nat46))
- return 4;
-
- if (!(pid = fork())) {
- fclose(fp);
- fclose(stdin);
- fclose(stdout);
- fclose(stderr);
- chdir("/");
- setsid();
- signal(SIGTERM, sighandler);
- pause();
-
- nat46 = fopen("/proc/net/nat46/control", "w");
- if (nat46) {
- fprintf(nat46, "del %s\n", argv[1]);
- fclose(nat46);
- }
- } else {
- rewind(fp);
- fprintf(fp, "%d\n", pid);
- }
-
- return 0;
-}
+++ /dev/null
-all: 464xlatcfg
-
-464xlatcfg: 464xlatcfg.c
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
-
-clean:
- rm -f 464xlatcfg
-
PKG_NAME:=nodogsplash
PKG_FIXUP:=autoreconf
-PKG_VERSION:=3.2.1
+PKG_VERSION:=3.3.2
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:=16da76ecf7820cd8b32081237e05b24a7d2d8a9db8a47242badc7937d6cf1ae8
+PKG_HASH:=5a7b14dd2cce6a8ca261a720d87948565fc2f05d4926bf155b9e0db483ff6bcb
PKG_BUILD_DIR:=$(BUILD_DIR)/nodogsplash-$(PKG_VERSION)
PKG_MAINTAINER:=Moritz Warning <moritzwarning@web.de>
endef
define Package/nodogsplash/install
- $(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nodogsplash $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ndsctl $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/nodogsplash/htdocs/images
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_DIR) $(1)/usr/lib/nodogsplash
$(CP) $(PKG_BUILD_DIR)/resources/splash.html $(1)/etc/nodogsplash/htdocs/
$(CP) $(PKG_BUILD_DIR)/resources/splash.css $(1)/etc/nodogsplash/htdocs/
$(CP) $(PKG_BUILD_DIR)/resources/status.html $(1)/etc/nodogsplash/htdocs/
$(CP) $(PKG_BUILD_DIR)/resources/splash.jpg $(1)/etc/nodogsplash/htdocs/images/
+ $(CP) $(PKG_BUILD_DIR)/openwrt/nodogsplash/files/etc/config/nodogsplash $(1)/etc/config/
+ $(CP) $(PKG_BUILD_DIR)/openwrt/nodogsplash/files/etc/init.d/nodogsplash $(1)/etc/init.d/
+ $(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
endef
define Package/nodogsplash/postrm
+++ /dev/null
-
-# The options available here are an adaptation of the settings used in nodogsplash.conf.
-# See https://github.com/nodogsplash/nodogsplash/blob/master/resources/nodogsplash.conf
-
-config nodogsplash
- # Set to 0 to disable nodogsplash
- option enabled 1
-
- # Set to 0 to disable hook that makes nodogsplash restart when the firewall restarts.
- # This hook is needed as a restart of Firewall overwrites nodogsplash iptables entries.
- option fwhook_enabled '1'
-
- # Serve the file splash.html from this directory
- option webroot '/etc/nodogsplash/htdocs'
-
- # Use plain configuration file
- #option config '/etc/nodogsplash/nodogsplash.conf'
-
- # Use this option to set the device nogogsplash will bind to.
- # The value may be an interface section in /etc/config/network or a device name such as br-lan.
- option gatewayinterface 'br-lan'
-
- option gatewayname 'OpenWrt Nodogsplash'
- option maxclients '250'
-
- # Enables debug output (0-7)
- #option debuglevel '7'
-
- # Client timeouts in minutes
- option preauthidletimeout '30'
- option authidletimeout '120'
- # Session Timeout is the interval after which clients are forced out (a value of 0 means never)
- option sessiontimeout '1200'
-
- # The interval in seconds at which nodogsplash checks client timeout status
- option checkinterval '600'
-
- # Enable BinAuth Support.
- # If set, a program is called with several parameters on authentication (request) and deauthentication.
- # Request for authentication:
- # $<BinAuth> auth_client <client_mac> '<username>' '<password>'
- #
- # The username and password values may be empty strings and are URL encoded.
- # The program is expected to output the number of seconds the client
- # is to be authenticated. Zero or negative seconds will cause the authentification request
- # to be rejected. The same goes for an exit code that is not 0.
- # The output may contain a user specific download and upload limit in KBit/s:
- # <seconds> <upload> <download>
- #
- # Called on authentication or deauthentication:
- # $<BinAuth> <*auth|*deauth> <incoming_bytes> <outgoing_bytes> <session_start> <session_end>
- #
- # "client_auth": Client authenticated via this script.
- # "client_deauth": Client deauthenticated by the client via splash page.
- # "idle_deauth": Client was deauthenticated because of inactivity.
- # "timeout_deauth": Client was deauthenticated because the session timed out.
- # "ndsctl_auth": Client was authenticated manually by the ndsctl tool.
- # "ndsctl_deauth": Client was deauthenticated by the ndsctl tool.
- # "shutdown_deauth": Client was deauthenticated by Nodogsplash terminating.
- #
- # Values session_start and session_start are in seconds since 1970 or 0 for unknown/unlimited.
- #
- #option binauth '/bin/myauth.sh'
-
- # Enable Forwarding Authentication Service (FAS)
- # If set redirection is changed from splash.html to a FAS (provided by the system administrator)
- # The value is the IP port number of the FAS
- #option fasport '80'
-
- # Option: fasremoteip
- # Default: GatewayAddress (the IP of NDS)
- # If set, this is the remote ip address of the FAS.
- #option fasremoteip '46.32.240.41'
-
- # Option: faspath
- # Default: /
- # This is the path from the FAS Web Root to the FAS login page
- # (not the file system root).
- #option faspath '/onboard-wifi.net/nodog/fas.php'
-
- # Option: fas_secure_enabled
- # Default: 1
- # If set to "1", authaction and the client token are not revealed and it is the responsibility
- # of the FAS to request the token from NDSCTL.
- # If set to "0", the client token is sent to the FAS in clear text in the query string of the
- # redirect along with authaction and redir.
- #option fas_secure_enabled '0'
-
- # Your router may have several interfaces, and you
- # probably want to keep them private from the network/gatewayinterface.
- # If so, you should block the entire subnets on those interfaces, e.g.:
- #list authenticated_users 'block to 192.168.0.0/16'
- #list authenticated_users 'block to 10.0.0.0/8'
-
- # Typical ports you will probably want to open up.
- #list authenticated_users 'allow tcp port 22'
- #list authenticated_users 'allow tcp port 53'
- #list authenticated_users 'allow udp port 53'
- #list authenticated_users 'allow tcp port 80'
- #list authenticated_users 'allow tcp port 443'
- # Or for happy customers allow all
- list authenticated_users 'allow all'
-
- # For preauthenticated users to resolve IP addresses in their
- # initial request not using the router itself as a DNS server,
- # Leave commented to help prevent DNS tunnelling
- #list preauthenticated_users 'allow tcp port 53'
- #list preauthenticated_users 'allow udp port 53'
-
- # Allow ports for SSH/Telnet/DNS/DHCP/HTTP/HTTPS
- list users_to_router 'allow tcp port 22'
- list users_to_router 'allow tcp port 23'
- list users_to_router 'allow tcp port 53'
- list users_to_router 'allow udp port 53'
- list users_to_router 'allow udp port 67'
- list users_to_router 'allow tcp port 80'
-
- # MAC addresses that are / are not allowed to access the splash page
- # Value is either 'allow' or 'block'. The allowedmac or blockedmac list is used.
- #option macmechanism 'allow'
- #list allowedmac '00:00:C0:01:D0:0D'
- #list allowedmac '00:00:C0:01:D0:1D'
- #list blockedmac '00:00:C0:01:D0:2D'
-
- # MAC addresses that do not need to authenticate
- #list trustedmac '00:00:C0:01:D0:1D'
-
- # Nodogsplash uses specific HEXADECIMAL values to mark packets used by iptables as a bitwise mask.
- # This mask can conflict with the requirements of other packages such as mwan3, sqm etc
- # Any values set here are interpreted as in hex format.
- #
- # List: fw_mark_authenticated
- # Default: 30000 (0011|0000|0000|0000|0000 binary)
- #
- # List: fw_mark_trusted
- # Default: 20000 (0010|0000|0000|0000|0000 binary)
- #
- # List: fw_mark_blocked
- # Default: 10000 (0001|0000|0000|0000|0000 binary)
- #
- #list fw_mark_authenticated '30000'
- #list fw_mark_trusted '20000'
- #list fw_mark_blocked '10000'
-
+++ /dev/null
-#!/bin/sh /etc/rc.common
-
-#
-# Startup/shutdown script for nodogsplash captive portal
-#
-
-START=95
-STOP=95
-
-USE_PROCD=1
-
-IPT=/usr/sbin/iptables
-WD_DIR=/usr/bin
-# -s -d 5 runs in background, with level 5 (not so verbose) messages to syslog
-# -f -d 7 runs in foreground, with level 7 (verbose) debug messages to terminal
-OPTIONS="-s -f -d 5"
-CONFIG=""
-
-
-addline() {
- append CONFIG "$1" "$N"
-}
-
-setup_mac_lists() {
- local cfg="$1"
- local macs=""
- local val
-
- append_mac() {
- append macs "$1" ","
- }
-
- config_get val "$cfg" macmechanism
- if [ -z "$val" ]; then
- # Check if we have AllowedMACList or BlockedMACList defined they will be ignored
- config_get val "$cfg" allowedmac
- if [ -n "$val" ]; then
- echo "Ignoring allowedmac - macmechanism not \"allow\"" >&2
- fi
-
- config_get val "$cfg" blockedmac
- if [ -n "$val" ]; then
- echo "Ignoring blockedmac - macmechanism not \"block\"" >&2
- fi
- elif [ "$val" = "allow" ]; then
- config_list_foreach "$cfg" allowedmac append_mac
- addline "AllowedMACList $macs"
- elif [ "$val" = "block" ]; then
- config_list_foreach "$cfg" blockedmac append_mac
- addline "BlockedMACList $macs"
- else
- echo "Invalid macmechanism '$val' - allow or block are valid." >&2
- exit 1
- fi
-
- macs=""
- config_list_foreach "$cfg" trustedmac append_mac
- if [ -n "$macs" ]; then
- addline "TrustedMACList $macs"
- fi
-}
-
-setup_firewall() {
- local cfg="$1"
- local uci_name
- local val
-
- append_firewall() {
- addline " FirewallRule $1"
- }
-
- for rule in authenticated-users preauthenticated-users users-to-router trusted-users trusted-users-to-router; do
- # uci does not allow dashes
- uci_name=${rule//-/_}
- addline "FirewallRuleSet $rule {"
- config_list_foreach "$cfg" "$uci_name" append_firewall
- addline "}"
- config_get val "$cfg" "policy_${uci_name}"
- if [ -n "$val" ]; then
- addline "EmptyRuleSetPolicy $rule $val"
- fi
- done
-}
-
-wait_for_interface() {
- local ifname="$1"
- local timeout=10
-
- for i in $(seq $timeout); do
- if [ $(ip -4 addr show dev $ifname 2> /dev/null | grep -c inet) -ne 0 ]; then
- break
- fi
- sleep 1
- if [ $i = $timeout ]; then
- echo "Interface $ifname not detected." >&2
- exit 1
- fi
- done
-}
-
-generate_uci_config() {
- local cfg="$1"
- local val
- local ifname
- local download
- local upload
-
- # Init config file content
- CONFIG="# auto-generated config file from /etc/config/nodogsplash"
-
- config_get val "$cfg" config
- if [ -n "$val" ]; then
- if [ ! -f "$val" ]; then
- echo "Configuration file '$file' doesn't exist." >&2
- exit 1
- fi
- addline "$(cat $val)"
- fi
-
- config_get ifname "$cfg" gatewayinterface
- if [ -z "$ifname" ]; then
- config_get ifname "$cfg" network
- fi
-
- # Get device name if interface name is a section name in /etc/config/network
- if network_get_device tmp "$ifname"; then
- ifname="$tmp"
- fi
-
- if [ -z "$ifname" ]; then
- echo "Option network or gatewayinterface missing." >&2
- exit 1
- fi
-
- wait_for_interface "$ifname"
-
- addline "GatewayInterface $ifname"
-
- for option in binauth fasport fasremoteip faspath fas_secure_enabled \
- daemon debuglevel maxclients gatewayname gatewayinterface gatewayiprange \
- gatewayaddress gatewayport webroot splashpage statuspage imagesdir pagesdir \
- redirecturl sessiontimeout preauthidletimeout authidletimeout checkinterval \
- setmss mssvalue trafficcontrol downloadlimit uploadlimit \
- syslogfacility ndsctlsocket fw_mark_authenticated \
- fw_mark_blocked fw_mark_trusted
- do
- config_get val "$cfg" "$option"
-
- if [ -n "$val" ]; then
- addline "$option $val"
- fi
- done
-
- config_get download "$cfg" downloadlimit
- config_get upload "$cfg" uploadlimit
-
- if [ -n "$upload" -o -n "$download" ]; then
- addline "TrafficControl yes"
- fi
-
- setup_mac_lists "$cfg"
- setup_firewall "$cfg"
-
- echo "$CONFIG" > "/tmp/etc/nodogsplash_$cfg.conf"
-}
-
-# setup configuration and start instance
-create_instance() {
- local cfg="$1"
- local val
-
- config_get_bool val "$cfg" enabled 0
- [ $val -gt 0 ] || return 0
-
- generate_uci_config "$cfg"
-
- procd_open_instance $cfg
- procd_set_param command /usr/bin/nodogsplash -c "/tmp/etc/nodogsplash_$cfg.conf" $OPTIONS
- procd_set_param respawn
- procd_set_param file "/tmp/etc/nodogsplash_$cfg.conf"
- procd_close_instance
-}
-
-start_service() {
- # For network_get_device()
- include /lib/functions
-
- # For nodogsplash.conf file
- mkdir -p /tmp/etc/
-
- config_load nodogsplash
- config_foreach create_instance nodogsplash
-}
-
-stop_service() {
- # When procd terminates nodogsplash, it does not exit fast enough.
- # Otherwise procd will restart nodogsplash twice. First time starting
- # nodogsplash fails, second time it succeeds.
- sleep 1
-}
+++ /dev/null
-#!/bin/sh
-
-uci -q batch <<-EOF
- delete firewall.nodogsplash
- set firewall.nodogsplash=include
- set firewall.nodogsplash.type=script
- set firewall.nodogsplash.path=/usr/lib/nodogsplash/restart.sh
- commit firewall
-EOF
+++ /dev/null
-#!/bin/sh
-
-# Check if nodogsplash is running
-if ndsctl status &> /dev/null; then
- if [ "$(uci -q get nodogsplash.@nodogsplash[0].fwhook_enabled)" = "1" ]; then
- /etc/init.d/nodogsplash restart
- fi
-fi
include $(TOPDIR)/rules.mk
PKG_NAME:=olsrd
-PKG_VERSION:=0.9.6.2
+PKG_VERSION:=0.9.7
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/OLSR/olsrd.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=v0.9.6.2
+PKG_SOURCE_VERSION:=v0.9.7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_PARALLEL:=0
+++ /dev/null
-#
-# Copyright (C) 2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=smcroute
-PKG_VERSION:=2.0.0
-PKG_RELEASE:=2
-PKG_LICENSE:=GPL-2.0+
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=https://github.com/troglobit/smcroute/releases/download/$(PKG_VERSION)
-PKG_MD5SUM:=cbf478e52ab9ae411adca41b9d22f68a
-
-PKG_FIXUP:=autoreconf
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/smcroute
- SECTION:=net
- CATEGORY:=Network
- SUBMENU:=Routing and Redirection
- TITLE:=Static Multicast Routing Daemon
- URL:=http://troglobit.com/smcroute.html
- MAINTAINER:=Leonardo Brondani Schenkel <leonardo@schenkel.net>
-endef
-
-define Package/smcroute/description
- SMCRoute is a command line tool to manipulate the multicast routes of the Linux kernel.
-endef
-
-ifeq ($(HOST_OS),FreeBSD)
- TARGET_CFLAGS += -fno-builtin-log
- TARGET_LDFLAGS += -fno-builtin-log
-endif
-
-define Build/Compile
- $(MAKE) CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)" -C $(PKG_BUILD_DIR) all
-endef
-
-define Package/smcroute/conffiles
- /etc/smcroute.conf
-endef
-
-define Package/smcroute/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_DIR) $(1)/etc/init.d/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/smcroute $(1)/usr/sbin/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/mcsender $(1)/usr/bin/
- $(INSTALL_CONF) $(PKG_BUILD_DIR)/smcroute.conf $(1)/etc
- $(INSTALL_BIN) ./files/smcroute.init $(1)/etc/init.d/smcroute
-endef
-
-$(eval $(call BuildPackage,smcroute))
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2006-2010 OpenWrt.org
-START=50
-
-start() {
- smcroute -d
-}
-
-stop() {
- smcroute -k
-}
+++ /dev/null
-Author: Micha Lenk <micha@lenk.info>
-Date: Thu, 7 May 2015 21:54:31 +0200
-Description: Make output of build id optional
- With free software, anyone can inspect the source code for malicious flaws.
- But the software is often provided as binary packages to its users. The idea
- of “deterministic” or “reproducible” builds is to empower anyone to verify
- that no flaws have been introduced during the build process by reproducing
- byte-for-byte identical binary packages from a given source. See also:
- https://wiki.debian.org/ReproducibleBuilds
- .
- Prior to this change a timestamp generated at build time is included in the
- output of 'smcroute -v'. As a result the binary is unreproducible.
- .
- With this change, users that still want 'smcroute -v' to include a build id
- can run './configure --enable-build-id' to get the build id back (or even
- specify a custom build id).
-Origin: upstream, https://github.com/troglobit/smcroute/commit/73f6f14907f709e40689216291621ad26cd22ecd
-Bug-Debian: https://bugs.debian.org/784694
-Last-Update: 2017-08-08
-
----
- configure.ac | 9 ++++++++-
- smcroute.c | 6 +++++-
- 2 files changed, 13 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 556d958..eb4a291 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -181,7 +181,14 @@ AC_COMPILE_IFELSE(
- [AC_MSG_RESULT(no)])
-
- # Add build number to config.h.in
--AC_DEFINE_UNQUOTED([BUILD], "`date +%y%m%d`", [Build number, abbreviated date.])
-+AC_ARG_ENABLE([build-id],
-+ [AS_HELP_STRING([--enable-build-id@<:@=ID@:>@],
-+ [show build id in output of 'smcroute -v'])],
-+ [AS_IF([test "x$enableval" = "xyes" ],
-+ [build_id=`date +%y%m%d`],
-+ [build_id=$enableval])
-+ AC_DEFINE_UNQUOTED([BUILD], "$build_id", [Build number, abbreviated date.])])
-+
-
- # Checks for library functions.
- AC_FUNC_FORK
-diff --git a/smcroute.c b/smcroute.c
-index 7bd3c72..0287458 100644
---- a/smcroute.c
-+++ b/smcroute.c
-@@ -46,7 +46,11 @@ static const char *conf_file = SMCROUTE_SYSTEM_CONF;
-
- extern char *__progname;
- static const char version_info[] =
-- "SMCRoute version " PACKAGE_VERSION " build " BUILD "\n";
-+ "SMCRoute version " PACKAGE_VERSION
-+#ifdef BUILD
-+ " build " BUILD
-+#endif
-+ "\n";
-
- static const char usage_info[] =
- "Usage: smcroute [OPTIONS]... [ARGS]...\n"
---
-2.11.0
-