Merge pull request #446 from ecsv/batadv-2019.0
authorSimon Wunderlich <sw@simonwunderlich.de>
Mon, 4 Feb 2019 09:12:51 +0000 (10:12 +0100)
committerGitHub <noreply@github.com>
Mon, 4 Feb 2019 09:12:51 +0000 (10:12 +0100)
batman-adv 2019.0

alfred/Makefile
batctl/Makefile
batctl/patches/0001-batctl-Fix-parsing-of-optional-debug-table-command-p.patch [deleted file]
batman-adv/Config.in
batman-adv/Makefile
batman-adv/files/lib/batman-adv/config.sh
batman-adv/files/lib/netifd/proto/batadv.sh
batman-adv/files/lib/netifd/proto/batadv_vlan.sh
batman-adv/src/compat-hacks.h

index 926f535b49909b421854f4d3b5bcdc8762bbb0c2..75edc26bc52fa135de0a1a5599161f5ae40064f8 100644 (file)
@@ -8,9 +8,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=alfred
-PKG_VERSION:=2018.4
+PKG_VERSION:=2019.0
 PKG_RELEASE:=0
-PKG_HASH:=8d6595201d5d21b4e3824d408dc9ed705789af1d8831692efa8ffe69a3e1cc58
+PKG_HASH:=c06a674763fe27e85a979d7ca65d2af39df4943ff2a4128cad90dd09d237b46a
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
index d38874ea40161fd76a8a62ee5cf22021ec051265..0284c794a15bf26a75b3522387da587456195633 100644 (file)
@@ -9,25 +9,49 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batctl
 
-PKG_VERSION:=2018.4
-PKG_RELEASE:=1
-PKG_HASH:=e43827a5e868b4e134e77ca04da989fde1981463166bf1b6f2053acc3edd6257
+PKG_VERSION:=2019.0
+PKG_RELEASE:=0
+PKG_HASH:=997721096ff396644e8d697ea7651e9d38243faf317bcea2661d4139ff58b531
 
 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
 
+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-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-full
+endef
+
+define Package/batctl-full
+$(call Package/batctl/Default)
+  TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
+  VARIANT:=full
+  ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
+endef
+
 define Package/batctl/description
 batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
 It is an easier method for configuring batman-adv and provides some
@@ -63,14 +87,138 @@ MAKE_BATCTL_ARGS += \
         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 \
+       event \
+       fragmentation \
+       gateways \
+       gw_mode \
+       interface \
+       isolation_mark \
+       log \
+       loglevel \
+       mcast_flags \
+       multicast_mode \
+       nc_nodes \
+       neighbors \
+       network_coding \
+       orig_interval \
+       originators \
+       ping \
+       routing_algo \
+       statistics \
+       tcpdump \
+       throughputmeter \
+       traceroute \
+       transglobal \
+       translate \
+       translocal \
+
+config-settings := \
+       aggregation \
+       ap_isolation \
+       bonding \
+       bridge_loop_avoidance \
+       distributed_arp_table \
+       fragmentation \
+       gw_mode \
+       interface \
+       isolation_mark \
+       loglevel \
+       multicast_mode \
+       network_coding \
+       orig_interval \
+       routing_algo \
+
+config-tables := \
+       backbonetable \
+       claimtable \
+       dat_cache \
+       gateways \
+       loglevel \
+       nc_nodes \
+       neighbors \
+       originators \
+       statistics \
+       transglobal \
+       translocal \
+
+config-tools := \
+       event \
+       log \
+       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))
diff --git a/batctl/patches/0001-batctl-Fix-parsing-of-optional-debug-table-command-p.patch b/batctl/patches/0001-batctl-Fix-parsing-of-optional-debug-table-command-p.patch
deleted file mode 100644 (file)
index 559d2ed..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-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;
index a6c8ad3b7f9ed65d073add7a4fa58506d3532437..127a020b4a34cd82045f9f71c1c9960ddc46a918 100644 (file)
@@ -90,7 +90,7 @@ config BATMAN_ADV_DEBUGFS
 
 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
index dc73feefa6a26c0ae4cf1a3dbdea0e7e59764558..9ad8210050ac92559f5b0c3edacad45a9e3d0fb6 100644 (file)
@@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
 
-PKG_VERSION:=2018.4
+PKG_VERSION:=2019.0
 PKG_RELEASE:=0
-PKG_HASH:=3500b4bc7d41ce1adef0b0684972a439d48b454ba78282e94df13ba90605484d
+PKG_HASH:=3e97d8a771cdbd7b2df42c52b88e071eaa58b5d28eb4e17a4b13b6698debbdc0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
@@ -27,7 +27,7 @@ define KernelPackage/batman-adv
   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)
index 3a746a3c0e280b9a01ae67ea27bde65619b77ebc..3d6b8849c1723bcf31d10c74ddbbda5e92288e46 100644 (file)
@@ -33,19 +33,21 @@ bat_config()
 
        [ ! -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 "$aggregated_ogms" ] && batctl -m "$mesh" aggregation "$aggregated_ogms"
+       [ -n "$ap_isolation" ] && batctl -m "$mesh" ap_isolation "$ap_isolation"
+       [ -n "$bonding" ] && batctl -m "$mesh" bonding "$bonding"
+       [ -n "$bridge_loop_avoidance" ] &&  batctl -m "$mesh" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
+       [ -n "$distributed_arp_table" ] && batctl -m "$mesh" distributed_arp_table "$distributed_arp_table" 2>&-
+       [ -n "$fragmentation" ] && batctl -m "$mesh" fragmentation "$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
+
+       [ -n "$isolation_mark" ] && batctl -m "$mesh" isolation_mark "$isolation_mark"
+       [ -n "$multicast_mode" ] && batctl -m "$mesh" multicast_mode "$multicast_mode" 2>&-
+       [ -n "$network_coding" ] && batctl -m "$mesh" network_coding "$network_coding" 2>&-
+       [ -n "$log_level" ] && batctl -m "$mesh" loglevel "$log_level" 2>&-
+       [ -n "$orig_interval" ] && batctl -m "$mesh" orig_interval "$orig_interval"
 }
index 1e0c9d0fe24d44c7f7cc9bddaf8065c60f680862..2233091452dbfad801bb1e93ae90cd03919fac87 100755 (executable)
@@ -17,9 +17,9 @@ proto_batadv_setup() {
        json_get_vars mesh routing_algo
 
        [ -n "$routing_algo" ] || routing_algo="BATMAN_IV"
-       echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo"
+       batctl routing_algo "$routing_algo"
 
-       echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
+       batctl -m "$mesh" interface add "$iface"
        proto_init_update "$iface" 1
        proto_send_update "$config"
 }
@@ -28,7 +28,10 @@ proto_batadv_teardown() {
        local config="$1"
        local iface="$2"
 
-       echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true
+       local mesh
+       json_get_vars mesh
+
+       batctl -m "$mesh" interface del "$iface" || true
 }
 
 add_protocol batadv
index 85002c35e76f9a426358832204b16ae3ca519913..d6d00ad488cb4cec47d370559b3585c5f513ff80 100755 (executable)
@@ -12,16 +12,12 @@ 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"
+       batctl -m "$iface" ap_isolation "$ap_isolation"
        proto_init_update "$iface" 1
        proto_send_update "$config"
 }
index 45111848167e703d543ad241d0947efd8fe86649..718a15c710c44078fdad5c122844d400064cedfe 100644 (file)
@@ -348,6 +348,27 @@ typedef unsigned __poll_t;
 
 #endif /* < KERNEL_VERSION(4, 16, 0) */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+
+static inline int batadv_access_ok(int type, const void __user *p,
+                                  unsigned long size)
+{
+       return access_ok(type, p, size);
+}
+
+#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__)
+
+#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(5, 0, 0) */
+
 /* <DECLARE_EWMA> */
 
 #include <linux/version.h>