diff options
42 files changed, 2385 insertions, 47 deletions
diff --git a/babeld/Makefile b/babeld/Makefile index ec1d247..b7efade 100644 --- a/babeld/Makefile +++ b/babeld/Makefile @@ -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_MD5SUM:=2f71794d4e67f8a5352164ce33611549 PKG_LICENSE:=MIT include $(INCLUDE_DIR)/package.mk diff --git a/batctl/Makefile b/batctl/Makefile index 48407e9..818e345 100644 --- a/batctl/Makefile +++ b/batctl/Makefile @@ -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 diff --git a/batman-adv/Config.in b/batman-adv/Config.in index 86fc795..48092e7 100644 --- a/batman-adv/Config.in +++ b/batman-adv/Config.in @@ -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 diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 6909ba8..d222c0b 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -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:=2 +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 index 0000000..5126fc2 --- /dev/null +++ b/batman-adv/files/compat-hacks.h @@ -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) */ diff --git a/batman-adv/files/lib/netifd/proto/batadv.sh b/batman-adv/files/lib/netifd/proto/batadv.sh index 632a209..1e0c9d0 100644 --- a/batman-adv/files/lib/netifd/proto/batadv.sh +++ b/batman-adv/files/lib/netifd/proto/batadv.sh @@ -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 index 0000000..70adb91 --- /dev/null +++ b/batman-adv/patches/0001-batman-adv-make-sure-ELP-OGM-orig-MAC-is-updated-on-.patch @@ -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 index 0000000..ea191b3 --- /dev/null +++ b/batman-adv/patches/0002-batman-adv-Avoid-duplicate-neigh_node-additions.patch @@ -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 index 0000000..aa07ad5 --- /dev/null +++ b/batman-adv/patches/0003-batman-adv-Avoid-nullptr-derefence-in-batadv_v_neigh.patch @@ -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 index 0000000..15ef21c --- /dev/null +++ b/batman-adv/patches/0004-batman-adv-Fix-refcnt-leak-in-batadv_v_neigh_.patch @@ -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 index 0000000..8ea3788 --- /dev/null +++ b/batman-adv/patches/0005-batman-adv-Fix-double-neigh_node_put-in-batadv_v_ogm.patch @@ -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 index 0000000..f87ddf0 --- /dev/null +++ b/batman-adv/patches/0006-batman-adv-initialize-ELP-orig-address-on-secondary-.patch @@ -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 index 0000000..82ffd07 --- /dev/null +++ b/batman-adv/patches/0007-batman-adv-Add-missing-include-for-batadv_v_neigh_is.patch @@ -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 index 0000000..5c8bfd8 --- /dev/null +++ b/batman-adv/patches/0008-batman-adv-fix-skb-deref-after-free.patch @@ -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 index 0000000..07274b6 --- /dev/null +++ b/batman-adv/patches/0009-batman-adv-replace-WARN-with-rate-limited-output-on-.patch @@ -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 index 0000000..127cac8 --- /dev/null +++ b/batman-adv/patches/0010-batman-adv-Fix-build-against-recent-Debian-Stretch-k.patch @@ -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 index 0000000..b03d795 --- /dev/null +++ b/batman-adv/patches/0011-batman-adv-Clean-up-untagged-vlan-when-destroying-vi.patch @@ -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 index 0000000..5204cdc --- /dev/null +++ b/batman-adv/patches/0012-batman-adv-Fix-ICMP-RR-ethernet-access-after-skb_lin.patch @@ -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 index 0000000..6ea8311 --- /dev/null +++ b/batman-adv/patches/0013-batman-adv-Fix-double-put-of-vlan-object.patch @@ -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 index 0000000..33c7f3b --- /dev/null +++ b/batman-adv/patches/0014-batman-adv-Fix-use-after-free-double-free-of-tt_req_.patch @@ -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/bmx7/Makefile b/bmx7/Makefile new file mode 100644 index 0000000..6ffa785 --- /dev/null +++ b/bmx7/Makefile @@ -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:=41aabcb58f0bdb0c2e2794558de0cd7db9ff72b9 +PKG_VERSION:=r2016060405 +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 index 0000000..b92f525 --- /dev/null +++ b/bmx7/files/etc/config/bmx7 @@ -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 index 0000000..6886739 --- /dev/null +++ b/bmx7/files/etc/init.d/bmx7 @@ -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 index 0000000..794bd9e --- /dev/null +++ b/bmx7/patches/001-json-c.patch @@ -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> + diff --git a/cjdns/Makefile b/cjdns/Makefile index dbf1c21..ea88609 100644 --- a/cjdns/Makefile +++ b/cjdns/Makefile @@ -17,12 +17,12 @@ 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 diff --git a/hnetd/Makefile b/hnetd/Makefile index b9fe825..15b85cc 100644 --- a/hnetd/Makefile +++ b/hnetd/Makefile @@ -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 diff --git a/hnetd/files/hnet.config b/hnetd/files/hnet.config index 6ac396f..2213b73 100644 --- a/hnetd/files/hnet.config +++ b/hnetd/files/hnet.config @@ -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 diff --git a/luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua b/luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua index dfe9ab1..a4a8e43 100644 --- a/luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua +++ b/luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua @@ -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 index 0000000..d511905 --- /dev/null +++ b/luci-app-bmx7/COPYING @@ -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 index 0000000..a9e96f7 --- /dev/null +++ b/luci-app-bmx7/Makefile @@ -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 index 0000000..46a7727 --- /dev/null +++ b/luci-app-bmx7/files/etc/config/luci-bmx7 @@ -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 index 0000000..ed62628 --- /dev/null +++ b/luci-app-bmx7/files/usr/lib/lua/luci/controller/bmx7.lua @@ -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 index 0000000..347af42 --- /dev/null +++ b/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/nodes_j.htm @@ -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 index 0000000..c6920f9 --- /dev/null +++ b/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/status_j.htm @@ -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 index 0000000..8c501c5 --- /dev/null +++ b/luci-app-bmx7/files/www/cgi-bin/bmx7-info @@ -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 Binary files differnew file mode 100644 index 0000000..c7d9cea --- /dev/null +++ b/luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png 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 index 0000000..4a382eb --- /dev/null +++ b/luci-app-bmx7/files/www/luci-static/resources/bmx7/js/polling.js @@ -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 Binary files differnew file mode 100644 index 0000000..29b53c9 --- /dev/null +++ b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png 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 Binary files differnew file mode 100644 index 0000000..f5f3105 --- /dev/null +++ b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png diff --git a/ohybridproxy/Makefile b/ohybridproxy/Makefile index 1d96804..0302e49 100644 --- a/ohybridproxy/Makefile +++ b/ohybridproxy/Makefile @@ -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 diff --git a/olsrd/Makefile b/olsrd/Makefile index 63e83e6..26b7de5 100644 --- a/olsrd/Makefile +++ b/olsrd/Makefile @@ -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 diff --git a/olsrd/files/olsrd.init b/olsrd/files/olsrd.init index 5bee27a..3ced911 100644 --- a/olsrd/files/olsrd.init +++ b/olsrd/files/olsrd.init @@ -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' |
