batmand: update to 2022-12-31 and simplify Makefile

Patches:
- 0001-Allow-one-to-disable-forking-to-background-in-debug_.patch
is included in the upstream [1]

- 0002-batmand-Add-missing-string.h-include.patch
is included in the upstream [2]

Makefile is simplified, reordered to be able to move this package
to packages feed.

[1] https://git.open-mesh.org/batmand.git/commit/?id=2f62b17d4132f82c4716b672101eb7faa916192a
[2] https://git.open-mesh.org/batmand.git/commit/linux?id=aca79f595d20ed8ed5efa204c87f30174d5b4228

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit is contained in:
Josef Schlehofer
2025-06-17 08:06:18 +02:00
parent 76c10668df
commit 6aed281d79
3 changed files with 10 additions and 130 deletions

View File

@@ -8,32 +8,28 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=batmand
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.open-mesh.org/batmand.git
PKG_REV:=b67a7087b51d7a5e90d27ac39116d1f57257c86e
PKG_VERSION:=1440
PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
PKG_MIRROR_HASH:=bb8b74bea9f70ae91b3ef3ef089aa3149e3f5335b6e1db31ea7870d899b0a176
PKG_SOURCE_VERSION:=2f62b17d4132f82c4716b672101eb7faa916192a
PKG_SOURCE_DATE:=2022-12-31
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
PKG_MIRROR_HASH:=ceb8e0e399f79b1b663594fcf9642e1efc40e696a7604daf709c77da9b6ec52f
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_LICENSE:=GPL-2.0-only
PKG_MAINTAINER:=Corinna "Elektra" Aichele <onelektra@gmx.net>
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/batmand
URL:=https://www.open-mesh.org/
MAINTAINER:=Corinna "Elektra" Aichele <onelektra@gmx.net>
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
DEPENDS:=+libpthread +kmod-tun
TITLE:=B.A.T.M.A.N. layer 3 routing daemon
URL:=https://www.open-mesh.org/
DEPENDS:=+libpthread +kmod-tun
endef
define Package/batmand/description
@@ -41,8 +37,8 @@ B.A.T.M.A.N. layer 3 routing daemon
endef
MAKE_FLAGS += \
EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\" -D_GNU_SOURCE' \
REVISION="$(PKG_REV)" \
EXTRA_CFLAGS='-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_SOURCE_VERSION)\" -D_GNU_SOURCE' \
REVISION="$(PKG_SOURCE_VERSION)" \
CC="$(TARGET_CC)" \
UNAME="Linux" \
batmand

View File

@@ -1,66 +0,0 @@
From: Sven Eckelmann <>
Date: Sun, 1 Dec 2013 14:39:00 +0100
Subject: Allow one to disable forking to background in debug_mode 0
---
posix/init.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
--- a/posix/init.c
+++ b/posix/init.c
@@ -44,6 +44,7 @@
#define IOCSETDEV 1
int8_t stop;
+int no_detach = 0;
@@ -159,6 +160,7 @@ void apply_init_args( int argc, char *ar
{"purge-timeout", required_argument, 0, 'q'},
{"disable-aggregation", no_argument, 0, 'x'},
{"disable-client-nat", no_argument, 0, 'z'},
+ {"no-detach", no_argument, 0, 'D'},
{0, 0, 0, 0}
};
@@ -169,7 +171,7 @@ void apply_init_args( int argc, char *ar
if ( strstr( SOURCE_VERSION, "-" ) != NULL )
printf( "WARNING: You are using the unstable batman branch. If you are interested in *using* batman get the latest stable release !\n" );
- while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vV", long_options, &option_index ) ) != -1 ) {
+ while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vVD", long_options, &option_index ) ) != -1 ) {
switch ( optchar ) {
@@ -381,6 +383,11 @@ void apply_init_args( int argc, char *ar
found_args++;
break;
+ case 'D':
+ no_detach = 1;
+ found_args++;
+ break;
+
case 'h':
default:
usage();
@@ -539,12 +546,14 @@ void apply_init_args( int argc, char *ar
/* daemonize */
if (debug_level == 0) {
- if (my_daemon() < 0) {
+ if (!no_detach) {
+ if (my_daemon() < 0) {
- printf("Error - can't fork to background: %s\n", strerror(errno));
- restore_defaults();
- exit(EXIT_FAILURE);
+ printf("Error - can't fork to background: %s\n", strerror(errno));
+ restore_defaults();
+ exit(EXIT_FAILURE);
+ }
}
openlog("batmand", LOG_PID, LOG_DAEMON);

View File

@@ -1,50 +0,0 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Fri, 23 May 2025 11:15:53 +0200
Subject: batmand: Add missing string.h include
The build failed because various string functions couldn't be found. This
happened because the indirect include of string.h is now gone in musl
1.2.5.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
--- a/hna.c
+++ b/hna.c
@@ -27,6 +27,7 @@
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <arpa/inet.h>
--- a/linux/kernel.c
+++ b/linux/kernel.c
@@ -29,6 +29,7 @@
#include <sys/socket.h>
#include <inttypes.h>
#include <net/if.h>
+#include <string.h>
#include "../os.h"
#include "../batman.h"
--- a/linux/route.c
+++ b/linux/route.c
@@ -29,6 +29,7 @@
#include <linux/if.h> /* ifr_if, ifr_tun */
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
+#include <string.h>
#include <sys/socket.h>
#include "../os.h"
--- a/linux/tun.c
+++ b/linux/tun.c
@@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h> /* system() */
+#include <string.h>
#include <sys/wait.h> /* WEXITSTATUS */
#include "../os.h"