Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batman-adv-legacy: Use _legacy namespace #206

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions net/batman-adv-legacy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BATCTL_MD5SUM:=42e269cc710bbc9a8fd17628201d4258
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://github.com/freifunk-gluon/batman-adv-legacy.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=7b775e93b7d2d3f10b137e76090c82a06af65272
PKG_SOURCE_VERSION:=f18bcec07bc22382968d148afcdaa48b2aa0eb73
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz

BATCTL_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(BATCTL_VERSION)
Expand All @@ -34,9 +34,9 @@ define KernelPackage/batman-adv-legacy
MAINTAINER:=Marek Lindner <[email protected]>
SUBMENU:=Network Support
DEPENDS:=+kmod-lib-crc16 +kmod-crypto-crc32c +kmod-lib-crc32c +libc
TITLE:=B.A.T.M.A.N. Adv
FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,50,batman-adv)
TITLE:=B.A.T.M.A.N. Adv Legacy
FILES:=$(PKG_BUILD_DIR)/batman-adv-legacy.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,50,batman-adv-legacy)
endef

define KernelPackage/batman-adv-legacy/description
Expand All @@ -56,6 +56,8 @@ MAKE_BATMAN_ADV_ARGS += \
SUBDIRS="$(PKG_BUILD_DIR)" \
PWD="$(PKG_BUILD_DIR)" \
LINUX_VERSION="$(LINUX_VERSION)" \
OBJDUMP="$(TARGET_CROSS)objdump" \
OBJCOPY="$(TARGET_CROSS)objcopy" \
CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_LEGACY_DEBUG_LOG),y,n) \
CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_LEGACY_BLA),y,n) \
CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_LEGACY_DAT),y,n) \
Expand Down Expand Up @@ -85,7 +87,7 @@ MAKE_BATCTL_ARGS += \
REVISION="" \
CC="$(TARGET_CC)" \
DESTDIR="$(PKG_INSTALL_DIR)" \
batctl install
batctl-legacy install

ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_LEGACY_BATCTL),)
define Download/batctl-legacy
Expand All @@ -98,7 +100,7 @@ $(eval $(call Download,batctl-legacy))
BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(PKG_BUILD_DIR)"
BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)",batctl)
BATCTL_BUILD = $(MAKE_BATCTL_ENV) $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl-legacy $(1)/usr/sbin/
endif

KPATCH ?= $(PATCH)
Expand Down Expand Up @@ -129,11 +131,11 @@ define Build/Compile
endef

define KernelPackage/batman-adv-legacy/install
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
$(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
$(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
$(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv-legacy $(1)/usr/sbin $(1)/lib/netifd/proto
$(INSTALL_DATA) ./files/etc/config/batman-adv-legacy $(1)/etc/config
$(INSTALL_DATA) ./files/lib/batman-adv-legacy/config.sh $(1)/lib/batman-adv-legacy
$(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv-legacy $(1)/etc/hotplug.d/net
$(INSTALL_BIN) ./files/lib/netifd/proto/batadv-legacy.sh $(1)/lib/netifd/proto
$(BATCTL_INSTALL)
endef

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

. /lib/batman-adv/config.sh
. /lib/batman-adv-legacy/config.sh

bat_load_module
config_load batman-adv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

bat_load_module()
{
[ -d "/sys/module/batman_adv/" ] && return
[ -d "/sys/module/batman_adv_legacy/" ] && return

. /lib/functions.sh
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv*
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv-legacy*
}

bat_config()
Expand All @@ -29,7 +29,7 @@ bat_config()
config_get orig_interval "$mesh" orig_interval
config_get vis_mode "$mesh" vis_mode

[ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
[ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv-legacy mesh $mesh does not exist - check your interface configuration" && return 1

[ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms
[ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ proto_batadv_setup() {
local mesh mesh_no_rebroadcast
json_get_vars mesh mesh_no_rebroadcast

echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
[ -n "$mesh_no_rebroadcast" ] && echo "$mesh_no_rebroadcast" > "/sys/class/net/$iface/batman_adv/no_rebroadcast"
echo "$mesh" > "/sys/class/net/$iface/batman_adv_legacy/mesh_iface"
[ -n "$mesh_no_rebroadcast" ] && echo "$mesh_no_rebroadcast" > "/sys/class/net/$iface/batman_adv_legacy/no_rebroadcast"

proto_init_update "$iface" 1
proto_send_update "$config"
Expand All @@ -27,7 +27,7 @@ proto_batadv_teardown() {
local config="$1"
local iface="$2"

(echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface") 2>/dev/null
(echo "none" > "/sys/class/net/$iface/batman_adv_legacy/mesh_iface") 2>/dev/null
}

add_protocol batadv
add_protocol batadv-legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
From 11ebbde59b22738af096d9571a8afe4b1247ff0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <[email protected]>
Date: Fri, 23 Nov 2018 01:40:09 +0100
Subject: [PATCH 6/7] batctl: Change sysfs and debugfs directories to
batman_adv_legacy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Linus Lüssing <[email protected]>
---
README | 2 +-
debug.h | 2 +-
main.c | 2 +-
main.h | 2 +-
sys.h | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README b/README
index fd421e1..cde089f 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ settings.
How does it work ?
==================

-batctl uses the debugfs/batman_adv/bat0/socket device provided by the B.A.T.M.A.N.
+batctl uses the debugfs/batman_adv_legacy/bat0/socket device provided by the B.A.T.M.A.N.
advanced kernel module to inject custom icmp packets into the data flow. That's why
ping and traceroute work almost like their IP based counterparts. Tcpdump was
designed because B.A.T.M.A.N. advanced encapsulates all traffic within batman
diff --git a/debug.h b/debug.h
index 2427ece..13757d7 100644
--- a/debug.h
+++ b/debug.h
@@ -20,7 +20,7 @@
*/


-#define DEBUG_BATIF_PATH_FMT "%s/batman_adv/%s"
+#define DEBUG_BATIF_PATH_FMT "%s/batman_adv_legacy/%s"
#define DEBUG_VIS_DATA "vis_data"
#define DEBUG_TRANSTABLE_GLOBAL "transtable_global"
#define DEBUG_LOG "log"
diff --git a/main.c b/main.c
index 7d667d3..daa96a5 100644
--- a/main.c
+++ b/main.c
@@ -42,7 +42,7 @@
#include <err.h>

char mesh_dfl_iface[] = "bat0";
-char module_ver_path[] = "/sys/module/batman_adv/version";
+char module_ver_path[] = "/sys/module/batman_adv_legacy/version";

void print_usage(void)
{
diff --git a/main.h b/main.h
index b8fd0c4..17f03c5 100644
--- a/main.h
+++ b/main.h
@@ -23,7 +23,7 @@
#define SOURCE_VERSION "2013.4.0"
#endif

-#define SOCKET_PATH_FMT "%s/batman_adv/%s/socket"
+#define SOCKET_PATH_FMT "%s/batman_adv_legacy/%s/socket"

#define EXIT_NOSUCCESS 2

diff --git a/sys.h b/sys.h
index a7187af..7aa65bf 100644
--- a/sys.h
+++ b/sys.h
@@ -28,8 +28,8 @@
#define SYS_GW_BW "gw_bandwidth"
#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_MESH_IFACE_FMT SYS_IFACE_PATH"/%s/batman_adv_legacy/mesh_iface"
+#define SYS_IFACE_STATUS_FMT SYS_IFACE_PATH"/%s/batman_adv_legacy/iface_status"

enum batctl_settings_list {
BATCTL_SETTINGS_ORIG_INTERVAL,
--
2.11.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 40442c335af9ae94adddc1c77b1500e12387289a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <[email protected]>
Date: Fri, 23 Nov 2018 01:52:39 +0100
Subject: [PATCH 7/7] batctl-legacy: Change binary name from batctl to
batctl-legacy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Linus Lüssing <[email protected]>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 9e7c5be..8c7a211 100755
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@
export CONFIG_BATCTL_BISECT=n

# batctl build
-BINARY_NAME = batctl
+BINARY_NAME = batctl-legacy
OBJ = main.o bat-hosts.o functions.o sys.o debug.o ping.o traceroute.o tcpdump.o hash.o vis.o debugfs.o ioctl.o list-batman.o translate.o
OBJ_BISECT = bisect_iv.o
MANPAGE = man/batctl.8
--
2.11.0