Merge pull request #225 from HRogge/for-15.05
authorBastian Bittorf <bb@npl.de>
Thu, 18 Aug 2016 11:44:34 +0000 (13:44 +0200)
committerGitHub <noreply@github.com>
Thu, 18 Aug 2016 11:44:34 +0000 (13:44 +0200)
Update to OONF 0.12.3

54 files changed:
babeld/Makefile
batctl/Makefile
batman-adv/Config.in
batman-adv/Makefile
batman-adv/files/compat-hacks.h [new file with mode: 0644]
batman-adv/files/lib/netifd/proto/batadv.sh
batman-adv/patches/0001-batman-adv-make-sure-ELP-OGM-orig-MAC-is-updated-on-.patch [new file with mode: 0644]
batman-adv/patches/0002-batman-adv-Avoid-duplicate-neigh_node-additions.patch [new file with mode: 0644]
batman-adv/patches/0003-batman-adv-Avoid-nullptr-derefence-in-batadv_v_neigh.patch [new file with mode: 0644]
batman-adv/patches/0004-batman-adv-Fix-refcnt-leak-in-batadv_v_neigh_.patch [new file with mode: 0644]
batman-adv/patches/0005-batman-adv-Fix-double-neigh_node_put-in-batadv_v_ogm.patch [new file with mode: 0644]
batman-adv/patches/0006-batman-adv-initialize-ELP-orig-address-on-secondary-.patch [new file with mode: 0644]
batman-adv/patches/0007-batman-adv-Add-missing-include-for-batadv_v_neigh_is.patch [new file with mode: 0644]
batman-adv/patches/0008-batman-adv-fix-skb-deref-after-free.patch [new file with mode: 0644]
batman-adv/patches/0009-batman-adv-replace-WARN-with-rate-limited-output-on-.patch [new file with mode: 0644]
batman-adv/patches/0010-batman-adv-Fix-build-against-recent-Debian-Stretch-k.patch [new file with mode: 0644]
batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch [new file with mode: 0644]
batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch [new file with mode: 0644]
batman-adv/patches/0013-batman-adv-Fix-double-put-of-vlan-object.patch [new file with mode: 0644]
batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch [new file with mode: 0644]
batman-adv/patches/0015-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch [new file with mode: 0644]
batman-adv/patches/0016-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch [new file with mode: 0644]
batman-adv/patches/0017-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch [new file with mode: 0644]
batman-adv/patches/0018-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch [new file with mode: 0644]
batman-adv/patches/0019-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch [new file with mode: 0644]
batman-adv/patches/0020-batman-adv-Fix-reference-leak-in-batadv_find_router.patch [new file with mode: 0644]
batman-adv/patches/0021-batman-adv-Free-last_bonding_candidate-on-release-of.patch [new file with mode: 0644]
batman-adv/patches/0022-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch [new file with mode: 0644]
bmx7/Makefile [new file with mode: 0644]
bmx7/files/etc/config/bmx7 [new file with mode: 0644]
bmx7/files/etc/init.d/bmx7 [new file with mode: 0755]
bmx7/patches/001-json-c.patch [new file with mode: 0644]
cjdns/Makefile
hnetd/Makefile
hnetd/files/hnet.config
luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua
luci-app-bmx7/COPYING [new file with mode: 0644]
luci-app-bmx7/Makefile [new file with mode: 0644]
luci-app-bmx7/files/etc/config/luci-bmx7 [new file with mode: 0644]
luci-app-bmx7/files/usr/lib/lua/luci/controller/bmx7.lua [new file with mode: 0644]
luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/nodes_j.htm [new file with mode: 0644]
luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/status_j.htm [new file with mode: 0644]
luci-app-bmx7/files/www/cgi-bin/bmx7-info [new file with mode: 0755]
luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png [new file with mode: 0644]
luci-app-bmx7/files/www/luci-static/resources/bmx7/js/polling.js [new file with mode: 0644]
luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png [new file with mode: 0644]
luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png [new file with mode: 0644]
miniupnpd/Makefile
miniupnpd/patches/100-no-ssl.patch [deleted file]
miniupnpd/patches/101-no-ssl-uuid.patch [new file with mode: 0644]
miniupnpd/patches/104-always-libuuid.patch [new file with mode: 0644]
ohybridproxy/Makefile
olsrd/Makefile
olsrd/files/olsrd.init

index ec1d247a53de254a700cc0f327a0cc9ff9853b45..2ba0834845e70101c0d558847445c967964eaa7d 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=babeld
-PKG_VERSION:=1.6.1
+PKG_VERSION:=1.7.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/files/
-PKG_MD5SUM:=74290f6c3678f314c79bdc0ab99d9f22
+PKG_SOURCE_URL:=https://www.irif.univ-paris-diderot.fr/~jch/software/files/
+PKG_MD5SUM:=2f71794d4e67f8a5352164ce33611549
 PKG_LICENSE:=MIT
 
 include $(INCLUDE_DIR)/package.mk
index 48407e98208b7d579b3191f4b43eaa7399dbf92d..818e34593f7607453996c34fbb37d1c994bfda84 100644 (file)
@@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batctl
 
-PKG_VERSION:=2014.4.0
+PKG_VERSION:=2016.1
 PKG_RELEASE:=1
-PKG_MD5SUM:=f3a14565699313258ee6ba3de783eb0a
+PKG_MD5SUM:=b98a6e3b45927315cd6d4efba4c1a1ff
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
+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)/$(PKG_NAME)-$(PKG_VERSION)
@@ -22,7 +22,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
 include $(INCLUDE_DIR)/package.mk
 
 define Package/batctl
-  URL:=http://www.open-mesh.org/
+  URL:=https://www.open-mesh.org/
   SECTION:=net
   CATEGORY:=Network
   DEPENDS:=+kmod-batman-adv +libnl-tiny +libc
index 86fc795a6218243700d26f82f322f303bf6a4636..48092e71d37c090bda01eec5184b9728a8b36702 100644 (file)
@@ -24,3 +24,7 @@ config KMOD_BATMAN_ADV_NC
        depends on PACKAGE_kmod-batman-adv
        default n
 
+config KMOD_BATMAN_ADV_BATMAN_V
+       bool "enable batman v routing algorithm"
+       depends on PACKAGE_kmod-batman-adv
+       default n
index 6909ba86e5580bc11c46d9dbd1b9e886edb15bae..e8334d58f99c5daaa071e87049f0107be2829eca 100644 (file)
@@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
 
-PKG_VERSION:=2014.4.0
-PKG_RELEASE:=1
-PKG_MD5SUM:=b1518e84ce530883d224c6ca4c673ce8
+PKG_VERSION:=2016.1
+PKG_RELEASE:=3
+PKG_MD5SUM:=8c8e449009b4d29512d26ee308960bb5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
+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)/$(PKG_NAME)-$(PKG_VERSION)
@@ -24,13 +24,13 @@ include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 define KernelPackage/batman-adv
-  URL:=http://www.open-mesh.org/
+  URL:=https://www.open-mesh.org/
   MAINTAINER:=Marek Lindner <mareklindner@neomailbox.ch>
   SUBMENU:=Network Support
-  DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c
+  DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-crc32c +kmod-lib-crc32c +kmod-cfg80211
   TITLE:=B.A.T.M.A.N. Adv
-  FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
-  AUTOLOAD:=$(call AutoLoad,50,batman-adv)
+  FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
+  AUTOLOAD:=$(call AutoLoad,50,cfg80211 batman-adv)
 endef
 
 define KernelPackage/batman-adv/description
@@ -47,29 +47,44 @@ define Package/kmod-batman-adv/conffiles
 /etc/config/batman-adv
 endef
 
-MAKE_BATMAN_ADV_ARGS += \
-       CROSS_COMPILE="$(TARGET_CROSS)" \
-       KERNELPATH="$(LINUX_DIR)" \
-       ARCH="$(LINUX_KARCH)" \
-       PATH="$(TARGET_PATH)" \
-       SUBDIRS="$(PKG_BUILD_DIR)" \
-       PWD="$(PKG_BUILD_DIR)" \
-       LINUX_VERSION="$(LINUX_VERSION)" \
+PKG_EXTRA_KCONFIG:= \
+       CONFIG_BATMAN_ADV=m \
        CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \
        CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \
        CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \
        CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),y,n) \
        CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \
-       REVISION="" all
+       CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_KMOD_BATMAN_ADV_BATMAN_V),y,n) \
+
+PKG_EXTRA_CFLAGS:= \
+       $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
+       $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
+
+NOSTDINC_FLAGS = \
+       -I$(PKG_BUILD_DIR)/net/batman-adv \
+       -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
+       -I$(STAGING_DIR)/usr/include/mac80211-backport \
+       -I$(STAGING_DIR)/usr/include/mac80211/uapi \
+       -I$(STAGING_DIR)/usr/include/mac80211 \
+       -include backport/backport.h \
+       -include $(PKG_BUILD_DIR)/compat-hacks.h
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
+               ARCH="$(LINUX_KARCH)" \
+               CROSS_COMPILE="$(TARGET_CROSS)" \
+               SUBDIRS="$(PKG_BUILD_DIR)/net/batman-adv" \
+               $(PKG_EXTRA_KCONFIG) \
+               EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
+               NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
+               modules
+endef
 
 define Build/Prepare
        $(call Build/Prepare/Default)
+       $(CP) ./files/compat-hacks.h $(PKG_BUILD_DIR)/
        $(SED) '/#define _NET_BATMAN_ADV_MAIN_H_/a\#undef CONFIG_MODULE_STRIPPED' \
-               $(PKG_BUILD_DIR)/main.h
-endef
-
-define Build/Compile
-       $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS)
+               $(PKG_BUILD_DIR)/net/batman-adv/main.h
 endef
 
 define Build/Clean
diff --git a/batman-adv/files/compat-hacks.h b/batman-adv/files/compat-hacks.h
new file mode 100644 (file)
index 0000000..5126fc2
--- /dev/null
@@ -0,0 +1,76 @@
+/* Please avoid adding hacks here - instead add it to mac80211/backports.git */
+
+#include <linux/version.h>     /* LINUX_VERSION_CODE */
+#include <linux/types.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
+
+#define dev_get_iflink(_net_dev) ((_net_dev)->iflink)
+
+#endif /* < KERNEL_VERSION(4, 1, 0) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
+
+#include <linux/netdevice.h>
+
+#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\
+       BUILD_BUG_ON(upper_priv != NULL); \
+       BUILD_BUG_ON(upper_info != NULL); \
+       netdev_set_master(dev, upper_dev); \
+})
+
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
+
+#include <linux/netdevice.h>
+
+#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\
+       BUILD_BUG_ON(upper_priv != NULL); \
+       BUILD_BUG_ON(upper_info != NULL); \
+       netdev_master_upper_dev_link(dev, upper_dev); \
+})
+
+#endif /* < KERNEL_VERSION(4, 5, 0) */
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
+
+#define IFF_NO_QUEUE   0; dev->tx_queue_len = 0
+
+#endif /* < KERNEL_VERSION(4, 3, 0) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+
+#include <linux/ethtool.h>
+
+#define ethtool_link_ksettings batadv_ethtool_link_ksettings
+
+struct batadv_ethtool_link_ksettings {
+       struct {
+               __u32   speed;
+               __u8    duplex;
+       } base;
+};
+
+#define __ethtool_get_link_ksettings(__dev, __link_settings) \
+       batadv_ethtool_get_link_ksettings(__dev, __link_settings)
+
+static inline int
+batadv_ethtool_get_link_ksettings(struct net_device *dev,
+                                 struct ethtool_link_ksettings *link_ksettings)
+{
+       struct ethtool_cmd cmd;
+       int ret;
+
+       memset(&cmd, 0, sizeof(cmd));
+       ret = __ethtool_get_settings(dev, &cmd);
+
+       if (ret != 0)
+               return ret;
+
+       link_ksettings->base.duplex = cmd.duplex;
+       link_ksettings->base.speed = ethtool_cmd_speed(&cmd);
+
+       return 0;
+}
+
+#endif /* < KERNEL_VERSION(4, 6, 0) */
index 632a209d0ee03131455b1d51b7576f336621f66a..1e0c9d0fe24d44c7f7cc9bddaf8065c60f680862 100644 (file)
@@ -6,14 +6,18 @@ init_proto "$@"
 
 proto_batadv_init_config() {
        proto_config_add_string "mesh"
+       proto_config_add_string "routing_algo"
 }
 
 proto_batadv_setup() {
        local config="$1"
        local iface="$2"
 
-       local mesh
-       json_get_vars mesh
+       local mesh routing_algo
+       json_get_vars mesh routing_algo
+
+       [ -n "$routing_algo" ] || routing_algo="BATMAN_IV"
+       echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo"
 
        echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
        proto_init_update "$iface" 1
diff --git a/batman-adv/patches/0001-batman-adv-make-sure-ELP-OGM-orig-MAC-is-updated-on-.patch b/batman-adv/patches/0001-batman-adv-make-sure-ELP-OGM-orig-MAC-is-updated-on-.patch
new file mode 100644 (file)
index 0000000..70adb91
--- /dev/null
@@ -0,0 +1,64 @@
+From a636bf0b69010222ea58337d425ca9ff8ce52639 Mon Sep 17 00:00:00 2001
+From: Antonio Quartulli <a@unstable.cc>
+Date: Mon, 2 May 2016 18:27:38 +0800
+Subject: [PATCH 1/6] batman-adv: make sure ELP/OGM orig MAC is updated on
+ address change
+
+When the MAC address of the primary interface is changed,
+update the originator address in the ELP and OGM skb buffers as
+well in order to reflect the change.
+
+Fixes: a4b88af77e28 ("batman-adv: ELP - adding basic infrastructure")
+Reported-by: Marek Lindner <marek@neomailbox.ch>
+Signed-off-by: Antonio Quartulli <a@unstable.cc>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ net/batman-adv/bat_v.c | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
+index 4026f19..4547fce 100644
+--- a/net/batman-adv/bat_v.c
++++ b/net/batman-adv/bat_v.c
+@@ -72,16 +72,34 @@ static void batadv_v_iface_disable(struct batadv_hard_iface *hard_iface)
+       batadv_v_elp_iface_disable(hard_iface);
+ }
+-static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
+-{
+-}
+-
+ static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface)
+ {
+       batadv_v_elp_primary_iface_set(hard_iface);
+       batadv_v_ogm_primary_iface_set(hard_iface);
+ }
++/**
++ * batadv_v_iface_update_mac - react to hard-interface MAC address change
++ * @hard_iface: the modified interface
++ *
++ * If the modified interface is the primary one, update the originator
++ * address in the ELP and OGM messages to reflect the new MAC address.
++ */
++static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
++{
++      struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
++      struct batadv_hard_iface *primary_if;
++
++      primary_if = batadv_primary_if_get_selected(bat_priv);
++      if (primary_if != hard_iface)
++              goto out;
++
++      batadv_v_primary_iface_set(hard_iface);
++out:
++      if (primary_if)
++              batadv_hardif_put(primary_if);
++}
++
+ static void
+ batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh)
+ {
+-- 
+2.8.0.rc3
+
diff --git a/batman-adv/patches/0002-batman-adv-Avoid-duplicate-neigh_node-additions.patch b/batman-adv/patches/0002-batman-adv-Avoid-duplicate-neigh_node-additions.patch
new file mode 100644 (file)
index 0000000..ea191b3
--- /dev/null
@@ -0,0 +1,89 @@
+From 8013ae257447c99d7ba037967458f91ceb4051ae Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
+Date: Thu, 7 Jan 2016 08:11:12 +0100
+Subject: [PATCH 2/6] batman-adv: Avoid duplicate neigh_node additions
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Two parallel calls to batadv_neigh_node_new() might race for creating
+and adding the same neig_node. Fix this by including the check for any
+already existing, identical neigh_node within the spin-lock.
+
+This fixes splats like the following:
+
+[  739.535069] ------------[ cut here ]------------
+[  739.535079] WARNING: CPU: 0 PID: 0 at /usr/src/batman-adv/git/batman-adv/net/batman-adv/bat_iv_ogm.c:1004 batadv_iv_ogm_process_per_outif+0xe3f/0xe60 [batman_adv]()
+[  739.535092] too many matching neigh_nodes
+[  739.535094] Modules linked in: dm_mod tun ip6table_filter ip6table_mangle ip6table_nat nf_nat_ipv6 ip6_tables xt_nat iptable_nat nf_nat_ipv4 nf_nat xt_TCPMSS xt_mark iptable_mangle xt_tcpudp xt_conntrack iptable_filter ip_tables x_tables ip_gre ip_tunnel gre bridge stp llc thermal_sys kvm_intel kvm crct10dif_pclmul crc32_pclmul sha256_ssse3 sha256_generic hmac drbg ansi_cprng aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd evdev pcspkr ip6_gre ip6_tunnel tunnel6 batman_adv(O) libcrc32c nf_conntrack_ipv6 nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack autofs4 ext4 crc16 mbcache jbd2 xen_netfront xen_blkfront crc32c_intel
+[  739.535177] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W  O    4.2.0-0.bpo.1-amd64 #1 Debian 4.2.6-3~bpo8+2
+[  739.535186]  0000000000000000 ffffffffa013b050 ffffffff81554521 ffff88007d003c18
+[  739.535201]  ffffffff8106fa01 0000000000000000 ffff8800047a087a ffff880079c3a000
+[  739.735602]  ffff88007b82bf40 ffff88007bc2d1c0 ffffffff8106fa7a ffffffffa013aa8e
+[  739.735624] Call Trace:
+[  739.735639]  <IRQ>  [<ffffffff81554521>] ? dump_stack+0x40/0x50
+[  739.735677]  [<ffffffff8106fa01>] ? warn_slowpath_common+0x81/0xb0
+[  739.735692]  [<ffffffff8106fa7a>] ? warn_slowpath_fmt+0x4a/0x50
+[  739.735715]  [<ffffffffa012448f>] ? batadv_iv_ogm_process_per_outif+0xe3f/0xe60 [batman_adv]
+[  739.735740]  [<ffffffffa0124813>] ? batadv_iv_ogm_receive+0x363/0x380 [batman_adv]
+[  739.735762]  [<ffffffffa0124813>] ? batadv_iv_ogm_receive+0x363/0x380 [batman_adv]
+[  739.735783]  [<ffffffff810b0841>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
+[  739.735804]  [<ffffffffa012cb39>] ? batadv_batman_skb_recv+0xc9/0x110 [batman_adv]
+[  739.735825]  [<ffffffff81464891>] ? __netif_receive_skb_core+0x841/0x9a0
+[  739.735838]  [<ffffffff810b0841>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
+[  739.735853]  [<ffffffff81465681>] ? process_backlog+0xa1/0x140
+[  739.735864]  [<ffffffff81464f1a>] ? net_rx_action+0x20a/0x320
+[  739.735878]  [<ffffffff81073aa7>] ? __do_softirq+0x107/0x270
+[  739.735891]  [<ffffffff81073d82>] ? irq_exit+0x92/0xa0
+[  739.735905]  [<ffffffff8137e0d1>] ? xen_evtchn_do_upcall+0x31/0x40
+[  739.735924]  [<ffffffff8155b8fe>] ? xen_do_hypervisor_callback+0x1e/0x40
+[  739.735939]  <EOI>  [<ffffffff810013aa>] ? xen_hypercall_sched_op+0xa/0x20
+[  739.735965]  [<ffffffff810013aa>] ? xen_hypercall_sched_op+0xa/0x20
+[  739.735979]  [<ffffffff8100a39c>] ? xen_safe_halt+0xc/0x20
+[  739.735991]  [<ffffffff8101da6c>] ? default_idle+0x1c/0xa0
+[  739.736004]  [<ffffffff810abf6b>] ? cpu_startup_entry+0x2eb/0x350
+[  739.736019]  [<ffffffff81b2af5e>] ? start_kernel+0x480/0x48b
+[  739.736032]  [<ffffffff81b2d116>] ? xen_start_kernel+0x507/0x511
+[  739.736048] ---[ end trace c106bb901244bc8c ]---
+
+Reported-by: Martin Weinelt <martin@darmstadt.freifunk.net>
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ net/batman-adv/originator.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
+index c355a82..28241a4 100644
+--- a/net/batman-adv/originator.c
++++ b/net/batman-adv/originator.c
+@@ -630,6 +630,8 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
+       struct batadv_neigh_node *neigh_node;
+       struct batadv_hardif_neigh_node *hardif_neigh = NULL;
++      spin_lock_bh(&orig_node->neigh_list_lock);
++
+       neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr);
+       if (neigh_node)
+               goto out;
+@@ -666,15 +668,15 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
+       kref_init(&neigh_node->refcount);
+       kref_get(&neigh_node->refcount);
+-      spin_lock_bh(&orig_node->neigh_list_lock);
+       hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
+-      spin_unlock_bh(&orig_node->neigh_list_lock);
+       batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv,
+                  "Creating new neighbor %pM for orig_node %pM on interface %s\n",
+                  neigh_addr, orig_node->orig, hard_iface->net_dev->name);
+ out:
++      spin_unlock_bh(&orig_node->neigh_list_lock);
++
+       if (hardif_neigh)
+               batadv_hardif_neigh_put(hardif_neigh);
+       return neigh_node;
+-- 
+2.8.0.rc3
+
diff --git a/batman-adv/patches/0003-batman-adv-Avoid-nullptr-derefence-in-batadv_v_neigh.patch b/batman-adv/patches/0003-batman-adv-Avoid-nullptr-derefence-in-batadv_v_neigh.patch
new file mode 100644 (file)
index 0000000..aa07ad5
--- /dev/null
@@ -0,0 +1,38 @@
+From 036aa7b7181ee96ae6971eb31dd97b6ace7c0a80 Mon Sep 17 00:00:00 2001
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 6 May 2016 11:43:38 +0200
+Subject: [PATCH 3/6] batman-adv: Avoid nullptr derefence in
+ batadv_v_neigh_is_sob
+
+batadv_neigh_ifinfo_get can return NULL when it cannot find (even when only
+temporarily) anymore the neigh_ifinfo in the list neigh->ifinfo_list. This
+has to be checked to avoid kernel Oopses when the ifinfo is dereferenced.
+
+This a situation which isn't expected but is already handled by functions
+like batadv_v_neigh_cmp. The same kind of warning is therefore used before
+the function returns without dereferencing the pointers.
+
+Fixes: b05bbab5e1fc ("batman-adv: B.A.T.M.A.N. V - implement neighbor comparison API calls")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ net/batman-adv/bat_v.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
+index 4547fce..7e1467a 100644
+--- a/net/batman-adv/bat_v.c
++++ b/net/batman-adv/bat_v.c
+@@ -295,6 +295,9 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
+       ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
+       ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
++      if (WARN_ON(!ifinfo1 || !ifinfo2))
++              return false;
++
+       threshold = ifinfo1->bat_v.throughput / 4;
+       threshold = ifinfo1->bat_v.throughput - threshold;
+-- 
+2.8.0.rc3
+
diff --git a/batman-adv/patches/0004-batman-adv-Fix-refcnt-leak-in-batadv_v_neigh_.patch b/batman-adv/patches/0004-batman-adv-Fix-refcnt-leak-in-batadv_v_neigh_.patch
new file mode 100644 (file)
index 0000000..15ef21c
--- /dev/null
@@ -0,0 +1,81 @@
+From 650d41de4be2fe9e9d1842c1abdd357dedbaa7ba Mon Sep 17 00:00:00 2001
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 6 May 2016 11:43:39 +0200
+Subject: [PATCH 4/6] batman-adv: Fix refcnt leak in batadv_v_neigh_*
+
+The functions batadv_neigh_ifinfo_get increase the reference counter of the
+batadv_neigh_ifinfo. These have to be reduced again when the reference is
+not used anymore to correctly free the objects.
+
+Fixes: b05bbab5e1fc ("batman-adv: B.A.T.M.A.N. V - implement neighbor comparison API calls")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ net/batman-adv/bat_v.c | 32 +++++++++++++++++++++++++-------
+ 1 file changed, 25 insertions(+), 7 deletions(-)
+
+diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
+index 7e1467a..2bcb29b 100644
+--- a/net/batman-adv/bat_v.c
++++ b/net/batman-adv/bat_v.c
+@@ -274,14 +274,23 @@ static int batadv_v_neigh_cmp(struct batadv_neigh_node *neigh1,
+                             struct batadv_hard_iface *if_outgoing2)
+ {
+       struct batadv_neigh_ifinfo *ifinfo1, *ifinfo2;
++      int ret = 0;
+       ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
++      if (WARN_ON(!ifinfo1))
++              goto err_ifinfo1;
++
+       ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
++      if (WARN_ON(!ifinfo2))
++              goto err_ifinfo2;
+-      if (WARN_ON(!ifinfo1 || !ifinfo2))
+-              return 0;
++      ret = ifinfo1->bat_v.throughput - ifinfo2->bat_v.throughput;
+-      return ifinfo1->bat_v.throughput - ifinfo2->bat_v.throughput;
++      batadv_neigh_ifinfo_put(ifinfo2);
++err_ifinfo2:
++      batadv_neigh_ifinfo_put(ifinfo1);
++err_ifinfo1:
++      return ret;
+ }
+ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
+@@ -291,17 +300,26 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
+ {
+       struct batadv_neigh_ifinfo *ifinfo1, *ifinfo2;
+       u32 threshold;
++      bool ret = false;
+       ifinfo1 = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
+-      ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
++      if (WARN_ON(!ifinfo1))
++              goto err_ifinfo1;
+-      if (WARN_ON(!ifinfo1 || !ifinfo2))
+-              return false;
++      ifinfo2 = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
++      if (WARN_ON(!ifinfo2))
++              goto err_ifinfo2;
+       threshold = ifinfo1->bat_v.throughput / 4;
+       threshold = ifinfo1->bat_v.throughput - threshold;
+-      return ifinfo2->bat_v.throughput > threshold;
++      ret = ifinfo2->bat_v.throughput > threshold;
++
++      batadv_neigh_ifinfo_put(ifinfo2);
++err_ifinfo2:
++      batadv_neigh_ifinfo_put(ifinfo1);
++err_ifinfo1:
++      return ret;
+ }
+ static struct batadv_algo_ops batadv_batman_v __read_mostly = {
+-- 
+2.8.0.rc3
+
diff --git a/batman-adv/patches/0005-batman-adv-Fix-double-neigh_node_put-in-batadv_v_ogm.patch b/batman-adv/patches/0005-batman-adv-Fix-double-neigh_node_put-in-batadv_v_ogm.patch
new file mode 100644 (file)
index 0000000..8ea3788
--- /dev/null
@@ -0,0 +1,40 @@
+From fc3e79d9ef2a1006f94e441d9613749cbbe7176a Mon Sep 17 00:00:00 2001
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 6 May 2016 22:27:09 +0200
+Subject: [PATCH 5/6] batman-adv: Fix double neigh_node_put in
+ batadv_v_ogm_route_update
+
+The router is put down twice when it was non-NULL and either orig_ifinfo is
+NULL afterwards or batman-adv receives a packet with the same sequence
+number. This will end up in a use-after-free when the batadv_neigh_node is
+removed because the reference counter ended up too early at 0.
+
+Fixes: 667996ebeab4 ("batman-adv: OGMv2 - implement originators logic")
+Reported-by: Gui Iribarren <gui@altermundi.net>
+Tested-by: Antonio Quartulli <a@unstable.cc>
+Tested-by: Marek Lindner <mareklindner@neomailbox.ch>
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ net/batman-adv/bat_v_ogm.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
+index d9bcbe6..91df28a 100644
+--- a/net/batman-adv/bat_v_ogm.c
++++ b/net/batman-adv/bat_v_ogm.c
+@@ -529,8 +529,10 @@ static void batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
+               goto out;
+       }
+-      if (router)
++      if (router) {
+               batadv_neigh_node_put(router);
++              router = NULL;
++      }
+       /* Update routes, and check if the OGM is from the best next hop */
+       batadv_v_ogm_orig_update(bat_priv, orig_node, neigh_node, ogm2,
+-- 
+2.8.0.rc3
+
diff --git a/batman-adv/patches/0006-batman-adv-initialize-ELP-orig-address-on-secondary-.patch b/batman-adv/patches/0006-batman-adv-initialize-ELP-orig-address-on-secondary-.patch
new file mode 100644 (file)
index 0000000..f87ddf0
--- /dev/null
@@ -0,0 +1,110 @@
+From f58a0b03873fd3aa9568c11af198f997ed2208cc Mon Sep 17 00:00:00 2001
+From: Marek Lindner <mareklindner@neomailbox.ch>
+Date: Sat, 7 May 2016 19:54:17 +0800
+Subject: [PATCH 6/6] batman-adv: initialize ELP orig address on secondary
+ interfaces
+
+This fix prevents nodes to wrongly create a 00:00:00:00:00:00 originator
+which can potentially interfere with the rest of the neighbor statistics.
+
+Fixes: a4b88af77e28 ("batman-adv: ELP - adding basic infrastructure")
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ net/batman-adv/bat_v.c     | 10 ++++++++++
+ net/batman-adv/bat_v_elp.c | 31 ++++++++++++++++++++++---------
+ net/batman-adv/bat_v_elp.h |  2 ++
+ 3 files changed, 34 insertions(+), 9 deletions(-)
+
+diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
+index 2bcb29b..0caca2f 100644
+--- a/net/batman-adv/bat_v.c
++++ b/net/batman-adv/bat_v.c
+@@ -39,6 +39,16 @@
+ static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
+ {
++      struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
++      struct batadv_hard_iface *primary_if;
++
++      primary_if = batadv_primary_if_get_selected(bat_priv);
++
++      if (primary_if) {
++              batadv_v_elp_iface_activate(primary_if, hard_iface);
++              batadv_hardif_put(primary_if);
++      }
++
+       /* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
+        * set the interface as ACTIVE right away, without any risk of race
+        * condition
+diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
+index 3844e7e..df42eb1 100644
+--- a/net/batman-adv/bat_v_elp.c
++++ b/net/batman-adv/bat_v_elp.c
+@@ -377,6 +377,27 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
+ }
+ /**
++ * batadv_v_elp_iface_activate - update the ELP buffer belonging to the given
++ *  hard-interface
++ * @primary_iface: the new primary interface
++ * @hard_iface: interface holding the to-be-updated buffer
++ */
++void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
++                               struct batadv_hard_iface *hard_iface)
++{
++      struct batadv_elp_packet *elp_packet;
++      struct sk_buff *skb;
++
++      if (!hard_iface->bat_v.elp_skb)
++              return;
++
++      skb = hard_iface->bat_v.elp_skb;
++      elp_packet = (struct batadv_elp_packet *)skb->data;
++      ether_addr_copy(elp_packet->orig,
++                      primary_iface->net_dev->dev_addr);
++}
++
++/**
+  * batadv_v_elp_primary_iface_set - change internal data to reflect the new
+  *  primary interface
+  * @primary_iface: the new primary interface
+@@ -384,8 +405,6 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
+ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
+ {
+       struct batadv_hard_iface *hard_iface;
+-      struct batadv_elp_packet *elp_packet;
+-      struct sk_buff *skb;
+       /* update orig field of every elp iface belonging to this mesh */
+       rcu_read_lock();
+@@ -393,13 +412,7 @@ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
+               if (primary_iface->soft_iface != hard_iface->soft_iface)
+                       continue;
+-              if (!hard_iface->bat_v.elp_skb)
+-                      continue;
+-
+-              skb = hard_iface->bat_v.elp_skb;
+-              elp_packet = (struct batadv_elp_packet *)skb->data;
+-              ether_addr_copy(elp_packet->orig,
+-                              primary_iface->net_dev->dev_addr);
++              batadv_v_elp_iface_activate(primary_iface, hard_iface);
+       }
+       rcu_read_unlock();
+ }
+diff --git a/net/batman-adv/bat_v_elp.h b/net/batman-adv/bat_v_elp.h
+index e95f1bc..cc130b2 100644
+--- a/net/batman-adv/bat_v_elp.h
++++ b/net/batman-adv/bat_v_elp.h
+@@ -25,6 +25,8 @@ struct work_struct;
+ int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface);
+ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface);
++void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
++                               struct batadv_hard_iface *hard_iface);
+ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface);
+ int batadv_v_elp_packet_recv(struct sk_buff *skb,
+                            struct batadv_hard_iface *if_incoming);
+-- 
+2.8.0.rc3
+
diff --git a/batman-adv/patches/0007-batman-adv-Add-missing-include-for-batadv_v_neigh_is.patch b/batman-adv/patches/0007-batman-adv-Add-missing-include-for-batadv_v_neigh_is.patch
new file mode 100644 (file)
index 0000000..82ffd07
--- /dev/null
@@ -0,0 +1,28 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 7 May 2016 09:50:44 +0200
+Subject: [PATCH] batman-adv: Add missing include for batadv_v_neigh_is_sob
+
+batadv_v_neigh_is_sob started to use false which is defined in
+linux/stddef.h.
+
+Fixes: 036aa7b7181e ("batman-adv: Avoid nullptr derefence in batadv_v_neigh_is_sob")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/9685688ae7dd85804aec2f6ce760611551fe9635
+---
+ net/batman-adv/bat_v.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
+index 0caca2f..1f960c9 100644
+--- a/net/batman-adv/bat_v.c
++++ b/net/batman-adv/bat_v.c
+@@ -27,6 +27,7 @@
+ #include <linux/rculist.h>
+ #include <linux/rcupdate.h>
+ #include <linux/seq_file.h>
++#include <linux/stddef.h>
+ #include <linux/types.h>
+ #include <linux/workqueue.h>
diff --git a/batman-adv/patches/0008-batman-adv-fix-skb-deref-after-free.patch b/batman-adv/patches/0008-batman-adv-fix-skb-deref-after-free.patch
new file mode 100644 (file)
index 0000000..5c8bfd8
--- /dev/null
@@ -0,0 +1,46 @@
+From: Florian Westphal <fw@strlen.de>
+Date: Tue, 10 May 2016 23:17:59 +0200
+Subject: [PATCH] batman-adv: fix skb deref after free
+
+batadv_send_skb_to_orig() calls dev_queue_xmit() so we can't use skb->len.
+
+Fixes: d28785996ad8 ("batman-adv: network coding - buffer unicast packets before forward")
+
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Reviewed-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/6863d3b59fd1f1bef3c4b86707a0b1c5d21e0a07
+---
+ net/batman-adv/routing.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
+index b781bf7..0c0c30e 100644
+--- a/net/batman-adv/routing.c
++++ b/net/batman-adv/routing.c
+@@ -601,6 +601,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
+       struct batadv_unicast_packet *unicast_packet;
+       struct ethhdr *ethhdr = eth_hdr(skb);
+       int res, hdr_len, ret = NET_RX_DROP;
++      unsigned int len;
+       unicast_packet = (struct batadv_unicast_packet *)skb->data;
+@@ -641,6 +642,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
+       if (hdr_len > 0)
+               batadv_skb_set_priority(skb, hdr_len);
++      len = skb->len;
+       res = batadv_send_skb_to_orig(skb, orig_node, recv_if);
+       /* translate transmit result into receive result */
+@@ -648,7 +650,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
+               /* skb was transmitted and consumed */
+               batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD);
+               batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES,
+-                                 skb->len + ETH_HLEN);
++                                 len + ETH_HLEN);
+               ret = NET_RX_SUCCESS;
+       } else if (res == NET_XMIT_POLICED) {
diff --git a/batman-adv/patches/0009-batman-adv-replace-WARN-with-rate-limited-output-on-.patch b/batman-adv/patches/0009-batman-adv-replace-WARN-with-rate-limited-output-on-.patch
new file mode 100644 (file)
index 0000000..07274b6
--- /dev/null
@@ -0,0 +1,40 @@
+From: Simon Wunderlich <sw@simonwunderlich.de>
+Date: Thu, 12 May 2016 18:52:03 +0200
+Subject: [PATCH] batman-adv: replace WARN with rate limited output on non-existing VLAN
+
+If a VLAN tagged frame is received and the corresponding VLAN is not
+configured on the soft interface, it will splat a WARN on every packet
+received. This is a quite annoying behaviour for some scenarios, e.g. if
+bat0 is bridged with eth0, and there are arbitrary VLAN tagged frames
+from Ethernet coming in without having any VLAN configuration on bat0.
+
+The code should probably create vlan objects on the fly and
+transparently transport these VLAN-tagged Ethernet frames, but until
+this is done, at least the WARN splat should be replaced by a rate
+limited output.
+
+Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/04792115d24408a72bf8fccd5c4059478fc15eae
+---
+ net/batman-adv/translation-table.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
+index 9b4551a..48adb91 100644
+--- a/net/batman-adv/translation-table.c
++++ b/net/batman-adv/translation-table.c
+@@ -650,8 +650,10 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
+       /* increase the refcounter of the related vlan */
+       vlan = batadv_softif_vlan_get(bat_priv, vid);
+-      if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",
+-               addr, BATADV_PRINT_VID(vid))) {
++      if (!vlan) {
++              net_ratelimited_function(batadv_info, soft_iface,
++                                       "adding TT local entry %pM to non-existent VLAN %d\n",
++                                       addr, BATADV_PRINT_VID(vid));
+               kfree(tt_local);
+               tt_local = NULL;
+               goto out;
diff --git a/batman-adv/patches/0010-batman-adv-Fix-build-against-recent-Debian-Stretch-k.patch b/batman-adv/patches/0010-batman-adv-Fix-build-against-recent-Debian-Stretch-k.patch
new file mode 100644 (file)
index 0000000..127cac8
--- /dev/null
@@ -0,0 +1,58 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 28 May 2016 10:32:48 +0200
+Subject: [PATCH] batman-adv: Fix build against recent Debian Stretch kernels
+
+The kernels for Debian stretch require some special CFLAGS settings which
+are only correctly defined when NOSTDINC_FLAGS is defined inside the
+execution of the Makefile via kbuild. But batman-adv sets it currently
+outside to insert compatibility include headers and compat-sources.
+
+This can be avoided by making the top Makefile kbuild compatible and
+redefining the NOSTDINC_FLAGS when kbuild include this Makefile. The actual
+build of the batman-adv module is then done by adding the subdirectory to
+obj-y.
+
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Tested-by: Martin Weinelt <martin@darmstadt.freifunk.net>
+
+Origin: https://git.open-mesh.org/batman-adv.git/commit/f8fd441e1e30f3a274c9bf44cc33372d4065cbb6
+---
+ Makefile | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 5d2c058..2568fb2 100644
+--- a/Makefile
++++ b/Makefile
+@@ -43,7 +43,7 @@ RM ?= rm -f
+ REVISION= $(shell     if [ -d "$(PWD)/.git" ]; then \
+                               echo $$(git --git-dir="$(PWD)/.git" describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
+                       fi)
+-export NOSTDINC_FLAGS := \
++NOSTDINC_FLAGS += \
+       -I$(PWD)/compat-include/ \
+       -include $(PWD)/compat.h \
+       $(CFLAGS)
+@@ -52,8 +52,12 @@ ifneq ($(REVISION),)
+ NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
+ endif
++obj-y += net/batman-adv/
++
+ BUILD_FLAGS := \
+-      M=$(PWD)/net/batman-adv \
++      M=$(PWD) \
++      PWD=$(PWD) \
++      REVISION=$(REVISION) \
+       CONFIG_BATMAN_ADV=m \
+       CONFIG_BATMAN_ADV_DEBUG=$(CONFIG_BATMAN_ADV_DEBUG) \
+       CONFIG_BATMAN_ADV_BLA=$(CONFIG_BATMAN_ADV_BLA) \
+@@ -61,7 +65,7 @@ BUILD_FLAGS := \
+       CONFIG_BATMAN_ADV_NC=$(CONFIG_BATMAN_ADV_NC) \
+       CONFIG_BATMAN_ADV_MCAST=$(CONFIG_BATMAN_ADV_MCAST) \
+       CONFIG_BATMAN_ADV_BATMAN_V=$(CONFIG_BATMAN_ADV_BATMAN_V) \
+-      INSTALL_MOD_DIR=updates/net/batman-adv/
++      INSTALL_MOD_DIR=updates/
+ all: config
+       $(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) modules
diff --git a/batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch b/batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch
new file mode 100644 (file)
index 0000000..b03d795
--- /dev/null
@@ -0,0 +1,45 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 28 May 2016 14:38:26 +0200
+Subject: [PATCH] batman-adv: Clean up untagged vlan when destroying via rtnl-link
+
+The untagged vlan object is only destroyed when the interface is removed
+via the legacy sysfs interface. But it also has to be destroyed when the
+standard rtnl-link interface is used.
+
+Fixes: 952cebb57518 ("batman-adv: add per VLAN interface attribute framework")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Cc: Antonio Quartulli <a@unstable.cc>
+
+Origin: https://git.open-mesh.org/batman-adv.git/commit/e721749d57ff57d6df4017d62797626eab9902f1
+---
+ net/batman-adv/soft-interface.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
+index 8a136b6..3710620 100644
+--- a/net/batman-adv/soft-interface.c
++++ b/net/batman-adv/soft-interface.c
+@@ -1017,7 +1017,9 @@ void batadv_softif_destroy_sysfs(struct net_device *soft_iface)
+ static void batadv_softif_destroy_netlink(struct net_device *soft_iface,
+                                         struct list_head *head)
+ {
++      struct batadv_priv *bat_priv = netdev_priv(soft_iface);
+       struct batadv_hard_iface *hard_iface;
++      struct batadv_softif_vlan *vlan;
+       list_for_each_entry(hard_iface, &batadv_hardif_list, list) {
+               if (hard_iface->soft_iface == soft_iface)
+@@ -1025,6 +1027,13 @@ static void batadv_softif_destroy_netlink(struct net_device *soft_iface,
+                                                       BATADV_IF_CLEANUP_KEEP);
+       }
++      /* destroy the "untagged" VLAN */
++      vlan = batadv_softif_vlan_get(bat_priv, BATADV_NO_FLAGS);
++      if (vlan) {
++              batadv_softif_destroy_vlan(bat_priv, vlan);
++              batadv_softif_vlan_put(vlan);
++      }
++
+       batadv_sysfs_del_meshif(soft_iface);
+       unregister_netdevice_queue(soft_iface, head);
+ }
diff --git a/batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch b/batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch
new file mode 100644 (file)
index 0000000..5204cdc
--- /dev/null
@@ -0,0 +1,31 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sun, 29 May 2016 21:25:52 +0200
+Subject: [PATCH] batman-adv: Fix ICMP RR ethernet access after skb_linearize
+
+The skb_linearize may reallocate the skb. This makes the calculated pointer
+for ethhdr invalid. But it the pointer is used later to fill in the RR
+field of the batadv_icmp_packet_rr packet.
+
+Instead re-evaluate eth_hdr after the skb_linearize+skb_cow to fix the
+pointer and avoid the invalid read.
+
+Fixes: bb69cb678d37 ("batman-adv: generalize batman-adv icmp packet handling")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/f6c80c29ef4e8b45b715976107b7ae06fc0be3a0
+---
+ net/batman-adv/routing.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
+index 0c0c30e..27e07dd 100644
+--- a/net/batman-adv/routing.c
++++ b/net/batman-adv/routing.c
+@@ -374,6 +374,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
+               if (skb_cow(skb, ETH_HLEN) < 0)
+                       goto out;
++              ethhdr = eth_hdr(skb);
+               icmph = (struct batadv_icmp_header *)skb->data;
+               icmp_packet_rr = (struct batadv_icmp_packet_rr *)icmph;
+               if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN)
diff --git a/batman-adv/patches/0013-batman-adv-Fix-double-put-of-vlan-object.patch b/batman-adv/patches/0013-batman-adv-Fix-double-put-of-vlan-object.patch
new file mode 100644 (file)
index 0000000..6ea8311
--- /dev/null
@@ -0,0 +1,32 @@
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Fri, 3 Jun 2016 00:00:44 +0100
+Subject: [PATCH] batman-adv: Fix double-put of vlan object
+
+Commit a33d970d0b54 "batman-adv: Fix reference counting of vlan object
+for tt_local_entry") makes each batadv_tt_local_entry hold a single
+reference to a batadv_softif_vlan.  In case a new entry cannot be
+added to the hash table, the error path puts the reference, but the
+reference will also now be dropped by batadv_tt_local_entry_release().
+
+Fixes: a33d970d0b54 ("batman-adv: Fix reference counting of vlan object ...")
+Cc: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Acked-by: Sven Eckelmann <sven@narfation.org>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/22bb8b894900064d3fb09032a47577e89fc30d7c
+---
+ net/batman-adv/translation-table.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
+index 48adb91..5ed782b 100644
+--- a/net/batman-adv/translation-table.c
++++ b/net/batman-adv/translation-table.c
+@@ -693,7 +693,6 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
+       if (unlikely(hash_added != 0)) {
+               /* remove the reference for the hash */
+               batadv_tt_local_entry_put(tt_local);
+-              batadv_softif_vlan_put(vlan);
+               goto out;
+       }
diff --git a/batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch b/batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch
new file mode 100644 (file)
index 0000000..33c7f3b
--- /dev/null
@@ -0,0 +1,172 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 4 Jun 2016 08:52:12 +0200
+Subject: [PATCH] batman-adv: Fix use-after-free/double-free of tt_req_node
+
+The tt_req_node is added and removed from a list inside a spinlock. But the
+locking is sometimes removed even when the object is still referenced and
+will be used later via this reference. For example batadv_send_tt_request
+can create a new tt_req_node (including add to a list) and later
+re-acquires the lock to remove it from the list and to free it. But at this
+time another context could have already removed this tt_req_node from the
+list and freed it.
+
+CPU#0
+
+    batadv_batman_skb_recv from net_device 0
+    -> batadv_iv_ogm_receive
+      -> batadv_iv_ogm_process
+        -> batadv_iv_ogm_process_per_outif
+          -> batadv_tvlv_ogm_receive
+            -> batadv_tvlv_ogm_receive
+              -> batadv_tvlv_containers_process
+                -> batadv_tvlv_call_handler
+                  -> batadv_tt_tvlv_ogm_handler_v1
+                    -> batadv_tt_update_orig
+                      -> batadv_send_tt_request
+                        -> batadv_tt_req_node_new
+                           spin_lock(...)
+                           allocates new tt_req_node and adds it to list
+                           spin_unlock(...)
+                           return tt_req_node
+
+CPU#1
+
+    batadv_batman_skb_recv from net_device 1
+    -> batadv_recv_unicast_tvlv
+      -> batadv_tvlv_containers_process
+        -> batadv_tvlv_call_handler
+          -> batadv_tt_tvlv_unicast_handler_v1
+            -> batadv_handle_tt_response
+               spin_lock(...)
+               tt_req_node gets removed from list and is freed
+               spin_unlock(...)
+
+CPU#0
+
+                      <- returned to batadv_send_tt_request
+                         spin_lock(...)
+                         tt_req_node gets removed from list and is freed
+                         MEMORY CORRUPTION/SEGFAULT/...
+                         spin_unlock(...)
+
+This can only be solved via reference counting to allow multiple contexts
+to handle the list manipulation while making sure that only the last
+context holding a reference will free the object.
+
+Fixes: cea194d90b11 ("batman-adv: improved client announcement mechanism")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Tested-by: Martin Weinelt <martin@darmstadt.freifunk.net>
+Tested-by: Amadeus Alfa <amadeus@chemnitz.freifunk.net>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/c3fef3d9ec6e8b882f321ec20f6f2cb2ee906503
+---
+ net/batman-adv/translation-table.c | 37 +++++++++++++++++++++++++++++++++----
+ net/batman-adv/types.h             |  2 ++
+ 2 files changed, 35 insertions(+), 4 deletions(-)
+
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
+index 5ed782b..23fb7ea 100644
+--- a/net/batman-adv/translation-table.c
++++ b/net/batman-adv/translation-table.c
+@@ -2271,6 +2271,29 @@ static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv,
+       return crc;
+ }
++/**
++ * batadv_tt_req_node_release - free tt_req node entry
++ * @ref: kref pointer of the tt req_node entry
++ */
++static void batadv_tt_req_node_release(struct kref *ref)
++{
++      struct batadv_tt_req_node *tt_req_node;
++
++      tt_req_node = container_of(ref, struct batadv_tt_req_node, refcount);
++
++      kfree(tt_req_node);
++}
++
++/**
++ * batadv_tt_req_node_put - decrement the tt_req_node refcounter and
++ *  possibly release it
++ * @tt_req_node: tt_req_node to be free'd
++ */
++static void batadv_tt_req_node_put(struct batadv_tt_req_node *tt_req_node)
++{
++      kref_put(&tt_req_node->refcount, batadv_tt_req_node_release);
++}
++
+ static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
+ {
+       struct batadv_tt_req_node *node;
+@@ -2280,7 +2303,7 @@ static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
+       hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
+               hlist_del_init(&node->list);
+-              kfree(node);
++              batadv_tt_req_node_put(node);
+       }
+       spin_unlock_bh(&bat_priv->tt.req_list_lock);
+@@ -2317,7 +2340,7 @@ static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
+               if (batadv_has_timed_out(node->issued_at,
+                                        BATADV_TT_REQUEST_TIMEOUT)) {
+                       hlist_del_init(&node->list);
+-                      kfree(node);
++                      batadv_tt_req_node_put(node);
+               }
+       }
+       spin_unlock_bh(&bat_priv->tt.req_list_lock);
+@@ -2349,9 +2372,11 @@ batadv_tt_req_node_new(struct batadv_priv *bat_priv,
+       if (!tt_req_node)
+               goto unlock;
++      kref_init(&tt_req_node->refcount);
+       ether_addr_copy(tt_req_node->addr, orig_node->orig);
+       tt_req_node->issued_at = jiffies;
++      kref_get(&tt_req_node->refcount);
+       hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list);
+ unlock:
+       spin_unlock_bh(&bat_priv->tt.req_list_lock);
+@@ -2618,9 +2643,13 @@ out:
+               spin_lock_bh(&bat_priv->tt.req_list_lock);
+               /* hlist_del_init() verifies tt_req_node still is in the list */
+               hlist_del_init(&tt_req_node->list);
++              batadv_tt_req_node_put(tt_req_node);
+               spin_unlock_bh(&bat_priv->tt.req_list_lock);
+-              kfree(tt_req_node);
+       }
++
++      if (tt_req_node)
++              batadv_tt_req_node_put(tt_req_node);
++
+       kfree(tvlv_tt_data);
+       return ret;
+ }
+@@ -3056,7 +3085,7 @@ static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
+               if (!batadv_compare_eth(node->addr, resp_src))
+                       continue;
+               hlist_del_init(&node->list);
+-              kfree(node);
++              batadv_tt_req_node_put(node);
+       }
+       spin_unlock_bh(&bat_priv->tt.req_list_lock);
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
+index 1e47fbe..d75beef 100644
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -1129,11 +1129,13 @@ struct batadv_tt_change_node {
+  * struct batadv_tt_req_node - data to keep track of the tt requests in flight
+  * @addr: mac address address of the originator this request was sent to
+  * @issued_at: timestamp used for purging stale tt requests
++ * @refcount: number of contexts the object is used by
+  * @list: list node for batadv_priv_tt::req_list
+  */
+ struct batadv_tt_req_node {
+       u8 addr[ETH_ALEN];
+       unsigned long issued_at;
++      struct kref refcount;
+       struct hlist_node list;
+ };
diff --git a/batman-adv/patches/0015-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch b/batman-adv/patches/0015-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch
new file mode 100644 (file)
index 0000000..907c1a1
--- /dev/null
@@ -0,0 +1,35 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 2 Jul 2016 09:52:13 +0200
+Subject: [PATCH] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag
+
+vlan_insert_tag can return NULL on errors. The bridge loop avoidance code
+therefore has to check the return value of vlan_insert_tag for NULL before
+it can safely operate on this pointer.
+
+Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/e4cffba4d3353ea15287abbfbdd65208aa62c156
+---
+ net/batman-adv/bridge_loop_avoidance.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
+index 0a6c8b8..fe8b62f 100644
+--- a/net/batman-adv/bridge_loop_avoidance.c
++++ b/net/batman-adv/bridge_loop_avoidance.c
+@@ -409,9 +409,12 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
+               break;
+       }
+-      if (vid & BATADV_VLAN_HAS_TAG)
++      if (vid & BATADV_VLAN_HAS_TAG) {
+               skb = vlan_insert_tag(skb, htons(ETH_P_8021Q),
+                                     vid & VLAN_VID_MASK);
++              if (!skb)
++                      goto out;
++      }
+       skb_reset_mac_header(skb);
+       skb->protocol = eth_type_trans(skb, soft_iface);
diff --git a/batman-adv/patches/0016-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch b/batman-adv/patches/0016-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch
new file mode 100644 (file)
index 0000000..d896811
--- /dev/null
@@ -0,0 +1,49 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 2 Jul 2016 09:52:14 +0200
+Subject: [PATCH] batman-adv: Avoid nullptr dereference in dat after vlan_insert_tag
+
+vlan_insert_tag can return NULL on errors. The distributed arp table code
+therefore has to check the return value of vlan_insert_tag for NULL before
+it can safely operate on this pointer.
+
+Fixes: 53c6c262a581 ("batman-adv: tag locally generated ARP reply if needed")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/898382d11fa1f737cd4f7033db1088c601fd11ed
+---
+ net/batman-adv/distributed-arp-table.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
+index 3e6b262..5a89be0 100644
+--- a/net/batman-adv/distributed-arp-table.c
++++ b/net/batman-adv/distributed-arp-table.c
+@@ -1009,9 +1009,12 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
+               if (!skb_new)
+                       goto out;
+-              if (vid & BATADV_VLAN_HAS_TAG)
++              if (vid & BATADV_VLAN_HAS_TAG) {
+                       skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
+                                                 vid & VLAN_VID_MASK);
++                      if (!skb_new)
++                              goto out;
++              }
+               skb_reset_mac_header(skb_new);
+               skb_new->protocol = eth_type_trans(skb_new,
+@@ -1089,9 +1092,12 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
+        */
+       skb_reset_mac_header(skb_new);
+-      if (vid & BATADV_VLAN_HAS_TAG)
++      if (vid & BATADV_VLAN_HAS_TAG) {
+               skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
+                                         vid & VLAN_VID_MASK);
++              if (!skb_new)
++                      goto out;
++      }
+       /* To preserve backwards compatibility, the node has choose the outgoing
+        * format based on the incoming request packet type. The assumption is
diff --git a/batman-adv/patches/0017-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch b/batman-adv/patches/0017-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch
new file mode 100644 (file)
index 0000000..09f90d3
--- /dev/null
@@ -0,0 +1,41 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 24 Jun 2016 21:43:32 +0200
+Subject: [PATCH] batman-adv: Avoid tt_req_node list put for unhashed entry
+
+It can happen that a tt_req_node list entry was already removed from
+tt.req_list when batadv_send_tt_request reaches the end of the function.
+The reference counter was already reduced by 1 for the list entry and thus
+the reference counter is not allowed to be reduced again. Otherwise, the
+entry is freed too early and the next batadv_tt_req_node_put in this
+function will operate on freed memory.
+
+Fixes: cea194d90b11 ("batman-adv: improved client announcement mechanism")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/03ecc9f957b837c755f09251c5f684996521e487
+---
+ net/batman-adv/translation-table.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
+index 23fb7ea..f7d44c6 100644
+--- a/net/batman-adv/translation-table.c
++++ b/net/batman-adv/translation-table.c
+@@ -2639,11 +2639,13 @@ static int batadv_send_tt_request(struct batadv_priv *bat_priv,
+ out:
+       if (primary_if)
+               batadv_hardif_put(primary_if);
++
+       if (ret && tt_req_node) {
+               spin_lock_bh(&bat_priv->tt.req_list_lock);
+-              /* hlist_del_init() verifies tt_req_node still is in the list */
+-              hlist_del_init(&tt_req_node->list);
+-              batadv_tt_req_node_put(tt_req_node);
++              if (!hlist_unhashed(&tt_req_node->list)) {
++                      hlist_del_init(&tt_req_node->list);
++                      batadv_tt_req_node_put(tt_req_node);
++              }
+               spin_unlock_bh(&bat_priv->tt.req_list_lock);
+       }
diff --git a/batman-adv/patches/0018-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch b/batman-adv/patches/0018-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch
new file mode 100644 (file)
index 0000000..13c74e4
--- /dev/null
@@ -0,0 +1,43 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 30 Jun 2016 20:10:46 +0200
+Subject: [PATCH] batman-adv: Fix orig_node_vlan leak on orig_node_release
+
+batadv_orig_node_new uses batadv_orig_node_vlan_new to allocate a new
+batadv_orig_node_vlan and add it to batadv_orig_node::vlan_list. References
+to this list have also to be cleaned when the batadv_orig_node is removed.
+
+Fixes: 21a57f6e7a3b ("batman-adv: make the TT CRC logic VLAN specific")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/719afd254e812c7ff8688ce79bebb7324ec438d6
+---
+ net/batman-adv/originator.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
+index 28241a4..3a3948a 100644
+--- a/net/batman-adv/originator.c
++++ b/net/batman-adv/originator.c
+@@ -781,6 +781,7 @@ static void batadv_orig_node_release(struct kref *ref)
+       struct batadv_neigh_node *neigh_node;
+       struct batadv_orig_node *orig_node;
+       struct batadv_orig_ifinfo *orig_ifinfo;
++      struct batadv_orig_node_vlan *vlan;
+       orig_node = container_of(ref, struct batadv_orig_node, refcount);
+@@ -800,6 +801,13 @@ static void batadv_orig_node_release(struct kref *ref)
+       }
+       spin_unlock_bh(&orig_node->neigh_list_lock);
++      spin_lock_bh(&orig_node->vlan_list_lock);
++      hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) {
++              hlist_del_rcu(&vlan->list);
++              batadv_orig_node_vlan_put(vlan);
++      }
++      spin_unlock_bh(&orig_node->vlan_list_lock);
++
+       /* Free nc_nodes */
+       batadv_nc_purge_orig(orig_node->bat_priv, orig_node, NULL);
diff --git a/batman-adv/patches/0019-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch b/batman-adv/patches/0019-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch
new file mode 100644 (file)
index 0000000..9631ebe
--- /dev/null
@@ -0,0 +1,291 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 1 Jul 2016 15:49:43 +0200
+Subject: [PATCH] batman-adv: Fix non-atomic bla_claim::backbone_gw access
+
+The pointer batadv_bla_claim::backbone_gw can be changed at any time.
+Therefore, access to it must be protected to ensure that two function
+accessing the same backbone_gw are actually accessing the same. This is
+especially important when the crc_lock is used or when the backbone_gw of a
+claim is exchanged.
+
+Not doing so leads to invalid memory access and/or reference leaks.
+
+Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
+Fixes: b307e72d119f ("batman-adv: lock crc access in bridge loop avoidance")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: backport, https://git.open-mesh.org/batman-adv.git/commit/e401297e3a393896e9b07bef8d6e2df203b60d43
+---
+ net/batman-adv/bridge_loop_avoidance.c | 111 ++++++++++++++++++++++++++-------
+ net/batman-adv/types.h                 |   2 +
+ 2 files changed, 90 insertions(+), 23 deletions(-)
+
+diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
+index fe8b62f..30fd72e 100644
+--- a/net/batman-adv/bridge_loop_avoidance.c
++++ b/net/batman-adv/bridge_loop_avoidance.c
+@@ -176,10 +176,21 @@ static void batadv_backbone_gw_put(struct batadv_bla_backbone_gw *backbone_gw)
+ static void batadv_claim_release(struct kref *ref)
+ {
+       struct batadv_bla_claim *claim;
++      struct batadv_bla_backbone_gw *old_backbone_gw;
+       claim = container_of(ref, struct batadv_bla_claim, refcount);
+-      batadv_backbone_gw_put(claim->backbone_gw);
++      spin_lock_bh(&claim->backbone_lock);
++      old_backbone_gw = claim->backbone_gw;
++      claim->backbone_gw = NULL;
++      spin_unlock_bh(&claim->backbone_lock);
++
++      spin_lock_bh(&old_backbone_gw->crc_lock);
++      old_backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
++      spin_unlock_bh(&old_backbone_gw->crc_lock);
++
++      batadv_backbone_gw_put(old_backbone_gw);
++
+       kfree_rcu(claim, rcu);
+ }
+@@ -637,8 +648,10 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
+                                const u8 *mac, const unsigned short vid,
+                                struct batadv_bla_backbone_gw *backbone_gw)
+ {
++      struct batadv_bla_backbone_gw *old_backbone_gw;
+       struct batadv_bla_claim *claim;
+       struct batadv_bla_claim search_claim;
++      bool remove_crc = false;
+       int hash_added;
+       ether_addr_copy(search_claim.addr, mac);
+@@ -652,8 +665,10 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
+                       return;
+               ether_addr_copy(claim->addr, mac);
++              spin_lock_init(&claim->backbone_lock);
+               claim->vid = vid;
+               claim->lasttime = jiffies;
++              kref_get(&backbone_gw->refcount);
+               claim->backbone_gw = backbone_gw;
+               kref_init(&claim->refcount);
+@@ -681,15 +696,26 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
+                          "bla_add_claim(): changing ownership for %pM, vid %d\n",
+                          mac, BATADV_PRINT_VID(vid));
+-              spin_lock_bh(&claim->backbone_gw->crc_lock);
+-              claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
+-              spin_unlock_bh(&claim->backbone_gw->crc_lock);
+-              batadv_backbone_gw_put(claim->backbone_gw);
++              remove_crc = true;
+       }
+-      /* set (new) backbone gw */
++
++      /* replace backbone_gw atomically and adjust reference counters */
++      spin_lock_bh(&claim->backbone_lock);
++      old_backbone_gw = claim->backbone_gw;
+       kref_get(&backbone_gw->refcount);
+       claim->backbone_gw = backbone_gw;
++      spin_unlock_bh(&claim->backbone_lock);
++      if (remove_crc) {
++              /* remove claim address from old backbone_gw */
++              spin_lock_bh(&old_backbone_gw->crc_lock);
++              old_backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
++              spin_unlock_bh(&old_backbone_gw->crc_lock);
++      }
++
++      batadv_backbone_gw_put(old_backbone_gw);
++
++      /* add claim address to new backbone_gw */
+       spin_lock_bh(&backbone_gw->crc_lock);
+       backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
+       spin_unlock_bh(&backbone_gw->crc_lock);
+@@ -700,6 +726,26 @@ claim_free_ref:
+ }
+ /**
++ * batadv_bla_claim_get_backbone_gw - Get valid reference for backbone_gw of
++ *  claim
++ * @claim: claim whose backbone_gw should be returned
++ *
++ * Return: valid reference to claim::backbone_gw
++ */
++static struct batadv_bla_backbone_gw *
++batadv_bla_claim_get_backbone_gw(struct batadv_bla_claim *claim)
++{
++      struct batadv_bla_backbone_gw *backbone_gw;
++
++      spin_lock_bh(&claim->backbone_lock);
++      backbone_gw = claim->backbone_gw;
++      kref_get(&backbone_gw->refcount);
++      spin_unlock_bh(&claim->backbone_lock);
++
++      return backbone_gw;
++}
++
++/**
+  * batadv_bla_del_claim - delete a claim from the claim hash
+  * @bat_priv: the bat priv with all the soft interface information
+  * @mac: mac address of the claim to be removed
+@@ -723,10 +769,6 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
+                          batadv_choose_claim, claim);
+       batadv_claim_put(claim); /* reference from the hash is gone */
+-      spin_lock_bh(&claim->backbone_gw->crc_lock);
+-      claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
+-      spin_unlock_bh(&claim->backbone_gw->crc_lock);
+-
+       /* don't need the reference from hash_find() anymore */
+       batadv_claim_put(claim);
+ }
+@@ -1175,6 +1217,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
+                                   struct batadv_hard_iface *primary_if,
+                                   int now)
+ {
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct batadv_bla_claim *claim;
+       struct hlist_head *head;
+       struct batadv_hashtable *hash;
+@@ -1189,14 +1232,17 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
+               rcu_read_lock();
+               hlist_for_each_entry_rcu(claim, head, hash_entry) {
++                      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
+                       if (now)
+                               goto purge_now;
+-                      if (!batadv_compare_eth(claim->backbone_gw->orig,
++
++                      if (!batadv_compare_eth(backbone_gw->orig,
+                                               primary_if->net_dev->dev_addr))
+-                              continue;
++                              goto skip;
++
+                       if (!batadv_has_timed_out(claim->lasttime,
+                                                 BATADV_BLA_CLAIM_TIMEOUT))
+-                              continue;
++                              goto skip;
+                       batadv_dbg(BATADV_DBG_BLA, bat_priv,
+                                  "bla_purge_claims(): %pM, vid %d, time out\n",
+@@ -1204,8 +1250,10 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
+ purge_now:
+                       batadv_handle_unclaim(bat_priv, primary_if,
+-                                            claim->backbone_gw->orig,
++                                            backbone_gw->orig,
+                                             claim->addr, claim->vid);
++skip:
++                      batadv_backbone_gw_put(backbone_gw);
+               }
+               rcu_read_unlock();
+       }
+@@ -1623,9 +1671,11 @@ void batadv_bla_free(struct batadv_priv *bat_priv)
+ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+                 unsigned short vid, bool is_bcast)
+ {
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct ethhdr *ethhdr;
+       struct batadv_bla_claim search_claim, *claim = NULL;
+       struct batadv_hard_iface *primary_if;
++      bool own_claim;
+       int ret;
+       ethhdr = eth_hdr(skb);
+@@ -1657,8 +1707,12 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+       }
+       /* if it is our own claim ... */
+-      if (batadv_compare_eth(claim->backbone_gw->orig,
+-                             primary_if->net_dev->dev_addr)) {
++      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
++      own_claim = batadv_compare_eth(backbone_gw->orig,
++                                     primary_if->net_dev->dev_addr);
++      batadv_backbone_gw_put(backbone_gw);
++
++      if (own_claim) {
+               /* ... allow it in any case */
+               claim->lasttime = jiffies;
+               goto allow;
+@@ -1722,7 +1776,9 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+ {
+       struct ethhdr *ethhdr;
+       struct batadv_bla_claim search_claim, *claim = NULL;
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct batadv_hard_iface *primary_if;
++      bool client_roamed;
+       int ret = 0;
+       primary_if = batadv_primary_if_get_selected(bat_priv);
+@@ -1752,8 +1808,12 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+               goto allow;
+       /* check if we are responsible. */
+-      if (batadv_compare_eth(claim->backbone_gw->orig,
+-                             primary_if->net_dev->dev_addr)) {
++      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
++      client_roamed = batadv_compare_eth(backbone_gw->orig,
++                                         primary_if->net_dev->dev_addr);
++      batadv_backbone_gw_put(backbone_gw);
++
++      if (client_roamed) {
+               /* if yes, the client has roamed and we have
+                * to unclaim it.
+                */
+@@ -1801,6 +1861,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
+       struct net_device *net_dev = (struct net_device *)seq->private;
+       struct batadv_priv *bat_priv = netdev_priv(net_dev);
+       struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct batadv_bla_claim *claim;
+       struct batadv_hard_iface *primary_if;
+       struct hlist_head *head;
+@@ -1825,17 +1886,21 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
+               rcu_read_lock();
+               hlist_for_each_entry_rcu(claim, head, hash_entry) {
+-                      is_own = batadv_compare_eth(claim->backbone_gw->orig,
++                      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
++
++                      is_own = batadv_compare_eth(backbone_gw->orig,
+                                                   primary_addr);
+-                      spin_lock_bh(&claim->backbone_gw->crc_lock);
+-                      backbone_crc = claim->backbone_gw->crc;
+-                      spin_unlock_bh(&claim->backbone_gw->crc_lock);
++                      spin_lock_bh(&backbone_gw->crc_lock);
++                      backbone_crc = backbone_gw->crc;
++                      spin_unlock_bh(&backbone_gw->crc_lock);
+                       seq_printf(seq, " * %pM on %5d by %pM [%c] (%#.4x)\n",
+                                  claim->addr, BATADV_PRINT_VID(claim->vid),
+-                                 claim->backbone_gw->orig,
++                                 backbone_gw->orig,
+                                  (is_own ? 'x' : ' '),
+                                  backbone_crc);
++
++                      batadv_backbone_gw_put(backbone_gw);
+               }
+               rcu_read_unlock();
+       }
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
+index d75beef..41a85b5 100644
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -1034,6 +1034,7 @@ struct batadv_bla_backbone_gw {
+  * @addr: mac address of claimed non-mesh client
+  * @vid: vlan id this client was detected on
+  * @backbone_gw: pointer to backbone gw claiming this client
++ * @backbone_lock: lock protecting backbone_gw pointer
+  * @lasttime: last time we heard of claim (locals only)
+  * @hash_entry: hlist node for batadv_priv_bla::claim_hash
+  * @refcount: number of contexts the object is used
+@@ -1043,6 +1044,7 @@ struct batadv_bla_claim {
+       u8 addr[ETH_ALEN];
+       unsigned short vid;
+       struct batadv_bla_backbone_gw *backbone_gw;
++      spinlock_t backbone_lock; /* protects backbone_gw */
+       unsigned long lasttime;
+       struct hlist_node hash_entry;
+       struct rcu_head rcu;
diff --git a/batman-adv/patches/0020-batman-adv-Fix-reference-leak-in-batadv_find_router.patch b/batman-adv/patches/0020-batman-adv-Fix-reference-leak-in-batadv_find_router.patch
new file mode 100644 (file)
index 0000000..38956cf
--- /dev/null
@@ -0,0 +1,120 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 30 Jun 2016 20:11:34 +0200
+Subject: [PATCH] batman-adv: Fix reference leak in batadv_find_router
+
+The replacement of last_bonding_candidate in batadv_orig_node has to be an
+atomic operation. Otherwise it is possible that the reference counter of a
+batadv_orig_ifinfo is reduced which was no longer the
+last_bonding_candidate when the new candidate is added. This can either
+lead to an invalid memory access or to reference leaks which make it
+impossible to an interface which was added to batman-adv.
+
+Fixes: 797edd9e87ac ("batman-adv: add bonding again")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/6ecc711374afd93ee0c2216b38ae52d3ce680c3f
+---
+ net/batman-adv/routing.c | 52 ++++++++++++++++++++++++++++++++++++------------
+ net/batman-adv/types.h   |  4 +++-
+ 2 files changed, 42 insertions(+), 14 deletions(-)
+
+diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
+index 27e07dd..694dc74 100644
+--- a/net/batman-adv/routing.c
++++ b/net/batman-adv/routing.c
+@@ -456,6 +456,29 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
+ }
+ /**
++ * batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node
++ * @orig_node: originator node whose bonding candidates should be replaced
++ * @new_candidate: new bonding candidate or NULL
++ */
++static void
++batadv_last_bonding_replace(struct batadv_orig_node *orig_node,
++                          struct batadv_orig_ifinfo *new_candidate)
++{
++      struct batadv_orig_ifinfo *old_candidate;
++
++      spin_lock_bh(&orig_node->neigh_list_lock);
++      old_candidate = orig_node->last_bonding_candidate;
++
++      if (new_candidate)
++              kref_get(&new_candidate->refcount);
++      orig_node->last_bonding_candidate = new_candidate;
++      spin_unlock_bh(&orig_node->neigh_list_lock);
++
++      if (old_candidate)
++              batadv_orig_ifinfo_put(old_candidate);
++}
++
++/**
+  * batadv_find_router - find a suitable router for this originator
+  * @bat_priv: the bat priv with all the soft interface information
+  * @orig_node: the destination node
+@@ -562,10 +585,6 @@ next:
+       }
+       rcu_read_unlock();
+-      /* last_bonding_candidate is reset below, remove the old reference. */
+-      if (orig_node->last_bonding_candidate)
+-              batadv_orig_ifinfo_put(orig_node->last_bonding_candidate);
+-
+       /* After finding candidates, handle the three cases:
+        * 1) there is a next candidate, use that
+        * 2) there is no next candidate, use the first of the list
+@@ -574,21 +593,28 @@ next:
+       if (next_candidate) {
+               batadv_neigh_node_put(router);
+-              /* remove references to first candidate, we don't need it. */
+-              if (first_candidate) {
+-                      batadv_neigh_node_put(first_candidate_router);
+-                      batadv_orig_ifinfo_put(first_candidate);
+-              }
++              kref_get(&next_candidate_router->refcount);
+               router = next_candidate_router;
+-              orig_node->last_bonding_candidate = next_candidate;
++              batadv_last_bonding_replace(orig_node, next_candidate);
+       } else if (first_candidate) {
+               batadv_neigh_node_put(router);
+-              /* refcounting has already been done in the loop above. */
++              kref_get(&first_candidate_router->refcount);
+               router = first_candidate_router;
+-              orig_node->last_bonding_candidate = first_candidate;
++              batadv_last_bonding_replace(orig_node, first_candidate);
+       } else {
+-              orig_node->last_bonding_candidate = NULL;
++              batadv_last_bonding_replace(orig_node, NULL);
++      }
++
++      /* cleanup of candidates */
++      if (first_candidate) {
++              batadv_neigh_node_put(first_candidate_router);
++              batadv_orig_ifinfo_put(first_candidate);
++      }
++
++      if (next_candidate) {
++              batadv_neigh_node_put(next_candidate_router);
++              batadv_orig_ifinfo_put(next_candidate);
+       }
+       return router;
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
+index 41a85b5..c143649 100644
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -330,7 +330,9 @@ struct batadv_orig_node {
+       DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
+       u32 last_bcast_seqno;
+       struct hlist_head neigh_list;
+-      /* neigh_list_lock protects: neigh_list and router */
++      /* neigh_list_lock protects: neigh_list, ifinfo_list,
++       * last_bonding_candidate and router
++       */
+       spinlock_t neigh_list_lock;
+       struct hlist_node hash_entry;
+       struct batadv_priv *bat_priv;
diff --git a/batman-adv/patches/0021-batman-adv-Free-last_bonding_candidate-on-release-of.patch b/batman-adv/patches/0021-batman-adv-Free-last_bonding_candidate-on-release-of.patch
new file mode 100644 (file)
index 0000000..b35a801
--- /dev/null
@@ -0,0 +1,45 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 30 Jun 2016 21:41:13 +0200
+Subject: [PATCH] batman-adv: Free last_bonding_candidate on release of orig_node
+
+The orig_ifinfo reference counter for last_bonding_candidate in
+batadv_orig_node has to be reduced when an originator node is released.
+Otherwise the orig_ifinfo is leaked and the reference counter the netdevice
+is not reduced correctly.
+
+Fixes: 797edd9e87ac ("batman-adv: add bonding again")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/20df5c53865a90095099f0af80536b8abfea303b
+---
+ net/batman-adv/originator.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
+index 3a3948a..7594afd 100644
+--- a/net/batman-adv/originator.c
++++ b/net/batman-adv/originator.c
+@@ -782,6 +782,7 @@ static void batadv_orig_node_release(struct kref *ref)
+       struct batadv_orig_node *orig_node;
+       struct batadv_orig_ifinfo *orig_ifinfo;
+       struct batadv_orig_node_vlan *vlan;
++      struct batadv_orig_ifinfo *last_candidate;
+       orig_node = container_of(ref, struct batadv_orig_node, refcount);
+@@ -799,8 +800,14 @@ static void batadv_orig_node_release(struct kref *ref)
+               hlist_del_rcu(&orig_ifinfo->list);
+               batadv_orig_ifinfo_put(orig_ifinfo);
+       }
++
++      last_candidate = orig_node->last_bonding_candidate;
++      orig_node->last_bonding_candidate = NULL;
+       spin_unlock_bh(&orig_node->neigh_list_lock);
++      if (last_candidate)
++              batadv_orig_ifinfo_put(last_candidate);
++
+       spin_lock_bh(&orig_node->vlan_list_lock);
+       hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) {
+               hlist_del_rcu(&vlan->list);
diff --git a/batman-adv/patches/0022-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch b/batman-adv/patches/0022-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch
new file mode 100644 (file)
index 0000000..fa61a1b
--- /dev/null
@@ -0,0 +1,35 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sun, 12 Jun 2016 10:43:19 +0200
+Subject: [PATCH] batman-adv: Fix speedy join in gateway client mode
+
+Speedy join only works when the received packet is either broadcast or an
+4addr unicast packet. Thus packets converted from broadcast to unicast via
+the gateway handling code have to be converted to 4addr packets to allow
+the receiving gateway server to add the sender address as temporary entry
+to the translation table.
+
+Not doing it will make the batman-adv gateway server drop the DHCP response
+in many situations because it doesn't yet have the TT entry for the
+destination of the DHCP response.
+
+Fixes: 9cbc67d9da47 ("batman-adv: change interface_rx to get orig node")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+---
+ net/batman-adv/send.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
+index 7641785..e5be212 100644
+--- a/net/batman-adv/send.c
++++ b/net/batman-adv/send.c
+@@ -423,8 +423,8 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
+       struct batadv_orig_node *orig_node;
+       orig_node = batadv_gw_get_selected_orig(bat_priv);
+-      return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
+-                                     orig_node, vid);
++      return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST_4ADDR,
++                                     BATADV_P_DATA, orig_node, vid);
+ }
+ void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface)
diff --git a/bmx7/Makefile b/bmx7/Makefile
new file mode 100644 (file)
index 0000000..e1eb36b
--- /dev/null
@@ -0,0 +1,191 @@
+#    Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    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, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#    The full GNU General Public License is included in this distribution in
+#    the file called "COPYING".
+#
+# Contibutors:
+#      Axel Neumann, Simó Albert i Beltran, Pau Escrich
+#
+
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bmx7
+
+PKG_SOURCE_PROTO:=git
+
+#PKG_SOURCE_URL:=git://bmx6.net/bmx6.git
+PKG_SOURCE_URL:=git://github.com/axn/bmx6.git
+#PKG_SOURCE_URL:=file:///usr/src/bmx6/bmx6.git
+
+PKG_REV:=379110ae442f80755b5788c527e722f9551b14eb
+PKG_VERSION:=r2016072001
+PKG_RELEASE:=4
+PKG_LICENSE:=GPL-2.0
+
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+MAKE_ARGS += \
+        EXTRA_CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/usr/include -DCRYPTLIB=POLARSSL_1_3_4 -DCORE_LIMIT=20000 -DTRAFFIC_DUMP -DNO_TRACE_FUNCTION_CALLS -DBMX7_LIB_IWINFO" \
+        EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib -liwinfo" \
+        GIT_REV="$(PKG_REV)" \
+        CC="$(TARGET_CC)" \
+        INSTALL_DIR="$(PKG_INSTALL_DIR)" \
+        build_all
+
+define Package/bmx7/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  TITLE:=BMX7 layer 3 routing daemon
+  URL:=http://bmx6.net/
+  MAINTAINER:=Axel Neumann <neumann@cgws.de>
+  DEPENDS:=+zlib +libpolarssl +libiwinfo
+endef
+
+define Package/bmx7/description
+BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing
+endef
+
+define Package/bmx7
+  $(call Package/bmx7/Default)
+  MENU:=1
+endef
+
+define Package/bmx7-uci-config
+  $(call Package/bmx7/Default)
+  DEPENDS:=bmx7 +libuci
+  TITLE:=configuration plugin based on uci (recommended!)
+endef
+
+define Package/bmx7-iwinfo
+  $(call Package/bmx7/Default)
+  DEPENDS:=bmx7 +libiwinfo
+  TITLE:=link characteristics plugin based on libiwinfo (recommended!)
+endef
+
+define Package/bmx7-topology
+  $(call Package/bmx7/Default)
+  DEPENDS:=bmx7
+  TITLE:=topology plugin
+endef
+
+define Package/bmx7-json
+  $(call Package/bmx7/Default)
+  DEPENDS:=bmx7 +libjson-c
+  TITLE:=json plugin based on json-c
+endef
+
+define Package/bmx7-sms
+  $(call Package/bmx7/Default)
+  DEPENDS:=bmx7
+  TITLE:=sms plugin
+endef
+
+define Package/bmx7-tun
+  $(call Package/bmx7/Default)
+  DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun
+  TITLE:=ipip-based tunnel plugin (recommended!)
+endef
+
+define Package/bmx7-table
+  $(call Package/bmx7/Default)
+  DEPENDS:=bmx7 +bmx7-tun
+  TITLE:=plugin to announce routes from tables via tunnels
+endef
+
+define Build/Configure
+       mkdir -p $(PKG_INSTALL_DIR)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
+endef
+
+define Package/bmx7/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bmx7 $(1)/usr/sbin/bmx7
+endef
+
+define Package/bmx7/postinst
+#!/bin/sh
+# # check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       if [ -f /etc/sysupgrade.conf ] && ! grep bmx7 /etc/sysupgrade.conf; then
+               echo /etc/bmx7 >> /etc/sysupgrade.conf
+        fi
+fi
+endef
+
+
+define Package/bmx7-uci-config/conffiles
+/etc/config/bmx7
+endef
+
+define Package/bmx7-uci-config/install
+       $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_uci_config/bmx7_config.so $(1)/usr/lib/bmx7_config.so
+       $(INSTALL_BIN) ./files/etc/init.d/bmx7 $(1)/etc/init.d/bmx7
+       $(INSTALL_DATA) ./files/etc/config/bmx7 $(1)/etc/config/bmx7
+endef
+
+define Package/bmx7-iwinfo/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_iwinfo/bmx7_iwinfo.so $(1)/usr/lib/bmx7_iwinfo.so
+endef
+
+define Package/bmx7-topology/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_topology/bmx7_topology.so $(1)/usr/lib/bmx7_topology.so
+endef
+
+define Package/bmx7-json/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_json/bmx7_json.so $(1)/usr/lib/bmx7_json.so
+endef
+
+define Package/bmx7-sms/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_sms/bmx7_sms.so $(1)/usr/lib/bmx7_sms.so
+endef
+
+define Package/bmx7-tun/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_tun/bmx7_tun.so $(1)/usr/lib/bmx7_tun.so
+endef
+
+define Package/bmx7-table/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_table/bmx7_table.so $(1)/usr/lib/bmx7_table.so
+endef
+
+
+$(eval $(call BuildPackage,bmx7))
+$(eval $(call BuildPackage,bmx7-uci-config))
+$(eval $(call BuildPackage,bmx7-iwinfo))
+$(eval $(call BuildPackage,bmx7-topology))
+$(eval $(call BuildPackage,bmx7-json))
+$(eval $(call BuildPackage,bmx7-sms))
+$(eval $(call BuildPackage,bmx7-table))
+$(eval $(call BuildPackage,bmx7-tun))
diff --git a/bmx7/files/etc/config/bmx7 b/bmx7/files/etc/config/bmx7
new file mode 100644 (file)
index 0000000..b92f525
--- /dev/null
@@ -0,0 +1,57 @@
+
+# for more information:
+# http://bmx6.net/projects/bmx6/wiki
+# options execute: bmx7 --help
+
+config 'bmx7' 'general'
+#       option 'runtimeDir' '/var/run/bmx7'
+#      option 'trustedNodesDir' '/etc/bmx7/trustedNodes'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_config.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_json.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_sms.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_iwinfo.so'
+
+
+config 'dev' 'mesh_1'
+        option 'dev' 'br-lan'
+
+config 'dev' 'mesh_2'
+        option 'dev' 'wlan0'
+
+
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_tun.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_table.so'
+
+
+#config 'tunDev' default
+#        option 'tunDev' 'default'
+#        option 'tun6Address' '2012:0:0:6666::1/64'
+#        option 'tun4Address' '10.66.66.1/24'
+
+
+#config 'tunOut'
+#        option 'tunOut' 'ip6'
+#        option 'network' '2012::/16'
+#        option 'exportDistance' '0'
+
+#config 'tunOut'
+#        option 'tunOut' 'ip4'
+#        option 'network' '10.0.0.0/9'
+#        option 'minPrefixLen' '27'
+
+
+
+
+
diff --git a/bmx7/files/etc/init.d/bmx7 b/bmx7/files/etc/init.d/bmx7
new file mode 100755 (executable)
index 0000000..6886739
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh /etc/rc.common
+#    Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    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, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#    The full GNU General Public License is included in this distribution in
+#    the file called "COPYING".
+
+START=91
+
+BIN=/usr/sbin/bmx7
+CONF=/etc/config/bmx7
+PID=/var/run/bmx7/pid
+
+
+start() {
+       cd /root/
+       while pgrep -f mac80211.sh ; do sleep 1; done
+       ulimit -c 20000
+       $BIN -f $CONF -d0 > /dev/null &
+}
+
+stop() {
+       start-stop-daemon -p $PID -K
+}
+
+restart() {
+       stop; sleep 3; start
+}
diff --git a/bmx7/patches/001-json-c.patch b/bmx7/patches/001-json-c.patch
new file mode 100644 (file)
index 0000000..794bd9e
--- /dev/null
@@ -0,0 +1,13 @@
+Index: bmx7-r2014112401/lib/bmx7_json/json.c
+===================================================================
+--- bmx7-r2014112401.orig/lib/bmx7_json/json.c
++++ bmx7-r2014112401/lib/bmx7_json/json.c
+@@ -27,7 +27,7 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdint.h>
+-#include <json/json.h>
++#include <json-c/json.h>
+ //#include <dirent.h>
+ //#include <sys/inotify.h>
index dbf1c21f1b9ba17bac6bf7a0896cfd960b0af1e3..ea8860904e50a0026869a83b6fde662c1d3b1813 100644 (file)
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cjdns
-PKG_VERSION:=0.16
-PKG_RELEASE:=14
+PKG_VERSION:=0.17
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=https://github.com/hyperboria/cjdns.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=a97c189b9181bf83ed44a9ab0ebc817882c60ffa
+PKG_SOURCE_VERSION:=40e87d9419c19063e772e39c7c59a8a8771c5ee8
 PKG_LICENSE:=GPL-3.0
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
@@ -52,7 +52,7 @@ endef
 define Build/Configure
 endef
 
-PKG_DO_VARS:=
+PKG_DO_VARS:=CJDNS_RELEASE_VERSION=$(PKG_SOURCE_VERSION)
 
 ifneq ($(CONFIG_KERNEL_SECCOMP_FILTER),y)
 PKG_DO_VARS+= Seccomp_NO=1
index b9fe82558f91c4e1981f02f6154b178d786127e6..15b85cc33fd359aa6e0d2d528b86a37dfea81fc7 100644 (file)
@@ -7,8 +7,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hnetd
-PKG_SOURCE_VERSION:=ea2bd2bc2d8e617efca4b27fbf1c5c3c8ad09ad9
-PKG_VERSION:=2015-07-10-$(PKG_SOURCE_VERSION)
+PKG_SOURCE_VERSION:=9ab71adbf0a7ad2a0964e48641b19b016b37df16
+PKG_VERSION:=2016-05-17-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
index 6ac396f769a99922e50e3a2c49369071004a671d..2213b73034a55a030dbb220b21b9c27d9a01e1a4 100644 (file)
@@ -13,7 +13,7 @@ config pa pa
 #      option ip4prefix 10.0.0.0/8
 #      option ulaprefix fd12:3456:789A::/48
 #      option ulamode off
-#      option persistent_store /etc/hnet-pa.store
+       option persistent_store /etc/hnet-pa.store
 
 config sd sd
 #      option router_name openwrt
index dfe9ab1f393453fee018bd88f044bbe1719ee946..a4a8e438ef5d63acafb2458f18ffc1afbdee8f8e 100644 (file)
@@ -112,12 +112,16 @@ function wget(url, timeout)
        if pid == 0 then
                rfd:close()
                nixio.dup(wfd, nixio.stdout)
-
-               local candidates = { "/usr/bin/wget", "/bin/wget" }
+               -- candidates for wget, try first ones with SSL support
+               local candidates = {{"/usr/bin/wget-ssl",1},{"/usr/bin/wget",0},{"/bin/wget",0}}
                local _, bin
                for _, bin in ipairs(candidates) do
-                       if nixiofs.access(bin, "x") then
-                               nixio.exec(bin, "-q", "-O", "-", url)
+                       if nixiofs.access(bin[1], "x") then
+                               if bin[2] == 0 then
+                                       nixio.exec(bin[1], "-q", "-O", "-", url)
+                               else
+                                       nixio.exec(bin[1], "--no-check-certificate", "-q", "-O", "-", url)
+                               end
                        end
                end
                return
diff --git a/luci-app-bmx7/COPYING b/luci-app-bmx7/COPYING
new file mode 100644 (file)
index 0000000..d511905
--- /dev/null
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/luci-app-bmx7/Makefile b/luci-app-bmx7/Makefile
new file mode 100644 (file)
index 0000000..a9e96f7
--- /dev/null
@@ -0,0 +1,63 @@
+#    Copyright © 2011 Pau Escrich <pau@dabax.net>
+#    Contributors Roger Pueyo Centelles <roger.pueyo@guifi.net>
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    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, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#    The full GNU General Public License is included in this distribution in
+#    the file called "COPYING".
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luci-app-bmx7
+PKG_RELEASE:=0.0-alpha
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+PKG_LICENSE:=GPL-2.0+
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luci-app-bmx7
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=3. Applications
+  TITLE:= LuCI support for BMX7
+  DEPENDS:=+luci-lib-json +luci-mod-admin-full +luci-lib-httpclient +bmx7
+  MAINTAINER:= Roger Pueyo Centelles <roger.pueyo@guifi.net>
+endef
+
+define Package/luci-app-bmx7/description
+       LuCI application for web-based configuration and visualization of the BMX7 routing daemon
+endef
+
+define Package/luci-app-bmx7/conffiles
+       /etc/config/luci-bmx7
+endef
+
+define Build/Prepare
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/luci-app-bmx7/install
+       $(CP) ./files/* $(1)/
+       chmod 755 $(1)/www/cgi-bin/bmx7-info
+endef
+
+$(eval $(call BuildPackage,luci-app-bmx7))
+
diff --git a/luci-app-bmx7/files/etc/config/luci-bmx7 b/luci-app-bmx7/files/etc/config/luci-bmx7
new file mode 100644 (file)
index 0000000..46a7727
--- /dev/null
@@ -0,0 +1,7 @@
+config 'bmx7' 'luci'
+       option ignore '0'
+       option place 'admin network BMX7'
+       #option place 'qmp Mesh'
+       option position '3'
+       #option json 'http://127.0.0.1/cgi-bin/bmx7-info?'
+       option json 'exec:/www/cgi-bin/bmx7-info -s'
diff --git a/luci-app-bmx7/files/usr/lib/lua/luci/controller/bmx7.lua b/luci-app-bmx7/files/usr/lib/lua/luci/controller/bmx7.lua
new file mode 100644 (file)
index 0000000..ed62628
--- /dev/null
@@ -0,0 +1,77 @@
+--[[
+    Copyright (C) 2011 Pau Escrich <pau@dabax.net>
+    Contributors Jo-Philipp Wich <xm@subsignal.org>
+                 Roger Pueyo Centelles <roger.pueyo@guifi.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+    The full GNU General Public License is included in this distribution in
+    the file called "COPYING".
+--]]
+
+module("luci.controller.bmx7", package.seeall)
+
+function index()
+       local place = {}
+       local ucim = require "luci.model.uci"
+       local uci = ucim.cursor()
+
+       -- checking if ignore is on
+       if uci:get("luci-bmx7","luci","ignore") == "1" then
+               return nil
+       end
+
+       -- getting value from uci database
+       local uci_place = uci:get("luci-bmx7","luci","place")
+
+       -- default values
+       if uci_place == nil then
+               place = {"bmx7"}
+       else
+               local util = require "luci.util"
+               place = util.split(uci_place," ")
+       end
+
+       -- getting position of menu
+       local uci_position = uci:get("luci-bmx7","luci","position")
+
+
+       ---------------------------
+       -- Placing the pages in the menu
+       ---------------------------
+
+       -- Status (default)
+       entry(place,call("action_status_j"),place[#place],tonumber(uci_position))
+
+       table.insert(place,"Status")
+       entry(place,call("action_status_j"),"Status",0)
+       table.remove(place)
+
+       -- Nodes list
+       table.insert(place,"Nodes")
+       entry(place,call("action_nodes_j"),"Nodes",1)
+       table.remove(place)
+end
+
+
+function action_status_j()
+       luci.template.render("bmx7/status_j", {})
+end
+
+function action_nodes_j()
+       local http = require "luci.http"
+       local link_non_js = "/cgi-bin/luci" .. http.getenv("PATH_INFO") .. '/nodes_nojs'
+       luci.template.render("bmx7/nodes_j", {link_non_js=link_non_js})
+end
diff --git a/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/nodes_j.htm b/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/nodes_j.htm
new file mode 100644 (file)
index 0000000..347af42
--- /dev/null
@@ -0,0 +1,175 @@
+<%#
+   Copyright © 2011 Pau Escrich <pau@dabax.net>
+   Contributors Lluis Esquerda <eskerda@gmail.com>
+                Roger Pueyo Centelles <roger.pueyo@guifi.net>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   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, write to the Free Software Foundation, Inc.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+   The full GNU General Public License is included in this distribution in
+   the file called "COPYING".
+-%>
+
+<%+header%>
+<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
+
+
+<style>
+
+       div.hideme{
+               display: none;
+       }
+
+       div.info{
+               background: #FFF;
+               border: solid 0px;
+               height: 90px;
+               display: block;
+               overflow: auto;
+       }
+
+       div.inforow{
+               text-align:left;
+               display:inline-block;
+               margin:10px;
+               vertical-align:top;
+               float: left;
+               white-space:nowrap;
+       }
+
+       div.inforow.newline{
+               clear: both;
+       }
+
+       u {
+    text-decoration: underline;
+       } 
+
+#extra-info ul { list-style: none outside none; margin-left: 0em; }
+
+</style>
+<div class="cbi-map">
+
+<h2>Mesh nodes</h2>
+<div class="cbi-map-descr"></div>
+<div id="extra-info" class="info">
+       <br />
+       <center>
+       Tip: click the <img src="<%=resource%>/bmx7/world.png" /> icon to see individual node information.
+       </center>
+</div>
+<fieldset class="cbi-section">
+       <legend><%:Originators%></legend>
+       <table class="cbi-section-table" id="descriptions_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"></th>
+                       <th class="cbi-section-table-cell"><%:Name%></th>
+                       <th class="cbi-section-table-cell"><%:Short ID%></th>
+                       <th class="cbi-section-table-cell"><%:S/s/T/t%></th>
+                       <th class="cbi-section-table-cell"><%:Primary IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Via neighbour%></th>
+                       <th class="cbi-section-table-cell"><%:Metric%></th>
+                       <th class="cbi-section-table-cell"><%:Last desc.%></th>
+                       <th class="cbi-section-table-cell"><%:Last ref.%></th>
+                       <th class="cbi-section-table-cell"><%: %></th>
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="11"><br /><center><em><%:Collecting data...%></em></center></td>
+               </tr>
+       </table>
+</fieldset>
+
+</div>
+
+<script type="text/javascript">//<![CDATA[
+               var displayExtraInfo = function ( id ) {
+                       console.log('aaa'+id)
+                       document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
+               }
+
+               new TablePooler(5,"/cgi-bin/bmx7-info", {'$originators':''}, "descriptions_table", function(st){
+                       var infoicon = "<%=resource%>/bmx7/world_small.png";
+                       var originators = st.originators;
+                       var res = Array();
+
+                       originators.forEach(function(originator,i){
+                               var name =  originator.name;
+                               var shortId =  originator.shortId;
+                               var nodeId = originator.nodeId;
+                               var extensions = originator.name;
+                               var SsTt = originator.S+'/'+originator.s+'/'+originator.T+'/'+originator.t;
+                               var nodeKey = originator.nodeKey;
+                               var descSize = originator.descSize;
+                               var primaryIp = originator.primaryIp;
+                               var nbName = originator.nbName;
+                               var dev = originator.dev;
+                               var nbLocalIp = originator.nbLocalIp;
+                               var metric = originator.metric;
+                               var lastDesc = originator.lastDesc;
+                               var lastRef = originator.lastRef;
+                               
+                       var extrainfo = '<a onclick="displayExtraInfo(\'ip-' + i + '\')"><img src="' + infoicon + '" / ></a>';
+                       var extrainfo_link = '<a onclick="displayExtraInfo(\'ip-' + i + '\')">' +  '<img src="' + infoicon + '" />' + '</a>';
+       
+                       extrainfo = '<div id="ip-'+ i +'" class="hideme">'
+
+                       + "<div class='inforow'>"
+                       + "<h4><u>" + name  + '</u></h4>\n'
+                       + 'Node ID: ' + nodeId + "</div>"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Primary IPv6 address</h5>\n"
+                       + primaryIp + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Support & Trust</h5>\n"
+                       + SsTt + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Node key</h5>\n"
+                       + nodeKey + "</div>\n"
+
+                       + "<div class='inforow newline'>"
+                       + "<h5>Via neighbour</h5>\n"
+                       + nbName + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Via device</h5>\n"
+                       + dev + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Via remote link-local IPv6 address</h5>\n"
+                       + nbLocalIp + "</div>\n"
+                       
+                       + "<div class='inforow'>"
+                       + "<h5>Route metric</h5>\n"
+                       + metric + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Desc. size</h5>\n"
+                       + descSize + "</div>\n"
+
+                       + "\n</div>";
+
+                       res.push([extrainfo_link, name, shortId, SsTt, primaryIp,
+                                                               nbName, metric, lastDesc, lastRef, extrainfo]);
+
+                 });
+                 return res;
+               });
+//]]></script>
+
+<%+footer%>
+
diff --git a/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/status_j.htm b/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/status_j.htm
new file mode 100644 (file)
index 0000000..c6920f9
--- /dev/null
@@ -0,0 +1,182 @@
+<%+header%>
+<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
+
+<style>
+       div.hideme{
+               display: none;
+       }
+
+       div.info{
+               background: #FFF;
+               border: solid 1px;
+               height: 80px;
+               display: block;
+               overflow: auto;
+       }
+
+       div.inforow{
+               text-align:left;
+               display:inline-block;
+               width:20%;
+               margin:5px;
+               vertical-align:top;
+       }
+
+       #extra-info ul { list-style: none outside none; margin-left: 0em; }
+</style>
+
+<div class="cbi-map">
+       <center>
+               <img src="<%=resource%>/bmx7/bmx7logo.png" />
+               <br />
+               <br />
+               A mesh routing protocol for Linux devices.<br />
+               Visit <a href="http://bmx6.net">bmx6.net</a> for more information.<br />
+               <br />
+       </center>
+
+<div class="cbi-map-descr"></div>
+
+<fieldset class="cbi-section">
+       <legend><%:Node configuration%></legend>
+       <table class="cbi-section-table" id="config_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Short ID%></th>
+                       <th class="cbi-section-table-cell"><%:Node name%></th>
+                       <th class="cbi-section-table-cell"><%:Primary IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Node key%></th>
+                       <th class="cbi-section-table-cell"><%:BMX7 revision%></th>
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="5"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <legend><%:Node status%></legend>
+       <table class="cbi-section-table" id="status_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Nodes seen%></th>
+                       <th class="cbi-section-table-cell"><%:Neighbours%></th>
+                       <th class="cbi-section-table-cell"><%:Tunnelled IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Tunnelled IPv4 address%></th>
+                       <th class="cbi-section-table-cell"><%:Uptime%></th>
+                       <th class="cbi-section-table-cell"><%:CPU usage%></th>
+                       <th class="cbi-section-table-cell"><%:Memory usage%></th>
+                       <th class="cbi-section-table-cell"><%:Tx queue%></th>
+
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="8"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <legend><%:Interfaces%></legend>
+       <table class="cbi-section-table" id="ifaces_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Interface%></th>
+                       <th class="cbi-section-table-cell"><%:State%></th>
+                       <th class="cbi-section-table-cell"><%:Type%></th>
+                       <th class="cbi-section-table-cell"><%:Max. rate%></th>
+                       <th class="cbi-section-table-cell"><%:Link-local IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Rx BpP%></th>
+                       <th class="cbi-section-table-cell"><%:Tx BpP%></th>
+
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="7"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <legend><%:Links%></legend>
+       <table class="cbi-section-table" id="links_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Short ID%></th>
+                       <th class="cbi-section-table-cell"><%:Name%></th>
+                       <th class="cbi-section-table-cell"><%:Link key%></th>
+                       <th class="cbi-section-table-cell"><%:Remote link-local IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Device%></th>
+                       <th class="cbi-section-table-cell"><%:Rx rate%></th>
+                       <th class="cbi-section-table-cell"><%:Tx rate%></th>
+                       <th class="cbi-section-table-cell"><%:Routes%></th>
+
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="8"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+
+</div>
+
+<script type="text/javascript">//<![CDATA[
+       new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "config_table", function(st){
+               var res = Array();
+               var sta = st.info[0].status;
+               var ifaces = st.info[1].interfaces;
+
+               res.push([sta.shortId, sta.name, sta.primaryIp, sta.nodeKey, sta.revision]);
+               res.push(['','','','',''])
+               res.push(['','','','',''])
+
+               return res;
+       });
+
+
+       new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "status_table", function(st){
+               var res = Array();
+               var sta = st.info[0].status;
+               var mem = st.info[3].memory;
+
+               var txQ = sta.txQ.split('/');
+               console.log(txQ)
+
+               var ptxQ = '<p style="color:rgb('+parseInt(255*txQ[0]/txQ[1])+','+parseInt(128*(txQ[1]-txQ[0])/txQ[1])+',0)")>'+sta.txQ+'</p>';
+               console.log(ptxQ)
+
+               res.push([sta.nodes, sta.nbs, sta.tun6Address, sta.tun4Address, sta.uptime, sta.cpu, mem.bmx7, ptxQ]);
+
+               res.push(['','','','','','','',''])
+               res.push(['','','','','','','',''])
+
+               return res;
+       });
+
+               new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "ifaces_table", function(st){
+               var res = Array();
+               var sta = st.info[0].status;
+               var ifaces = st.info[1].interfaces;
+
+               ifaces.forEach(function(iface){
+                       res.push([iface.dev, iface.state, iface.type, iface.rateMax, iface.localIp, iface.rxBpP, iface.txBpP]);
+               });
+               res.push(['','','','','','',''])
+               if (ifaces.length % 2 == 0)
+                       res.push('')
+               res.push(['','','','','','',''])
+               return res;
+       });
+
+               new TablePooler(1,"/cgi-bin/bmx7-info", {'links':''}, "links_table", function(st){
+               var res = Array();
+               links = st.links;
+
+               links.forEach(function(link){
+                       res.push([link.shortId, link.name, link.linkKey, link.nbLocalIp, link.dev, link.rxRate, link.txRate, link.routes]);
+               });
+               res.push(['','','','','','','',''])
+               if (links.length % 2 == 0)
+                       res.push([])
+               res.push(['','','','','','','',''])
+               return res;
+       });
+//]]></script>
+
+<%+footer%>
diff --git a/luci-app-bmx7/files/www/cgi-bin/bmx7-info b/luci-app-bmx7/files/www/cgi-bin/bmx7-info
new file mode 100755 (executable)
index 0000000..8c501c5
--- /dev/null
@@ -0,0 +1,136 @@
+#!/bin/sh
+#    Copyright © 2011 Pau Escrich
+#    Contributors Jo-Philipp Wich <xm@subsignal.org>
+#                 Roger Pueyo Centelles <roger.pueyo@guifi.net>
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    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, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#    The full GNU General Public License is included in this distribution in
+#    the file called "COPYING".
+#
+#    This script gives information about bmx7
+#    Can be executed from a linux shell: ./bmx7-info -s links
+#    Or from web interfae (with cgi enabled): http://host/cgi-bin/bmx7-info?links
+#    If you ask for a directory you wil get the directory contents in JSON forman
+
+BMX7_DIR="$(uci get bmx7.general.runtimeDir 2>/dev/null)" || BMX7_DIR="/var/run/bmx7/json"
+
+#Checking if shell mode or cgi-bin mode
+if [ "$1" == "-s" ]; then
+       QUERY="$2"
+else
+       QUERY="${QUERY_STRING%%=*}"
+       echo "Content-type: application/json"
+       echo ""
+
+fi
+
+check_path() {
+        [ -d "$1" ] && path=$(cd $1; pwd)
+        [ -f "$1" ] && path=$(cd $1/..; pwd)
+        [ $(echo "$path" | grep -c "^$BMX7_DIR") -ne 1 ] && exit 1
+}
+
+print_mem() {
+       echo -n '{ "memory": { "bmx7": "'
+       cat /proc/$(cat /var/run/bmx7/pid)/status |grep -i VmSize | tr -s " " | cut -d " " -f 2,3 | tr -d "\n"
+       echo '"}}'
+}
+
+print_query() {
+       # If the query is a directory
+       [ -d "$BMX7_DIR/$1" ] &&
+        {
+       # If /all has not been specified
+               [ -z "$QALL" ] &&
+               {
+               total=$(ls $BMX7_DIR/$1 | wc -w)
+               i=1
+               echo -n "{ \"$1\": [ "
+               for f in $(ls $BMX7_DIR/$1); do
+                       echo -n "{ \"name\": \"$f\" }"
+                       [ $i -lt $total ]  && echo -n ','
+                       i=$(( $i + 1 ))
+               done
+               echo -n " ] }"
+
+       # If /all has been specified, printing all the files together
+               } || {
+               comma=""
+               echo -n "[ "
+               for entry in "$BMX7_DIR/$1/"*; do
+                       [ -f "$entry" ] &&
+                       {
+                               ${comma:+echo "$comma"}
+                               tr -d '\n' < "$entry"
+                               comma=","
+                       }
+               done
+               echo -n " ]"
+               }
+        }
+
+       # If the query is a file, just printing the file
+       [ -f "$BMX7_DIR/$1" ] && cat "$BMX7_DIR/$1";
+}
+
+if [ "${QUERY##*/}" == "all" ]; then
+       QUERY="${QUERY%/all}"
+       QALL=1
+fi
+
+if [ "$QUERY" == '$info' ]; then
+       echo '{ "info": [ '
+       print_query status
+       echo -n ","
+       print_query interfaces
+       echo -n ","
+       print_query links
+       echo -n ","
+       print_mem
+       echo "] }"
+fi
+
+if [ "$QUERY" == '$neighbours' ]; then
+       QALL=1
+       echo '{ "neighbours": [ '
+       echo '{ "originators": '
+       print_query originators
+       echo '}, '
+       echo '{ "descriptions": '
+       print_query descriptions
+       echo "} ] }"
+       exit 0
+
+else if [ "$QUERY" == '$tunnels' ]; then
+       bmx7 -c --jshow tunnels /r=0
+       exit 0
+
+       else if [ "$QUERY" == '$originators' ]; then
+               bmx7 -c --jshow originators /r=0
+               exit 0
+
+               else
+               check_path "$BMX7_DIR/$QUERY"
+               print_query $QUERY
+               exit 0
+               fi
+       fi
+fi
+fi
+
+ls -1F "$BMX7_DIR"
+exit 0
+
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png b/luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png
new file mode 100644 (file)
index 0000000..c7d9cea
Binary files /dev/null and b/luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png differ
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/js/polling.js b/luci-app-bmx7/files/www/luci-static/resources/bmx7/js/polling.js
new file mode 100644 (file)
index 0000000..4a382eb
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+    Copyright © 2011 Pau Escrich <pau@dabax.net>
+    Contributors Lluis Esquerda <eskerda@gmail.com>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+    The full GNU General Public License is included in this distribution in
+    the file called "COPYING".
+*/
+
+
+/*
+       Table pooler is a function to easy call XHR poller. 
+
+       new TablePooler(5,"/cgi-bin/bmx7-info", {'status':''}, "status_table", function(st){
+               var table = Array()
+               table.push(st.first,st.second)
+               return table
+       }
+
+       The parameters are: 
+               polling_time: time between pollings
+               json_url: the json url to fetch the data
+               json_call: the json call
+               output_table_id: the table where javascript will put the data
+               callback_function: the function that will be executed each polling_time
+       
+       The callback_function must return an array of arrays (matrix).
+       In the code st is the data obtained from the json call
+*/
+
+function TablePooler (time, jsonurl, getparams, table_id, callback) {
+       this.table = document.getElementById(table_id);
+       this.callback = callback;
+       this.jsonurl = jsonurl;
+       this.getparams = getparams;
+       this.time = time;
+
+       /* clear all rows */
+       this.clear = function(){
+               while( this.table.rows.length > 1 ) this.table.deleteRow(1);
+       }
+
+       this.start = function(){
+               XHR.poll(this.time, this.jsonurl, this.getparams, function(x, st){
+                       var data = this.callback(st);
+                       var content, tr, td;
+                       this.clear();
+                       for (var i = 0; i < data.length; i++){
+                               tr = this.table.insertRow(-1);
+                               tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
+
+                               for (var j = 0; j < data[i].length; j++){
+                                       td = tr.insertCell(-1);
+                                       if (data[i][j].length == 2) {
+                                               td.colSpan = data[i][j][1];
+                                               content = data[i][j][0];
+                                       }
+                                       else content = data[i][j];
+                                       td.innerHTML = content;
+                               }
+                       }
+               }.bind(this));
+       }
+
+
+       this.start();
+}
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png
new file mode 100644 (file)
index 0000000..29b53c9
Binary files /dev/null and b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png differ
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png
new file mode 100644 (file)
index 0000000..f5f3105
Binary files /dev/null and b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png differ
index 18229267ef42e971c61adbd0a2c77f9137f00143..fbbcfee4828b713da549d6f4b0456db7afcbffae 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=miniupnpd
-PKG_VERSION:=1.9.20150609
+PKG_VERSION:=2.0
 PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=http://miniupnp.free.fr/files
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=01ee891286683891240a29b7272d790e
+PKG_MD5SUM:=1c07a215dd9b362e75a9efc05e2fb3b4
 
 PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi>
 PKG_LICENSE:=BSD-3-Clause
@@ -23,7 +23,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/miniupnpd
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables
+  DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables +libuuid
   TITLE:=Lightweight UPnP IGD, NAT-PMP & PCP daemon
   SUBMENU:=Firewall
   URL:=http://miniupnp.free.fr/
@@ -50,9 +50,10 @@ define Build/Prepare
 endef
 
 MAKE_FLAGS += \
-       TEST=0 \
+       TARGET_OPENWRT=1 TEST=0 \
        LIBS="" \
-       CC="$(TARGET_CC) -DIPTABLES_143 -lip4tc $(if $(CONFIG_IPV6),-lip6tc)" \
+       CC="$(TARGET_CC) -DIPTABLES_143 \
+               -lip4tc $(if $(CONFIG_IPV6),-lip6tc) -luuid" \
        CONFIG_OPTIONS="$(if $(CONFIG_IPV6),--ipv6) --leasefile" \
        -f Makefile.linux \
        miniupnpd
diff --git a/miniupnpd/patches/100-no-ssl.patch b/miniupnpd/patches/100-no-ssl.patch
deleted file mode 100644 (file)
index 343e615..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/Makefile.linux
-+++ b/Makefile.linux
-@@ -147,7 +147,8 @@ LDLIBS += $(shell $(PKG_CONFIG) --static
- LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
- endif # ($(TEST),1)
--LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
-+# n/a - we don't enable https server for IGD v2 anyway
-+#LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
- TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
diff --git a/miniupnpd/patches/101-no-ssl-uuid.patch b/miniupnpd/patches/101-no-ssl-uuid.patch
new file mode 100644 (file)
index 0000000..03a4966
--- /dev/null
@@ -0,0 +1,25 @@
+We do not need to autodetect SSL/UUID; SSL we do not support, UUID we always do.
+
+diff --git a/miniupnpd/Makefile.linux b/miniupnpd/Makefile.linux
+index 2d28126..01daeea 100644
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -153,14 +153,18 @@ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libmnl)
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
+ endif # ($(TEST),1)
++ifeq ($(TARGET_OPENWRT),)
++# n/a - we don't enable https server for IGD v2 anyway in OpenWrt
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
++# n/a - we hardcodedly support libuuid
+ TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1)
+ ifeq ($(TEST),1)
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l uuid)
+ else
+ $(info please install uuid-dev package / libuuid)
+ endif # ($(TEST),1)
++endif
+ TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
diff --git a/miniupnpd/patches/104-always-libuuid.patch b/miniupnpd/patches/104-always-libuuid.patch
new file mode 100644 (file)
index 0000000..d6c0770
--- /dev/null
@@ -0,0 +1,20 @@
+As it turns out, the 'magic' libuuid/bsd uuid check just checks
+outside buildtree altogether for the uuid_generate. So we just
+hardcode it.
+
+--- a/genconfig.sh
++++ b/genconfig.sh
+@@ -367,12 +367,7 @@ case $FW in
+ esac
+ # UUID API
+-if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then
+-      echo "#define BSD_UUID" >> ${CONFIGFILE}
+-fi
+-if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then
+-      echo "#define LIB_UUID" >> ${CONFIGFILE}
+-fi
++echo "#define LIB_UUID" >> ${CONFIGFILE}
+ # set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above
+ if [ -z "$V6SOCKETS_ARE_V6ONLY" ] ; then
index 1d968046a277a094a099c9408d480c307c0431d4..0302e49c352b0579cc9183e5825619b2532094dc 100644 (file)
@@ -7,8 +7,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ohybridproxy
-PKG_SOURCE_VERSION:=f2ba152799c481471ddc0213b3f98b1c143d97a3
-PKG_VERSION:=2015-01-12-$(PKG_SOURCE_VERSION)
+PKG_SOURCE_VERSION:=8a28ae92c97099e771c9ede5641e3782ae809c27
+PKG_VERSION:=2016-05-17-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
index 63e83e68e53a7637bb5f7c36b859317864c7a862..26b7de53bff7a474aea1c22257ebea31c7078f3a 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=olsrd
-PKG_VERSION:=0.9.0.2
-PKG_RELEASE:=3
+PKG_VERSION:=0.9.0.3
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.olsr.org/releases/0.9
 
-PKG_MD5SUM:=8a2675c33990706cc291b59934024783
+PKG_MD5SUM:=fa5cf15c29c7ebd9b8425267676c7865
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=BSD-3-Clause
 
index 5bee27a4394905a2e510755852a389f5c18c00e1..3ced9118197176adfb50ab7f855dcff9dd29c191 100644 (file)
@@ -8,7 +8,7 @@ SERVICE_WRITE_PID=1
 
 OLSRD_OLSRD_SCHEMA='ignore:internal config_file:internal DebugLevel=0 AllowNoInt=yes'
 OLSRD_IPCCONNECT_SCHEMA='ignore:internal Host:list Net:list2'
-OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host4:list Net4:list2 Host:list Net:list2 Host6:list Net6:list2 Ping:list redistribute:list NonOlsrIf:list name:list lat lon latlon_infile HNA:list2 hosts:list2'
+OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host4:list Net4:list2 Host:list Net:list2 Host6:list Net6:list2 Ping:list redistribute:list NonOlsrIf:list name:list lat lon latlon_infile HNA:list2 hosts:list2 ipv6only:bool'
 OLSRD_INTERFACE_SCHEMA='ignore:internal interface:internal AutoDetectChanges:bool LinkQualityMult:list2'
 OLSRD_INTERFACE_DEFAULTS_SCHEMA='AutoDetectChanges:bool'