Backport alfred from gluon master

This commit is contained in:
Matthias Schiffer 2014-10-03 01:30:58 +02:00
parent 722055e62e
commit 2c1b0dc117
3 changed files with 81 additions and 73 deletions

View File

@ -0,0 +1,81 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 3 Oct 2014 01:29:13 +0200
Subject: Backport alfred from gluon master
diff --git a/alfred/Makefile b/alfred/Makefile
index c8e73c2..648a5ef 100644
--- a/alfred/Makefile
+++ b/alfred/Makefile
@@ -11,9 +11,9 @@ include $(TOPDIR)/rules.mk
# The latest alfred git hash in PKG_REV can be obtained from http://git.open-mesh.org/alfred.git
#
PKG_NAME:=alfred
-PKG_VERSION:=2013.4.0
-PKG_RELEASE:=3
-PKG_MD5SUM:=3891697e127b1037cfc9349fd96e9993
+PKG_VERSION:=2014.3.0
+PKG_RELEASE:=0
+PKG_MD5SUM:=b8ab5677ed73d817b02b0e4fae10357a
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
diff --git a/alfred/patches/0001-alfred-adjust-intervals.patch b/alfred/patches/0001-alfred-adjust-intervals.patch
new file mode 100644
index 0000000..e8ffd3a
--- /dev/null
+++ b/alfred/patches/0001-alfred-adjust-intervals.patch
@@ -0,0 +1,15 @@
+--- a/alfred.h
++++ b/alfred.h
+@@ -30,10 +30,10 @@
+ #include "list.h"
+ #include "packet.h"
+
+-#define ALFRED_INTERVAL 10
++#define ALFRED_INTERVAL 60
+ #define ALFRED_IF_CHECK_INTERVAL 60
+ #define ALFRED_REQUEST_TIMEOUT 10
+-#define ALFRED_SERVER_TIMEOUT 60
++#define ALFRED_SERVER_TIMEOUT 180
+ #define ALFRED_DATA_TIMEOUT 600
+ #define ALFRED_SOCK_PATH "/var/run/alfred.sock"
+ #define NO_FILTER -1
diff --git a/alfred/patches/0001-alfred-gpsd-add-lm-to-linker-flags-for-libgps.patch b/alfred/patches/0001-alfred-gpsd-add-lm-to-linker-flags-for-libgps.patch
deleted file mode 100644
index 3be7169..0000000
--- a/alfred/patches/0001-alfred-gpsd-add-lm-to-linker-flags-for-libgps.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From dbaaf2b294af120e42a0e95644640b128044a568 Mon Sep 17 00:00:00 2001
-From: Simon Wunderlich <sw@simonwunderlich.de>
-Date: Wed, 23 Oct 2013 01:17:36 +0200
-Subject: [PATCH] alfred-gpsd: add -lm to linker flags for libgps
-
-Appearently applications using libgps must link -lm themselves. A patch
-was submitted [1] to change this unusual behaviour upstream, but was
-never applied. Therefore link to -lm to alfred-gpsd too as this should
-not hurt anyway.
-
-[1] https://lists.berlios.de/pipermail/gpsd-dev/2011-August/009451.html
-
-Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
----
- gpsd/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gpsd/Makefile b/gpsd/Makefile
-index 9b21652..92e690f 100644
---- a/gpsd/Makefile
-+++ b/gpsd/Makefile
-@@ -49,7 +49,7 @@ ifeq ($(origin LIBGPS_CFLAGS) $(origin LIBGPS_LDLIBS), undefined undefined)
- $(error No $(LIBGPS_NAME) development libraries found!)
- endif
- LIBGPS_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBGPS_NAME))
-- LIBGPS_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME))
-+ LIBGPS_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME)) -lm
- endif
- CFLAGS += $(LIBGPS_CFLAGS)
- LDLIBS += $(LIBGPS_LDLIBS)
---
-1.7.10.4
-

View File

@ -1,49 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 18 Jan 2014 21:15:16 +0100
Subject: alfred: fix socket fd leak
diff --git a/alfred/patches/0002-batadv-vis-don-t-leak-socket-fd-in-get_if_mac.patch b/alfred/patches/0002-batadv-vis-don-t-leak-socket-fd-in-get_if_mac.patch
new file mode 100644
index 0000000..2374e25
--- /dev/null
+++ b/alfred/patches/0002-batadv-vis-don-t-leak-socket-fd-in-get_if_mac.patch
@@ -0,0 +1,39 @@
+From 449b94ee85a42fbabec550d920002ad07738e733 Mon Sep 17 00:00:00 2001
+Message-Id: <449b94ee85a42fbabec550d920002ad07738e733.1390075976.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Sat, 18 Jan 2014 21:04:05 +0100
+Subject: [PATCH] batadv-vis: don't leak socket fd in get_if_mac()
+
+Leaking an fd every time get_if_mac() is called causes a batadv-vis server
+process to hit the open file limit in a matter of hours when there are many
+active interfaces and the limit is as low as 1024 (which it is on OpenWRT).
+
+Reported-by: Jan-Philipp Litza <janphilipp@litza.de>
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ vis/vis.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/vis/vis.c
++++ b/vis/vis.c
+@@ -97,6 +97,7 @@ static int get_if_mac(char *ifname, uint
+ {
+ struct ifreq ifr;
+ int sock;
++ int ret;
+
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
+
+@@ -105,7 +106,11 @@ static int get_if_mac(char *ifname, uint
+ return -1;
+ }
+
+- if (ioctl(sock, SIOCGIFHWADDR, &ifr) == -1) {
++ ret = ioctl(sock, SIOCGIFHWADDR, &ifr);
++
++ close(sock);
++
++ if (ret == -1) {
+ fprintf(stderr, "can't get MAC address: %s\n", strerror(errno));
+ return -1;
+ }

View File

@ -1,24 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 18 Jan 2014 21:52:09 +0100
Subject: alfred: adjust intervals
diff --git a/alfred/patches/0003-alfred-adjust-intervals.patch b/alfred/patches/0003-alfred-adjust-intervals.patch
new file mode 100644
index 0000000..eb31f91
--- /dev/null
+++ b/alfred/patches/0003-alfred-adjust-intervals.patch
@@ -0,0 +1,14 @@
+--- a/alfred.h
++++ b/alfred.h
+@@ -30,9 +30,9 @@
+ #include "list.h"
+ #include "packet.h"
+
+-#define ALFRED_INTERVAL 10
++#define ALFRED_INTERVAL 60
+ #define ALFRED_REQUEST_TIMEOUT 10
+-#define ALFRED_SERVER_TIMEOUT 60
++#define ALFRED_SERVER_TIMEOUT 180
+ #define ALFRED_DATA_TIMEOUT 600
+ #define ALFRED_SOCK_PATH "/var/run/alfred.sock"
+ #define NO_FILTER -1