Merge pull request #217 from HRogge/master
authorBastian Bittorf <bb@npl.de>
Tue, 9 Aug 2016 11:15:07 +0000 (13:15 +0200)
committerGitHub <noreply@github.com>
Tue, 9 Aug 2016 11:15:07 +0000 (13:15 +0200)
Update to OONF 0.12.2 + coverity fix

69 files changed:
MAINTAINERS
ahcpd/Makefile
alfred/Makefile
alfred/files/alfred.init
babeld/Makefile
babeld/files/babeld.config
babeld/files/babeld.init
batctl/Makefile
batman-adv/Config.in
batman-adv/Makefile
batman-adv/files/compat-hacks.h [new file with mode: 0644]
batman-adv/files/lib/netifd/proto/batadv.sh
batman-adv/patches/0001-batman-adv-Add-lower-layer-header-length-to-headroom.patch [deleted file]
batman-adv/patches/0001-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch [new file with mode: 0644]
batman-adv/patches/0002-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch [new file with mode: 0644]
batman-adv/patches/0003-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch [new file with mode: 0644]
batman-adv/patches/0004-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch [new file with mode: 0644]
batman-adv/patches/0005-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch [new file with mode: 0644]
batman-adv/patches/0006-batman-adv-Fix-reference-leak-in-batadv_find_router.patch [new file with mode: 0644]
batman-adv/patches/0007-batman-adv-Free-last_bonding_candidate-on-release-of.patch [new file with mode: 0644]
batman-adv/patches/0008-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch [new file with mode: 0644]
bird/Makefile
bird/patches/001-netlink-update-struct-msghdr.patch [new file with mode: 0644]
bmx7/Makefile
bmx7/files/etc/config/bmx6 [deleted file]
bmx7/files/etc/config/bmx7 [new file with mode: 0644]
bmx7/files/etc/init.d/bmx6 [deleted file]
bmx7/files/etc/init.d/bmx7 [new file with mode: 0755]
bmx7/patches/001-json-c.patch
cjdns/Makefile
hnetd/Makefile
hnetd/files/hnet.config
hnetd/files/hnetd.defaults
hnetd/files/hnetd.init
hnetd/files/ohp-script [deleted file]
hnetd/files/pcp-script [deleted file]
luci-app-bmx6/files/usr/lib/lua/luci/model/bmx6json.lua
luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua
luci-app-bmx7/COPYING [new file with mode: 0644]
luci-app-bmx7/Makefile [new file with mode: 0644]
luci-app-bmx7/files/etc/config/luci-bmx7 [new file with mode: 0644]
luci-app-bmx7/files/usr/lib/lua/luci/controller/bmx7.lua [new file with mode: 0644]
luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/nodes_j.htm [new file with mode: 0644]
luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/status_j.htm [new file with mode: 0644]
luci-app-bmx7/files/www/cgi-bin/bmx7-info [new file with mode: 0755]
luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png [new file with mode: 0644]
luci-app-bmx7/files/www/luci-static/resources/bmx7/js/polling.js [new file with mode: 0644]
luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png [new file with mode: 0644]
luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png [new file with mode: 0644]
minimalist-pcproxy/Makefile
miniupnpd/Makefile
miniupnpd/files/firewall.include
miniupnpd/patches/100-no-ssl.patch [deleted file]
miniupnpd/patches/101-no-ssl-uuid.patch [new file with mode: 0644]
miniupnpd/patches/102-ipv6-ext-port.patch
miniupnpd/patches/103-no-ipv6-autodetection.patch
miniupnpd/patches/104-always-libuuid.patch [new file with mode: 0644]
nat46/Makefile
ndppd/Makefile
nodogsplash/Makefile
nodogsplash/files/nodogsplash.config
nodogsplash/files/nodogsplash.init
ohybridproxy/Makefile
olsrd/Makefile
olsrd/files/olsrd.init
oonf-init-scripts/files/oonf_hotplug.sh
pimbd/Makefile [new file with mode: 0644]
pimbd/files/firewall-uci.sh [new file with mode: 0644]
pimbd/files/pimbd.init [new file with mode: 0644]

index 4d8f5e2..2f2385a 100644 (file)
@@ -13,7 +13,7 @@ Bastian Bittorf <bittorf@bluebottle.com>
 Corinna "Elektra" Aichele <onelektra@gmx.net>
 Gabriel Kerneis <gabriel@kerneis.info>
 Gui Iribarren <gui@altermundi.net>
-Jo-Philipp Wich <jow@openwrt.org>
+Jo-Philipp Wich <jo@mein.io>
 Luka Perkov <luka@openwrt.org>
 Marek Lindner <mareklindner@neomailbox.ch>
 Moritz Warning <moritzwarning@web.de>
index d4f8744..043c609 100644 (file)
@@ -1,4 +1,4 @@
-# 
+#
 # Copyright (C) 2007-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
@@ -25,7 +25,7 @@ define Package/ahcpd
   TITLE:=Ad-Hoc Configuration Protocol daemon
   URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/ahcp/
   MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
-  DEPENDS:=+kmod-ipv6 +ip +librt
+  DEPENDS:=@IPV6 +ip +librt
 endef
 
 define Package/ahcpd/description
index 8f49b5a..8d651a5 100644 (file)
@@ -8,15 +8,15 @@
 include $(TOPDIR)/rules.mk
 
 #
-# The latest alfred git hash in PKG_REV can be obtained from http://git.open-mesh.org/alfred.git
+# The latest alfred git hash in PKG_REV can be obtained from https://git.open-mesh.org/alfred.git
 #
 PKG_NAME:=alfred
-PKG_VERSION:=2015.1
+PKG_VERSION:=2016.2
 PKG_RELEASE:=0
-PKG_MD5SUM:=fcce70cd8da764ee91c8cd2cbfa14362
+PKG_MD5SUM:=cc7d5b352942477033a4cafbed84152d
 
 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
 
 include $(INCLUDE_DIR)/package.mk
@@ -24,11 +24,11 @@ include $(INCLUDE_DIR)/package.mk
 init-y := alfred
 
 define Package/alfred
-  URL:=http://www.open-mesh.org/
+  URL:=https://www.open-mesh.org/
   SECTION:=net
   CATEGORY:=Network
   TITLE:=A.L.F.R.E.D. - Almighty Lightweight Fact Remote Exchange Daemon
-  DEPENDS:= +libc +kmod-ipv6 +librt \
+  DEPENDS:= +libc @IPV6 +librt \
          +ALFRED_NEEDS_lua:lua \
          +ALFRED_NEEDS_libgps:libgps
 endef
index 5ce06c0..4c9a9e1 100755 (executable)
@@ -37,6 +37,31 @@ wait_for_dir()
        fi
 }
 
+wait_for_ll_address()
+{
+       local iface="$1"
+       local timeout=30
+
+       echo "${initscript}: waiting $timeout secs for $iface address..."
+       for i in $(seq $timeout); do
+               # We look for
+               # - the link-local address (starts with fe80)
+               # - without tentative flag (bit 0x40 in the flags field; the first char of the flags field begins 38 columns after the fe80 prefix
+               # - on interface $iface
+               if awk '
+                       BEGIN { RET=1 }
+                       /^fe80.{37} [012389ab]/ { if ($6 == "'"$iface"'") RET=0 }
+                       END { exit RET }
+               ' /proc/net/if_inet6; then
+                       return
+               fi
+               sleep 1
+       done
+
+       echo "${initscript}: $iface address not detected, alfred not starting."
+       exit 1
+}
+
 alfred_start()
 {
        local args=""
@@ -62,7 +87,7 @@ alfred_start()
                wait_for_dir "$batmanif" "/sys/class/net/$batmanif/mesh"
        fi
 
-       wait_for_dir "$interface" "/sys/class/net/$interface/"
+       wait_for_ll_address "$interface"
 
        append alfred_args "$args"
        enable=1
index ec1d247..b46f4f2 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=babeld
-PKG_VERSION:=1.6.1
+PKG_VERSION:=1.7.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/files/
-PKG_MD5SUM:=74290f6c3678f314c79bdc0ab99d9f22
+PKG_SOURCE_URL:=https://www.irif.univ-paris-diderot.fr/~jch/software/files/
+PKG_MD5SUM:=2f71794d4e67f8a5352164ce33611549
 PKG_LICENSE:=MIT
 
 include $(INCLUDE_DIR)/package.mk
@@ -25,7 +25,7 @@ define Package/babeld
   TITLE:=A loop-free distance-vector routing protocol
   URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/babel/
   MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
-  DEPENDS:=+kmod-ipv6
+  DEPENDS:=@IPV6
 endef
 
 define Package/babeld/description
index cb2a131..0073f73 100644 (file)
@@ -16,8 +16,6 @@ config general
        ## Enable ipv6-subtrees by default since OpenWrt should ship with a
        ## recent enough kernel for it to work.
        option 'ipv6_subtrees' 'true'
-       ## This seems somewhat buggy on BB.  If you need only one
-       ## import-table statement, "option import_table 42" should work.
        # list 'import_table' '42'
        # list 'import_table' '100'
        ## Alternative configuration file and directory.
index 6796a34..21ae4be 100755 (executable)
@@ -166,6 +166,9 @@ babel_config_cb() {
                        local value="$2"
                        # Ignore old options
                        list_contains ignored_options "$option" && return
+                       # Skip lists. They will be taken care of by list_cb
+                       test "${option#*_ITEM}" != "$option" && return
+                       test "${option#*_LENGTH}" != "$option" && return
                        cfg_append "${option//_/-} $value"
                }
        ;;
index 8cf2d17..174b18e 100644 (file)
@@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batctl
 
-PKG_VERSION:=2015.1
-PKG_RELEASE:=1
-PKG_MD5SUM:=3db00af0b3cf55136babe06aa666e15f
+PKG_VERSION:=2016.2
+PKG_RELEASE:=0
+PKG_MD5SUM:=50f42d06611afae58ccfcde502f94c1a
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
+PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
 PKG_LICENSE:=GPL-2.0
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
@@ -22,7 +22,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
 include $(INCLUDE_DIR)/package.mk
 
 define Package/batctl
-  URL:=http://www.open-mesh.org/
+  URL:=https://www.open-mesh.org/
   SECTION:=net
   CATEGORY:=Network
   DEPENDS:=+kmod-batman-adv +libnl-tiny +libc
index 86fc795..48092e7 100644 (file)
@@ -24,3 +24,7 @@ config KMOD_BATMAN_ADV_NC
        depends on PACKAGE_kmod-batman-adv
        default n
 
+config KMOD_BATMAN_ADV_BATMAN_V
+       bool "enable batman v routing algorithm"
+       depends on PACKAGE_kmod-batman-adv
+       default n
index 7e43de4..c45cbb4 100644 (file)
@@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
 
-PKG_VERSION:=2015.1
+PKG_VERSION:=2016.2
 PKG_RELEASE:=1
-PKG_MD5SUM:=45f98d315b4290dc208e01190193c514
+PKG_MD5SUM:=dd1ab664475902fc3dbf34998bbe5a90
 
 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)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
-  AUTOLOAD:=$(call AutoLoad,50,batman-adv)
+  AUTOLOAD:=$(call AutoLoad,50,cfg80211 batman-adv)
 endef
 
 define KernelPackage/batman-adv/description
@@ -47,31 +47,46 @@ 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)/net/batman-adv/main.h
 endef
 
-define Build/Compile
-       $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS)
-endef
-
 define Build/Clean
         rm -rf $(BUILD_DIR)/$(PKG_NAME)/
 endef
diff --git a/batman-adv/files/compat-hacks.h b/batman-adv/files/compat-hacks.h
new file mode 100644 (file)
index 0000000..a910c2d
--- /dev/null
@@ -0,0 +1,86 @@
+/* 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) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
+
+#define netif_trans_update batadv_netif_trans_update
+static inline void batadv_netif_trans_update(struct net_device *dev)
+{
+       dev->trans_start = jiffies;
+}
+
+#endif /* < KERNEL_VERSION(4, 7, 0) */
index 632a209..1e0c9d0 100644 (file)
@@ -6,14 +6,18 @@ init_proto "$@"
 
 proto_batadv_init_config() {
        proto_config_add_string "mesh"
+       proto_config_add_string "routing_algo"
 }
 
 proto_batadv_setup() {
        local config="$1"
        local iface="$2"
 
-       local mesh
-       json_get_vars mesh
+       local mesh routing_algo
+       json_get_vars mesh routing_algo
+
+       [ -n "$routing_algo" ] || routing_algo="BATMAN_IV"
+       echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo"
 
        echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
        proto_init_update "$iface" 1
diff --git a/batman-adv/patches/0001-batman-adv-Add-lower-layer-header-length-to-headroom.patch b/batman-adv/patches/0001-batman-adv-Add-lower-layer-header-length-to-headroom.patch
deleted file mode 100644 (file)
index c5adedb..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-batman-adv: Add lower layer header length to headroom
-
-The maximum of hard_header_len and needed_headroom of all slave interfaces
-of a batman-adv device must be used to define the batman-adv device
-headroom/header_len. This is required to avoid too small headroom problems
-when these slave devices try to send the encapsulated packet.
-
-The batman-adv therefore uses:
-
-       needed_headroom = max(0, dev[0].needed_headroom, ...,
-                             dev[n].needed_headroom)
-       hard_header_len = max(ETH_HLEN, dev[0].hard_header_len, ...,
-                             dev[n].hard_header_len) + ETH_HLEN +
-                         max(sizeof(batadv_*cast_packet))
-
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
----
- net/batman-adv/hard-interface.c | 33 +++++++++++++++++++++++++++++++++
- net/batman-adv/soft-interface.c |  2 +-
- 2 files changed, 34 insertions(+), 1 deletion(-)
-
-diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
-index f4a15d2e5eaf..a501aae1077b 100644
---- a/net/batman-adv/hard-interface.c
-+++ b/net/batman-adv/hard-interface.c
-@@ -252,12 +252,45 @@ static void batadv_check_known_mac_addr(const struct net_device *net_dev)
-       rcu_read_unlock();
- }
-+/**
-+ * batadv_hardif_recalc_headroom() - Recalculate skbuff headroom parameters
-+ * @soft_iface: netdev struct of the mesh interface
-+ */
-+static void batadv_hardif_recalc_headroom(struct net_device *soft_iface)
-+{
-+      const struct batadv_hard_iface *hard_iface;
-+      unsigned short hard_header_len = ETH_HLEN;
-+      unsigned short needed_headroom = 0;
-+
-+      rcu_read_lock();
-+      list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
-+              if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
-+                  (hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED))
-+                      continue;
-+
-+              if (hard_iface->soft_iface != soft_iface)
-+                      continue;
-+
-+              hard_header_len = max_t(unsigned short, hard_header_len,
-+                                      hard_iface->net_dev->hard_header_len);
-+
-+              needed_headroom = max_t(unsigned short, needed_headroom,
-+                                      hard_iface->net_dev->needed_headroom);
-+      }
-+      rcu_read_unlock();
-+
-+      soft_iface->needed_headroom = needed_headroom;
-+      soft_iface->hard_header_len = hard_header_len + batadv_max_header_len();
-+}
-+
- int batadv_hardif_min_mtu(struct net_device *soft_iface)
- {
-       struct batadv_priv *bat_priv = netdev_priv(soft_iface);
-       const struct batadv_hard_iface *hard_iface;
-       int min_mtu = INT_MAX;
-+      batadv_hardif_recalc_headroom(soft_iface);
-+
-       rcu_read_lock();
-       list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
-               if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
-diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
-index 36b23f31df2a..b4c110791203 100644
---- a/net/batman-adv/soft-interface.c
-+++ b/net/batman-adv/soft-interface.c
-@@ -948,7 +948,7 @@ static void batadv_softif_init_early(struct net_device *dev)
-        */
-       dev->mtu = ETH_DATA_LEN;
-       /* reserve more space in the skbuff for our header */
--      dev->hard_header_len = batadv_max_header_len();
-+      dev->hard_header_len = ETH_HLEN + batadv_max_header_len();
-       /* generate random address */
-       eth_hw_addr_random(dev);
--- 
-2.5.0
-
-
diff --git a/batman-adv/patches/0001-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch b/batman-adv/patches/0001-batman-adv-Avoid-nullptr-dereference-in-bla-after-vl.patch
new file mode 100644 (file)
index 0000000..49c0637
--- /dev/null
@@ -0,0 +1,35 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 2 Jul 2016 09:52:13 +0200
+Subject: [PATCH] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag
+
+vlan_insert_tag can return NULL on errors. The bridge loop avoidance code
+therefore has to check the return value of vlan_insert_tag for NULL before
+it can safely operate on this pointer.
+
+Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/e4cffba4d3353ea15287abbfbdd65208aa62c156
+---
+ net/batman-adv/bridge_loop_avoidance.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
+index 748a9ea..7129780 100644
+--- a/net/batman-adv/bridge_loop_avoidance.c
++++ b/net/batman-adv/bridge_loop_avoidance.c
+@@ -418,9 +418,12 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
+               break;
+       }
+-      if (vid & BATADV_VLAN_HAS_TAG)
++      if (vid & BATADV_VLAN_HAS_TAG) {
+               skb = vlan_insert_tag(skb, htons(ETH_P_8021Q),
+                                     vid & VLAN_VID_MASK);
++              if (!skb)
++                      goto out;
++      }
+       skb_reset_mac_header(skb);
+       skb->protocol = eth_type_trans(skb, soft_iface);
diff --git a/batman-adv/patches/0002-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch b/batman-adv/patches/0002-batman-adv-Avoid-nullptr-dereference-in-dat-after-vl.patch
new file mode 100644 (file)
index 0000000..e5e72d7
--- /dev/null
@@ -0,0 +1,49 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 2 Jul 2016 09:52:14 +0200
+Subject: [PATCH] batman-adv: Avoid nullptr dereference in dat after vlan_insert_tag
+
+vlan_insert_tag can return NULL on errors. The distributed arp table code
+therefore has to check the return value of vlan_insert_tag for NULL before
+it can safely operate on this pointer.
+
+Fixes: 53c6c262a581 ("batman-adv: tag locally generated ARP reply if needed")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/898382d11fa1f737cd4f7033db1088c601fd11ed
+---
+ net/batman-adv/distributed-arp-table.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
+index 278800a..aee3b39 100644
+--- a/net/batman-adv/distributed-arp-table.c
++++ b/net/batman-adv/distributed-arp-table.c
+@@ -1009,9 +1009,12 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
+               if (!skb_new)
+                       goto out;
+-              if (vid & BATADV_VLAN_HAS_TAG)
++              if (vid & BATADV_VLAN_HAS_TAG) {
+                       skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
+                                                 vid & VLAN_VID_MASK);
++                      if (!skb_new)
++                              goto out;
++              }
+               skb_reset_mac_header(skb_new);
+               skb_new->protocol = eth_type_trans(skb_new,
+@@ -1089,9 +1092,12 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
+        */
+       skb_reset_mac_header(skb_new);
+-      if (vid & BATADV_VLAN_HAS_TAG)
++      if (vid & BATADV_VLAN_HAS_TAG) {
+               skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
+                                         vid & VLAN_VID_MASK);
++              if (!skb_new)
++                      goto out;
++      }
+       /* To preserve backwards compatibility, the node has choose the outgoing
+        * format based on the incoming request packet type. The assumption is
diff --git a/batman-adv/patches/0003-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch b/batman-adv/patches/0003-batman-adv-Avoid-tt_req_node-list-put-for-unhashed-e.patch
new file mode 100644 (file)
index 0000000..60d4e12
--- /dev/null
@@ -0,0 +1,41 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 24 Jun 2016 21:43:32 +0200
+Subject: [PATCH] batman-adv: Avoid tt_req_node list put for unhashed entry
+
+It can happen that a tt_req_node list entry was already removed from
+tt.req_list when batadv_send_tt_request reaches the end of the function.
+The reference counter was already reduced by 1 for the list entry and thus
+the reference counter is not allowed to be reduced again. Otherwise, the
+entry is freed too early and the next batadv_tt_req_node_put in this
+function will operate on freed memory.
+
+Fixes: cea194d90b11 ("batman-adv: improved client announcement mechanism")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/03ecc9f957b837c755f09251c5f684996521e487
+---
+ net/batman-adv/translation-table.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
+index d033a05..57ec87f 100644
+--- a/net/batman-adv/translation-table.c
++++ b/net/batman-adv/translation-table.c
+@@ -2639,11 +2639,13 @@ static bool batadv_send_tt_request(struct batadv_priv *bat_priv,
+ out:
+       if (primary_if)
+               batadv_hardif_put(primary_if);
++
+       if (ret && tt_req_node) {
+               spin_lock_bh(&bat_priv->tt.req_list_lock);
+-              /* hlist_del_init() verifies tt_req_node still is in the list */
+-              hlist_del_init(&tt_req_node->list);
+-              batadv_tt_req_node_put(tt_req_node);
++              if (!hlist_unhashed(&tt_req_node->list)) {
++                      hlist_del_init(&tt_req_node->list);
++                      batadv_tt_req_node_put(tt_req_node);
++              }
+               spin_unlock_bh(&bat_priv->tt.req_list_lock);
+       }
diff --git a/batman-adv/patches/0004-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch b/batman-adv/patches/0004-batman-adv-Fix-orig_node_vlan-leak-on-orig_node_rele.patch
new file mode 100644 (file)
index 0000000..7af3162
--- /dev/null
@@ -0,0 +1,43 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 30 Jun 2016 20:10:46 +0200
+Subject: [PATCH] batman-adv: Fix orig_node_vlan leak on orig_node_release
+
+batadv_orig_node_new uses batadv_orig_node_vlan_new to allocate a new
+batadv_orig_node_vlan and add it to batadv_orig_node::vlan_list. References
+to this list have also to be cleaned when the batadv_orig_node is removed.
+
+Fixes: 21a57f6e7a3b ("batman-adv: make the TT CRC logic VLAN specific")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/719afd254e812c7ff8688ce79bebb7324ec438d6
+---
+ net/batman-adv/originator.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
+index 7f51bc2..fe2fcda 100644
+--- a/net/batman-adv/originator.c
++++ b/net/batman-adv/originator.c
+@@ -765,6 +765,7 @@ static void batadv_orig_node_release(struct kref *ref)
+       struct batadv_neigh_node *neigh_node;
+       struct batadv_orig_node *orig_node;
+       struct batadv_orig_ifinfo *orig_ifinfo;
++      struct batadv_orig_node_vlan *vlan;
+       orig_node = container_of(ref, struct batadv_orig_node, refcount);
+@@ -784,6 +785,13 @@ static void batadv_orig_node_release(struct kref *ref)
+       }
+       spin_unlock_bh(&orig_node->neigh_list_lock);
++      spin_lock_bh(&orig_node->vlan_list_lock);
++      hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) {
++              hlist_del_rcu(&vlan->list);
++              batadv_orig_node_vlan_put(vlan);
++      }
++      spin_unlock_bh(&orig_node->vlan_list_lock);
++
+       /* Free nc_nodes */
+       batadv_nc_purge_orig(orig_node->bat_priv, orig_node, NULL);
diff --git a/batman-adv/patches/0005-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch b/batman-adv/patches/0005-batman-adv-Fix-non-atomic-bla_claim-backbone_gw-acce.patch
new file mode 100644 (file)
index 0000000..5e0afdd
--- /dev/null
@@ -0,0 +1,291 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 1 Jul 2016 15:49:43 +0200
+Subject: [PATCH] batman-adv: Fix non-atomic bla_claim::backbone_gw access
+
+The pointer batadv_bla_claim::backbone_gw can be changed at any time.
+Therefore, access to it must be protected to ensure that two function
+accessing the same backbone_gw are actually accessing the same. This is
+especially important when the crc_lock is used or when the backbone_gw of a
+claim is exchanged.
+
+Not doing so leads to invalid memory access and/or reference leaks.
+
+Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
+Fixes: b307e72d119f ("batman-adv: lock crc access in bridge loop avoidance")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/e401297e3a393896e9b07bef8d6e2df203b60d43
+---
+ net/batman-adv/bridge_loop_avoidance.c | 111 ++++++++++++++++++++++++++-------
+ net/batman-adv/types.h                 |   2 +
+ 2 files changed, 90 insertions(+), 23 deletions(-)
+
+diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
+index 7129780..825a5cd 100644
+--- a/net/batman-adv/bridge_loop_avoidance.c
++++ b/net/batman-adv/bridge_loop_avoidance.c
+@@ -177,10 +177,21 @@ static void batadv_backbone_gw_put(struct batadv_bla_backbone_gw *backbone_gw)
+ static void batadv_claim_release(struct kref *ref)
+ {
+       struct batadv_bla_claim *claim;
++      struct batadv_bla_backbone_gw *old_backbone_gw;
+       claim = container_of(ref, struct batadv_bla_claim, refcount);
+-      batadv_backbone_gw_put(claim->backbone_gw);
++      spin_lock_bh(&claim->backbone_lock);
++      old_backbone_gw = claim->backbone_gw;
++      claim->backbone_gw = NULL;
++      spin_unlock_bh(&claim->backbone_lock);
++
++      spin_lock_bh(&old_backbone_gw->crc_lock);
++      old_backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
++      spin_unlock_bh(&old_backbone_gw->crc_lock);
++
++      batadv_backbone_gw_put(old_backbone_gw);
++
+       kfree_rcu(claim, rcu);
+ }
+@@ -677,8 +688,10 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
+                                const u8 *mac, const unsigned short vid,
+                                struct batadv_bla_backbone_gw *backbone_gw)
+ {
++      struct batadv_bla_backbone_gw *old_backbone_gw;
+       struct batadv_bla_claim *claim;
+       struct batadv_bla_claim search_claim;
++      bool remove_crc = false;
+       int hash_added;
+       ether_addr_copy(search_claim.addr, mac);
+@@ -692,8 +705,10 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
+                       return;
+               ether_addr_copy(claim->addr, mac);
++              spin_lock_init(&claim->backbone_lock);
+               claim->vid = vid;
+               claim->lasttime = jiffies;
++              kref_get(&backbone_gw->refcount);
+               claim->backbone_gw = backbone_gw;
+               kref_init(&claim->refcount);
+@@ -721,15 +736,26 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
+                          "bla_add_claim(): changing ownership for %pM, vid %d\n",
+                          mac, BATADV_PRINT_VID(vid));
+-              spin_lock_bh(&claim->backbone_gw->crc_lock);
+-              claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
+-              spin_unlock_bh(&claim->backbone_gw->crc_lock);
+-              batadv_backbone_gw_put(claim->backbone_gw);
++              remove_crc = true;
+       }
+-      /* set (new) backbone gw */
++
++      /* replace backbone_gw atomically and adjust reference counters */
++      spin_lock_bh(&claim->backbone_lock);
++      old_backbone_gw = claim->backbone_gw;
+       kref_get(&backbone_gw->refcount);
+       claim->backbone_gw = backbone_gw;
++      spin_unlock_bh(&claim->backbone_lock);
++      if (remove_crc) {
++              /* remove claim address from old backbone_gw */
++              spin_lock_bh(&old_backbone_gw->crc_lock);
++              old_backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
++              spin_unlock_bh(&old_backbone_gw->crc_lock);
++      }
++
++      batadv_backbone_gw_put(old_backbone_gw);
++
++      /* add claim address to new backbone_gw */
+       spin_lock_bh(&backbone_gw->crc_lock);
+       backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
+       spin_unlock_bh(&backbone_gw->crc_lock);
+@@ -740,6 +766,26 @@ claim_free_ref:
+ }
+ /**
++ * batadv_bla_claim_get_backbone_gw - Get valid reference for backbone_gw of
++ *  claim
++ * @claim: claim whose backbone_gw should be returned
++ *
++ * Return: valid reference to claim::backbone_gw
++ */
++static struct batadv_bla_backbone_gw *
++batadv_bla_claim_get_backbone_gw(struct batadv_bla_claim *claim)
++{
++      struct batadv_bla_backbone_gw *backbone_gw;
++
++      spin_lock_bh(&claim->backbone_lock);
++      backbone_gw = claim->backbone_gw;
++      kref_get(&backbone_gw->refcount);
++      spin_unlock_bh(&claim->backbone_lock);
++
++      return backbone_gw;
++}
++
++/**
+  * batadv_bla_del_claim - delete a claim from the claim hash
+  * @bat_priv: the bat priv with all the soft interface information
+  * @mac: mac address of the claim to be removed
+@@ -763,10 +809,6 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
+                          batadv_choose_claim, claim);
+       batadv_claim_put(claim); /* reference from the hash is gone */
+-      spin_lock_bh(&claim->backbone_gw->crc_lock);
+-      claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
+-      spin_unlock_bh(&claim->backbone_gw->crc_lock);
+-
+       /* don't need the reference from hash_find() anymore */
+       batadv_claim_put(claim);
+ }
+@@ -1219,6 +1261,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
+                                   struct batadv_hard_iface *primary_if,
+                                   int now)
+ {
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct batadv_bla_claim *claim;
+       struct hlist_head *head;
+       struct batadv_hashtable *hash;
+@@ -1233,14 +1276,17 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
+               rcu_read_lock();
+               hlist_for_each_entry_rcu(claim, head, hash_entry) {
++                      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
+                       if (now)
+                               goto purge_now;
+-                      if (!batadv_compare_eth(claim->backbone_gw->orig,
++
++                      if (!batadv_compare_eth(backbone_gw->orig,
+                                               primary_if->net_dev->dev_addr))
+-                              continue;
++                              goto skip;
++
+                       if (!batadv_has_timed_out(claim->lasttime,
+                                                 BATADV_BLA_CLAIM_TIMEOUT))
+-                              continue;
++                              goto skip;
+                       batadv_dbg(BATADV_DBG_BLA, bat_priv,
+                                  "bla_purge_claims(): %pM, vid %d, time out\n",
+@@ -1248,8 +1294,10 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
+ purge_now:
+                       batadv_handle_unclaim(bat_priv, primary_if,
+-                                            claim->backbone_gw->orig,
++                                            backbone_gw->orig,
+                                             claim->addr, claim->vid);
++skip:
++                      batadv_backbone_gw_put(backbone_gw);
+               }
+               rcu_read_unlock();
+       }
+@@ -1760,9 +1808,11 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb,
+ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+                  unsigned short vid, bool is_bcast)
+ {
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct ethhdr *ethhdr;
+       struct batadv_bla_claim search_claim, *claim = NULL;
+       struct batadv_hard_iface *primary_if;
++      bool own_claim;
+       bool ret;
+       ethhdr = eth_hdr(skb);
+@@ -1797,8 +1847,12 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+       }
+       /* if it is our own claim ... */
+-      if (batadv_compare_eth(claim->backbone_gw->orig,
+-                             primary_if->net_dev->dev_addr)) {
++      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
++      own_claim = batadv_compare_eth(backbone_gw->orig,
++                                     primary_if->net_dev->dev_addr);
++      batadv_backbone_gw_put(backbone_gw);
++
++      if (own_claim) {
+               /* ... allow it in any case */
+               claim->lasttime = jiffies;
+               goto allow;
+@@ -1862,7 +1916,9 @@ bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+ {
+       struct ethhdr *ethhdr;
+       struct batadv_bla_claim search_claim, *claim = NULL;
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct batadv_hard_iface *primary_if;
++      bool client_roamed;
+       bool ret = false;
+       primary_if = batadv_primary_if_get_selected(bat_priv);
+@@ -1892,8 +1948,12 @@ bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
+               goto allow;
+       /* check if we are responsible. */
+-      if (batadv_compare_eth(claim->backbone_gw->orig,
+-                             primary_if->net_dev->dev_addr)) {
++      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
++      client_roamed = batadv_compare_eth(backbone_gw->orig,
++                                         primary_if->net_dev->dev_addr);
++      batadv_backbone_gw_put(backbone_gw);
++
++      if (client_roamed) {
+               /* if yes, the client has roamed and we have
+                * to unclaim it.
+                */
+@@ -1941,6 +2001,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
+       struct net_device *net_dev = (struct net_device *)seq->private;
+       struct batadv_priv *bat_priv = netdev_priv(net_dev);
+       struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
++      struct batadv_bla_backbone_gw *backbone_gw;
+       struct batadv_bla_claim *claim;
+       struct batadv_hard_iface *primary_if;
+       struct hlist_head *head;
+@@ -1965,17 +2026,21 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
+               rcu_read_lock();
+               hlist_for_each_entry_rcu(claim, head, hash_entry) {
+-                      is_own = batadv_compare_eth(claim->backbone_gw->orig,
++                      backbone_gw = batadv_bla_claim_get_backbone_gw(claim);
++
++                      is_own = batadv_compare_eth(backbone_gw->orig,
+                                                   primary_addr);
+-                      spin_lock_bh(&claim->backbone_gw->crc_lock);
+-                      backbone_crc = claim->backbone_gw->crc;
+-                      spin_unlock_bh(&claim->backbone_gw->crc_lock);
++                      spin_lock_bh(&backbone_gw->crc_lock);
++                      backbone_crc = backbone_gw->crc;
++                      spin_unlock_bh(&backbone_gw->crc_lock);
+                       seq_printf(seq, " * %pM on %5d by %pM [%c] (%#.4x)\n",
+                                  claim->addr, BATADV_PRINT_VID(claim->vid),
+-                                 claim->backbone_gw->orig,
++                                 backbone_gw->orig,
+                                  (is_own ? 'x' : ' '),
+                                  backbone_crc);
++
++                      batadv_backbone_gw_put(backbone_gw);
+               }
+               rcu_read_unlock();
+       }
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
+index ba846b0..0051222 100644
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -1042,6 +1042,7 @@ struct batadv_bla_backbone_gw {
+  * @addr: mac address of claimed non-mesh client
+  * @vid: vlan id this client was detected on
+  * @backbone_gw: pointer to backbone gw claiming this client
++ * @backbone_lock: lock protecting backbone_gw pointer
+  * @lasttime: last time we heard of claim (locals only)
+  * @hash_entry: hlist node for batadv_priv_bla::claim_hash
+  * @refcount: number of contexts the object is used
+@@ -1051,6 +1052,7 @@ struct batadv_bla_claim {
+       u8 addr[ETH_ALEN];
+       unsigned short vid;
+       struct batadv_bla_backbone_gw *backbone_gw;
++      spinlock_t backbone_lock; /* protects backbone_gw */
+       unsigned long lasttime;
+       struct hlist_node hash_entry;
+       struct rcu_head rcu;
diff --git a/batman-adv/patches/0006-batman-adv-Fix-reference-leak-in-batadv_find_router.patch b/batman-adv/patches/0006-batman-adv-Fix-reference-leak-in-batadv_find_router.patch
new file mode 100644 (file)
index 0000000..1eeea6e
--- /dev/null
@@ -0,0 +1,120 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 30 Jun 2016 20:11:34 +0200
+Subject: [PATCH] batman-adv: Fix reference leak in batadv_find_router
+
+The replacement of last_bonding_candidate in batadv_orig_node has to be an
+atomic operation. Otherwise it is possible that the reference counter of a
+batadv_orig_ifinfo is reduced which was no longer the
+last_bonding_candidate when the new candidate is added. This can either
+lead to an invalid memory access or to reference leaks which make it
+impossible to an interface which was added to batman-adv.
+
+Fixes: 797edd9e87ac ("batman-adv: add bonding again")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/6ecc711374afd93ee0c2216b38ae52d3ce680c3f
+---
+ net/batman-adv/routing.c | 52 ++++++++++++++++++++++++++++++++++++------------
+ net/batman-adv/types.h   |  4 +++-
+ 2 files changed, 42 insertions(+), 14 deletions(-)
+
+diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
+index 6c2901a..bfac086 100644
+--- a/net/batman-adv/routing.c
++++ b/net/batman-adv/routing.c
+@@ -456,6 +456,29 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
+ }
+ /**
++ * batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node
++ * @orig_node: originator node whose bonding candidates should be replaced
++ * @new_candidate: new bonding candidate or NULL
++ */
++static void
++batadv_last_bonding_replace(struct batadv_orig_node *orig_node,
++                          struct batadv_orig_ifinfo *new_candidate)
++{
++      struct batadv_orig_ifinfo *old_candidate;
++
++      spin_lock_bh(&orig_node->neigh_list_lock);
++      old_candidate = orig_node->last_bonding_candidate;
++
++      if (new_candidate)
++              kref_get(&new_candidate->refcount);
++      orig_node->last_bonding_candidate = new_candidate;
++      spin_unlock_bh(&orig_node->neigh_list_lock);
++
++      if (old_candidate)
++              batadv_orig_ifinfo_put(old_candidate);
++}
++
++/**
+  * batadv_find_router - find a suitable router for this originator
+  * @bat_priv: the bat priv with all the soft interface information
+  * @orig_node: the destination node
+@@ -562,10 +585,6 @@ next:
+       }
+       rcu_read_unlock();
+-      /* last_bonding_candidate is reset below, remove the old reference. */
+-      if (orig_node->last_bonding_candidate)
+-              batadv_orig_ifinfo_put(orig_node->last_bonding_candidate);
+-
+       /* After finding candidates, handle the three cases:
+        * 1) there is a next candidate, use that
+        * 2) there is no next candidate, use the first of the list
+@@ -574,21 +593,28 @@ next:
+       if (next_candidate) {
+               batadv_neigh_node_put(router);
+-              /* remove references to first candidate, we don't need it. */
+-              if (first_candidate) {
+-                      batadv_neigh_node_put(first_candidate_router);
+-                      batadv_orig_ifinfo_put(first_candidate);
+-              }
++              kref_get(&next_candidate_router->refcount);
+               router = next_candidate_router;
+-              orig_node->last_bonding_candidate = next_candidate;
++              batadv_last_bonding_replace(orig_node, next_candidate);
+       } else if (first_candidate) {
+               batadv_neigh_node_put(router);
+-              /* refcounting has already been done in the loop above. */
++              kref_get(&first_candidate_router->refcount);
+               router = first_candidate_router;
+-              orig_node->last_bonding_candidate = first_candidate;
++              batadv_last_bonding_replace(orig_node, first_candidate);
+       } else {
+-              orig_node->last_bonding_candidate = NULL;
++              batadv_last_bonding_replace(orig_node, NULL);
++      }
++
++      /* cleanup of candidates */
++      if (first_candidate) {
++              batadv_neigh_node_put(first_candidate_router);
++              batadv_orig_ifinfo_put(first_candidate);
++      }
++
++      if (next_candidate) {
++              batadv_neigh_node_put(next_candidate_router);
++              batadv_orig_ifinfo_put(next_candidate);
+       }
+       return router;
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
+index 0051222..74d865a 100644
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -330,7 +330,9 @@ struct batadv_orig_node {
+       DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
+       u32 last_bcast_seqno;
+       struct hlist_head neigh_list;
+-      /* neigh_list_lock protects: neigh_list and router */
++      /* neigh_list_lock protects: neigh_list, ifinfo_list,
++       * last_bonding_candidate and router
++       */
+       spinlock_t neigh_list_lock;
+       struct hlist_node hash_entry;
+       struct batadv_priv *bat_priv;
diff --git a/batman-adv/patches/0007-batman-adv-Free-last_bonding_candidate-on-release-of.patch b/batman-adv/patches/0007-batman-adv-Free-last_bonding_candidate-on-release-of.patch
new file mode 100644 (file)
index 0000000..9e548da
--- /dev/null
@@ -0,0 +1,45 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Thu, 30 Jun 2016 21:41:13 +0200
+Subject: [PATCH] batman-adv: Free last_bonding_candidate on release of orig_node
+
+The orig_ifinfo reference counter for last_bonding_candidate in
+batadv_orig_node has to be reduced when an originator node is released.
+Otherwise the orig_ifinfo is leaked and the reference counter the netdevice
+is not reduced correctly.
+
+Fixes: 797edd9e87ac ("batman-adv: add bonding again")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/20df5c53865a90095099f0af80536b8abfea303b
+---
+ net/batman-adv/originator.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
+index fe2fcda..ab8c4f9 100644
+--- a/net/batman-adv/originator.c
++++ b/net/batman-adv/originator.c
+@@ -766,6 +766,7 @@ static void batadv_orig_node_release(struct kref *ref)
+       struct batadv_orig_node *orig_node;
+       struct batadv_orig_ifinfo *orig_ifinfo;
+       struct batadv_orig_node_vlan *vlan;
++      struct batadv_orig_ifinfo *last_candidate;
+       orig_node = container_of(ref, struct batadv_orig_node, refcount);
+@@ -783,8 +784,14 @@ static void batadv_orig_node_release(struct kref *ref)
+               hlist_del_rcu(&orig_ifinfo->list);
+               batadv_orig_ifinfo_put(orig_ifinfo);
+       }
++
++      last_candidate = orig_node->last_bonding_candidate;
++      orig_node->last_bonding_candidate = NULL;
+       spin_unlock_bh(&orig_node->neigh_list_lock);
++      if (last_candidate)
++              batadv_orig_ifinfo_put(last_candidate);
++
+       spin_lock_bh(&orig_node->vlan_list_lock);
+       hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) {
+               hlist_del_rcu(&vlan->list);
diff --git a/batman-adv/patches/0008-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch b/batman-adv/patches/0008-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch
new file mode 100644 (file)
index 0000000..e63b782
--- /dev/null
@@ -0,0 +1,35 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sun, 12 Jun 2016 10:43:19 +0200
+Subject: [PATCH] batman-adv: Fix speedy join in gateway client mode
+
+Speedy join only works when the received packet is either broadcast or an
+4addr unicast packet. Thus packets converted from broadcast to unicast via
+the gateway handling code have to be converted to 4addr packets to allow
+the receiving gateway server to add the sender address as temporary entry
+to the translation table.
+
+Not doing it will make the batman-adv gateway server drop the DHCP response
+in many situations because it doesn't yet have the TT entry for the
+destination of the DHCP response.
+
+Fixes: 9cbc67d9da47 ("batman-adv: change interface_rx to get orig node")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+---
+ net/batman-adv/send.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
+index f2f1256..0103976 100644
+--- a/net/batman-adv/send.c
++++ b/net/batman-adv/send.c
+@@ -424,8 +424,8 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
+       struct batadv_orig_node *orig_node;
+       orig_node = batadv_gw_get_selected_orig(bat_priv);
+-      return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
+-                                     orig_node, vid);
++      return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST_4ADDR,
++                                     BATADV_P_DATA, orig_node, vid);
+ }
+ void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface)
index 5f8200c..be62460 100644 (file)
@@ -1,5 +1,5 @@
 # 
-# Copyright (C) 2009-2015 OpenWrt.org
+# Copyright (C) 2009-2016 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -7,13 +7,15 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=bird
-PKG_VERSION:=1.4.5
-PKG_RELEASE:=2
+PKG_VERSION:=1.6.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=ftp://bird.network.cz/pub/bird
-PKG_MD5SUM:=a8e5e0a9129ce30fe6102c593bafb763
+PKG_MD5SUM:=4c92ec3548a2a120243879b6ef7046dd
 PKG_BUILD_DEPENDS:=libncurses libreadline
+PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
+
 PKG_LICENSE:=GPL-2.0
 
 include $(INCLUDE_DIR)/package.mk
@@ -161,6 +163,8 @@ endef
 
 CONFIGURE_ARGS += --with-linux-headers="$(LINUX_DIR)"
 
+TARGET_CFLAGS+=-std=gnu89
+
 define Build/Template
 
 $(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
diff --git a/bird/patches/001-netlink-update-struct-msghdr.patch b/bird/patches/001-netlink-update-struct-msghdr.patch
new file mode 100644 (file)
index 0000000..491e8f9
--- /dev/null
@@ -0,0 +1,49 @@
+From 31e9e10144a6994773a04d94903fa3bdde6de91e Mon Sep 17 00:00:00 2001
+From: Stijn Tintel <stijn@linux-ipv6.be>
+Date: Tue, 10 May 2016 16:45:35 +0300
+Subject: [PATCH] netlink: update struct msghdr
+
+The netlink code assumes an order for the members of struct msghdr.
+This breaks recvmsg and sendmsg with musl libc on mips64. Fix this by
+using designated initializers instead.
+
+Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
+---
+ sysdep/linux/netlink.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
+index 1ffdff0..b42e7b6 100644
+--- a/sysdep/linux/netlink.c
++++ b/sysdep/linux/netlink.c
+@@ -125,7 +125,12 @@ nl_get_reply(struct nl_sock *nl)
+       {
+         struct iovec iov = { nl->rx_buffer, NL_RX_SIZE };
+         struct sockaddr_nl sa;
+-        struct msghdr m = { (struct sockaddr *) &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
++        struct msghdr m = {
++          .msg_name = &sa,
++          .msg_namelen = sizeof(sa),
++          .msg_iov = &iov,
++          .msg_iovlen = 1,
++        };
+         int x = recvmsg(nl->fd, &m, 0);
+         if (x < 0)
+           die("nl_get_reply: %m");
+@@ -1231,7 +1236,12 @@ nl_async_hook(sock *sk, int size UNUSED)
+ {
+   struct iovec iov = { nl_async_rx_buffer, NL_RX_SIZE };
+   struct sockaddr_nl sa;
+-  struct msghdr m = { (struct sockaddr *) &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
++  struct msghdr m = {
++    .msg_name = &sa,
++    .msg_namelen = sizeof(sa),
++    .msg_iov = &iov,
++    .msg_iovlen = 1,
++  };
+   struct nlmsghdr *h;
+   int x;
+   uint len;
+-- 
+2.7.3
+
index 9f2e937..e1eb36b 100644 (file)
@@ -30,10 +30,10 @@ 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:///home/neumann/bmx6/bmx6.git
+#PKG_SOURCE_URL:=file:///usr/src/bmx6/bmx6.git
 
-PKG_REV:=c893847b458294e4559b8523f3397fbee4b32a8f
-PKG_VERSION:=r2015080722
+PKG_REV:=379110ae442f80755b5788c527e722f9551b14eb
+PKG_VERSION:=r2016072001
 PKG_RELEASE:=4
 PKG_LICENSE:=GPL-2.0
 
@@ -47,12 +47,11 @@ 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 -DDEBUG_MALLOC" \
-        EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib " \
+        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)" \
-        STRIP="/bin/false" \
         build_all
 
 define Package/bmx7/Default
@@ -62,11 +61,11 @@ define Package/bmx7/Default
   TITLE:=BMX7 layer 3 routing daemon
   URL:=http://bmx6.net/
   MAINTAINER:=Axel Neumann <neumann@cgws.de>
-  DEPENDS:=+zlib +libpolarssl +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun @!bmx6
+  DEPENDS:=+zlib +libpolarssl +libiwinfo
 endef
 
 define Package/bmx7/description
-BMX7 layer 3 routing daemon supporting IPv6, and IPv4 over IPv6
+BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing
 endef
 
 define Package/bmx7
@@ -80,6 +79,18 @@ define Package/bmx7-uci-config
   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
@@ -92,16 +103,16 @@ define Package/bmx7-sms
   TITLE:=sms plugin
 endef
 
-#define Package/bmx7-quagga
-#  $(call Package/bmx7/Default)
-#  DEPENDS:=bmx7 +qmp-quagga @BROKEN
-#  TITLE:=bmx7 quagga plugin to redistribute/export routes (needs manet/bmx patched quagga 0.99.21)
-#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
-  TITLE:=bmx7 table plugin to automatically announce routing-table routes via ip6ip tunnels
+  DEPENDS:=bmx7 +bmx7-tun
+  TITLE:=plugin to announce routes from tables via tunnels
 endef
 
 define Build/Configure
@@ -114,43 +125,67 @@ endef
 
 define Package/bmx7/install
        $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bmx6 $(1)/usr/sbin/bmx6
+       $(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/bmx6
+/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/bmx6_uci_config/bmx6_config.so $(1)/usr/lib/bmx6_config.so
-       $(INSTALL_BIN) ./files/etc/init.d/bmx6 $(1)/etc/init.d/bmx6
-       $(INSTALL_DATA) ./files/etc/config/bmx6 $(1)/etc/config/bmx6
+       $(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/bmx6_json/bmx6_json.so $(1)/usr/lib/bmx6_json.so
+       $(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/bmx6_sms/bmx6_sms.so $(1)/usr/lib/bmx6_sms.so
+       $(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/bmx6_table/bmx6_table.so $(1)/usr/lib/bmx6_table.so
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_table/bmx7_table.so $(1)/usr/lib/bmx7_table.so
 endef
 
-#define Package/bmx7-quagga/install
-#      $(INSTALL_DIR) $(1)/usr/lib
-#      $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_quagga/bmx6_quagga.so $(1)/usr/lib/bmx6_quagga.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-quagga))
 $(eval $(call BuildPackage,bmx7-table))
+$(eval $(call BuildPackage,bmx7-tun))
diff --git a/bmx7/files/etc/config/bmx6 b/bmx7/files/etc/config/bmx6
deleted file mode 100644 (file)
index 5f7af9d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-
-# for more information:
-# http://bmx6.net/projects/bmx6/wiki
-# options execute: bmx6 --help
-
-config 'bmx6' 'general'
-#       option 'runtimeDir' '/var/run/bmx6'
-
-
-#config 'plugin'
-#        option 'plugin' 'bmx6_config.so'
-
-#config 'plugin'
-#        option 'plugin' 'bmx6_json.so'
-
-#config 'plugin'
-#        option 'plugin' 'bmx6_table.so'
-
-#config 'plugin'
-#        option 'plugin' 'bmx6_sms.so'
-
-
-config 'dev' 'mesh_1'
-        option 'dev' 'br-lan'
-
-config 'dev' 'mesh_2'
-        option 'dev' 'wlan0'
-
-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/config/bmx7 b/bmx7/files/etc/config/bmx7
new file mode 100644 (file)
index 0000000..b92f525
--- /dev/null
@@ -0,0 +1,57 @@
+
+# for more information:
+# http://bmx6.net/projects/bmx6/wiki
+# options execute: bmx7 --help
+
+config 'bmx7' 'general'
+#       option 'runtimeDir' '/var/run/bmx7'
+#      option 'trustedNodesDir' '/etc/bmx7/trustedNodes'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_config.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_json.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_sms.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_iwinfo.so'
+
+
+config 'dev' 'mesh_1'
+        option 'dev' 'br-lan'
+
+config 'dev' 'mesh_2'
+        option 'dev' 'wlan0'
+
+
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_tun.so'
+
+#config 'plugin'
+#        option 'plugin' 'bmx7_table.so'
+
+
+#config 'tunDev' default
+#        option 'tunDev' 'default'
+#        option 'tun6Address' '2012:0:0:6666::1/64'
+#        option 'tun4Address' '10.66.66.1/24'
+
+
+#config 'tunOut'
+#        option 'tunOut' 'ip6'
+#        option 'network' '2012::/16'
+#        option 'exportDistance' '0'
+
+#config 'tunOut'
+#        option 'tunOut' 'ip4'
+#        option 'network' '10.0.0.0/9'
+#        option 'minPrefixLen' '27'
+
+
+
+
+
diff --git a/bmx7/files/etc/init.d/bmx6 b/bmx7/files/etc/init.d/bmx6
deleted file mode 100755 (executable)
index cb2d5b3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/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/bmx6
-CONF=/etc/config/bmx6
-PID=/var/run/bmx6/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/files/etc/init.d/bmx7 b/bmx7/files/etc/init.d/bmx7
new file mode 100755 (executable)
index 0000000..6886739
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh /etc/rc.common
+#    Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#    The full GNU General Public License is included in this distribution in
+#    the file called "COPYING".
+
+START=91
+
+BIN=/usr/sbin/bmx7
+CONF=/etc/config/bmx7
+PID=/var/run/bmx7/pid
+
+
+start() {
+       cd /root/
+       while pgrep -f mac80211.sh ; do sleep 1; done
+       ulimit -c 20000
+       $BIN -f $CONF -d0 > /dev/null &
+}
+
+stop() {
+       start-stop-daemon -p $PID -K
+}
+
+restart() {
+       stop; sleep 3; start
+}
index 5d29dae..794bd9e 100644 (file)
@@ -1,7 +1,7 @@
-Index: bmx6-r2014112401/lib/bmx6_json/json.c
+Index: bmx7-r2014112401/lib/bmx7_json/json.c
 ===================================================================
---- bmx6-r2014112401.orig/lib/bmx6_json/json.c
-+++ bmx6-r2014112401/lib/bmx6_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>
index 36772cd..8efd282 100644 (file)
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cjdns
-PKG_VERSION:=0.16
-PKG_RELEASE:=15
+PKG_VERSION:=0.17
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL:=https://github.com/hyperboria/cjdns.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=951581191997db0188b56d8b21c5216f7e6e2ee1
+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)
@@ -38,7 +38,7 @@ define Package/cjdns
        TITLE:=Encrypted near-zero-conf mesh routing protocol
        URL:=https://github.com/hyperboria/cjdns
        MAINTAINER:=Lars Gierth <larsg@systemli.org>
-       DEPENDS:=+kmod-tun +kmod-ipv6 +libnl-tiny +libpthread +librt \
+       DEPENDS:=@IPV6 +kmod-tun +libnl-tiny +libpthread +librt \
                +libuci-lua +lua-bencode +dkjson +luasocket +lua-sha2
 endef
 
@@ -66,7 +66,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
@@ -77,6 +77,7 @@ PKG_DO_VARS+= UCLIBC=1
 endif
 
 define Build/Compile
+       $(INSTALL_DIR) $(PKG_BUILD_DIR)/tmp
        CROSS="true" \
        CC="$(TARGET_CC)" \
        AR="$(TARGET_AR)" \
@@ -87,6 +88,7 @@ define Build/Compile
        TARGET_ARCH="$(CONFIG_ARCH)" \
        SSP_SUPPORT="$(CONFIG_SSP_SUPPORT)" \
        GYP_ADDITIONAL_ARGS="-f make-linux" \
+       CJDNS_BUILD_TMPDIR="$(PKG_BUILD_DIR)/tmp" \
        $(PKG_DO_VARS) \
        $(PKG_BUILD_DIR)/do
 endef
index 03e3fb9..6390f13 100644 (file)
@@ -7,8 +7,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hnetd
-PKG_SOURCE_VERSION:=a6b4b6f1f5d38646fa11064cf7394719e048bc87
-PKG_VERSION:=2015-07-28-$(PKG_SOURCE_VERSION)
+PKG_SOURCE_VERSION:=606d7e904603ad8792ac1a7ba825618df97b5a4e
+PKG_VERSION:=2016-06-28-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
@@ -38,7 +38,7 @@ define Package/hnetd/Default
   TITLE:=HNCP Homenet daemon - $(2)
   URL:=https://github.com/sbyx/hnetd
   DEPENDS:=+odhcpd +odhcp6c +netifd $(3)
-  DEPENDS+=+@IPV6
+  DEPENDS+=@IPV6
   VARIANT:=$1
 endef
 
@@ -54,7 +54,7 @@ define Package/hnet-full
   # Routing
   DEPENDS+=+babeld
   # Service discovery
-  DEPENDS+=+ohybridproxy
+  DEPENDS+=+ohybridproxy +zonestitcher
   # Distributed PCP support
   DEPENDS+=+miniupnpd +minimalist-pcproxy
 endef
@@ -68,7 +68,7 @@ define Package/hnet-full-secure
   # Routing
   DEPENDS+=+babeld
   # Service discovery
-  DEPENDS+=+ohybridproxy
+  DEPENDS+=+ohybridproxy +zonestitcher
   # Distributed PCP support
   DEPENDS+=+miniupnpd +minimalist-pcproxy
 endef
@@ -82,7 +82,7 @@ define Package/hnet-full-l2tp
   # Routing
   DEPENDS+=+babeld
   # Service discovery
-  DEPENDS+=+ohybridproxy
+  DEPENDS+=+ohybridproxy +zonestitcher
   # Distributed PCP support
   DEPENDS+=+miniupnpd +minimalist-pcproxy
 endef
@@ -115,11 +115,14 @@ define Package/hnetd-$(BUILD_VARIANT)/install
        $(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
-       $(INSTALL_BIN) ./files/ohp-script $(1)/usr/sbin/hnetd-ohp-script
-       $(INSTALL_BIN) ./files/pcp-script $(1)/usr/sbin/hnetd-pcp-script
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ohp.script $(1)/usr/sbin/hnetd-ohp-script
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ddz.script $(1)/usr/sbin/hnetd-ddz-script
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/pcp.script $(1)/usr/sbin/hnetd-pcp-script
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
        $(INSTALL_DIR) $(1)/etc/uci-defaults
        $(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/multicast.script $(1)/usr/sbin/hnet-multicast
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/autowifi.script $(1)/usr/sbin/autowifi
 endef
 
 define Package/hnet-full/install
index 6ac396f..f2a7ab7 100644 (file)
@@ -11,10 +11,19 @@ config security security
 
 config pa pa
 #      option ip4prefix 10.0.0.0/8
+#      option ip4mode ifuplink
 #      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
 #      option domain_name home.
+
+
+# Wifi allows for very basic wifi autoconfiguration
+# Warning: This feature is unstable
+config wifi wifi
+#      option enable 0
+#       option ssid ssidtest
+#       option password test
index 8dc7871..5ca7388 100644 (file)
@@ -1,7 +1,12 @@
 #!/bin/sh
 
+# Why we tune dnsmasq?
+# localservice=0 => other hnetd instances can query for local names
+# boguspriv=0 => allow reverse resolution of RFC1918 w/o local hosts entries
+
 uci batch <<EOF
 set dhcp.odhcpd.maindhcp=1
 set dhcp.@dnsmasq[0].localservice=0
+set dhcp.@dnsmasq[0].boguspriv=0
 commit dhcp
 EOF
index 6b98b8c..94cd6b8 100644 (file)
@@ -12,8 +12,12 @@ DNSMASQ_DIR=/tmp/dnsmasq.d
 DNSMASQ_SCRIPT=/etc/init.d/dnsmasq
 OHP_SCRIPT=/usr/sbin/hnetd-ohp-script
 OHP_BINARY=/usr/sbin/ohybridproxy
+DDZ_SCRIPT=/usr/sbin/hnetd-ddz-script
+DDZ_BINARY=/usr/sbin/zonestitcher
 PCP_SCRIPT=/usr/sbin/hnetd-pcp-script
 PCP_BINARY=/usr/sbin/minimalist-pcproxy
+MULTICAST_SCRIPT=/usr/sbin/hnet-multicast
+WIFI_SCRIPT=/usr/sbin/autowifi
 
 start_service() {
     . /lib/functions.sh
@@ -36,6 +40,27 @@ start_service() {
         then
             procd_append_param command -n "$HOSTNAME"
         fi
+        if [ -f $DDZ_BINARY ]
+        then
+            procd_append_param command -z $DDZ_SCRIPT
+        fi
+    fi
+       
+    # Enable multicast if present and installed
+    if [ -f "$MULTICAST_SCRIPT" ]
+    then
+        $MULTICAST_SCRIPT status && procd_append_param command -M "$MULTICAST_SCRIPT"
+    fi
+
+    config_get enableval wifi enable
+    if [ -f "$WIFI_SCRIPT" -a "$enableval" = "1" ]; then
+        wifiopt=$WIFI_SCRIPT
+        config_get ssidval wifi ssid
+        config_get passval wifi password
+        if [ -n "$ssidval" -a -n "$passval"  ]; then
+            wifiopt=${wifiopt},${ssidval}:${passval}
+        fi
+        procd_append_param command -w "$wifiopt"
     fi
 
     # Enable PCP, if it's present
@@ -58,6 +83,9 @@ start_service() {
     config_get val pa ip4prefix
     [ -n "$val" ] && procd_append_param command --ip4prefix $val
 
+    config_get val pa ip4mode
+    [ -n "$val" ] && procd_append_param command --ip4mode $val
+
     config_get val pa ulaprefix
     [ -n "$val" ] && procd_append_param command --ulaprefix $val
 
diff --git a/hnetd/files/ohp-script b/hnetd/files/ohp-script
deleted file mode 100644 (file)
index aebaa1d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh 
-#-*-sh-*-
-#
-# $Id: ohp-script $
-#
-# Author: Markus Stenberg <mstenber@cisco.com>
-#
-# Copyright (c) 2014 cisco Systems, Inc.
-#
-# Created:       Fri Jan 17 11:46:30 2014 mstenber
-# Last modified: Mon Feb  3 14:39:15 2014 mstenber
-# Edit time:     15 min
-#
-
-# This is minimalist init.d-like start/stop script for
-# ohybridproxy. However, as ohybridproxy receives it's configuration
-# via command line, the 'start' command is also equivalent to
-# 'restart', and has bunch of extra arguments..
-
-OHP=ohybridproxy
-
-start() {
-    $OHP $* &
-}
-
-stop() {
-    killall -9 $OHP
-}
-
-
-CMD=$1
-# For debugging purposes
-LOGNAME=`basename $0`
-echo "$*" | logger -t "$LOGNAME"
-case $CMD in
-  start)
-    shift
-    stop
-    start $*
-    ;;
-  stop)
-  stop
-    ;;
-  *)
-    echo "Only start [config]/stop supported"
-    exit 1
-  ;;
-esac
diff --git a/hnetd/files/pcp-script b/hnetd/files/pcp-script
deleted file mode 100644 (file)
index 88648d2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#-*-sh-*-
-#
-# $Id: pcp-script $
-#
-# Author: Markus Stenberg <mstenber@cisco.com>
-#
-# Copyright (c) 2014 cisco Systems, Inc.
-#
-# Created:       Fri Jan 17 11:46:30 2014 mstenber
-# Last modified: Fri May 30 13:27:57 2014 mstenber
-# Edit time:     16 min
-#
-
-# Copied from ohp-script.. Same idea. Just prod minimalist-pcproxy as
-# needed, hoping the miniupnpd is taken care of by the system.
-
-PCP=minimalist-pcproxy
-
-start() {
-    $PCP $* &
-}
-
-stop() {
-    killall -9 $PCP
-}
-
-
-CMD=$1
-# For debugging purposes
-LOGNAME=`basename $0`
-echo "$*" | logger -t "$LOGNAME"
-case $CMD in
-  start)
-    shift
-    stop
-    start $*
-    ;;
-  stop)
-  stop
-    ;;
-  *)
-    echo "Only start [config]/stop supported"
-    exit 1
-  ;;
-esac
index dfe9ab1..a4a8e43 100644 (file)
@@ -112,12 +112,16 @@ function wget(url, timeout)
        if pid == 0 then
                rfd:close()
                nixio.dup(wfd, nixio.stdout)
-
-               local candidates = { "/usr/bin/wget", "/bin/wget" }
+               -- candidates for wget, try first ones with SSL support
+               local candidates = {{"/usr/bin/wget-ssl",1},{"/usr/bin/wget",0},{"/bin/wget",0}}
                local _, bin
                for _, bin in ipairs(candidates) do
-                       if nixiofs.access(bin, "x") then
-                               nixio.exec(bin, "-q", "-O", "-", url)
+                       if nixiofs.access(bin[1], "x") then
+                               if bin[2] == 0 then
+                                       nixio.exec(bin[1], "-q", "-O", "-", url)
+                               else
+                                       nixio.exec(bin[1], "--no-check-certificate", "-q", "-O", "-", url)
+                               end
                        end
                end
                return
index d4e0745..8ff3520 100644 (file)
@@ -27,7 +27,8 @@ m = Map("bmx6", "bmx6")
 -- Getting json and Checking if bmx6-json is avaiable
 local options = bmx6json.get("options")
 if options == nil or options.OPTIONS == nil then
-        m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
+       m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
+       return m
 else
        options = options.OPTIONS
 end
diff --git a/luci-app-bmx7/COPYING b/luci-app-bmx7/COPYING
new file mode 100644 (file)
index 0000000..d511905
--- /dev/null
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/luci-app-bmx7/Makefile b/luci-app-bmx7/Makefile
new file mode 100644 (file)
index 0000000..a9e96f7
--- /dev/null
@@ -0,0 +1,63 @@
+#    Copyright © 2011 Pau Escrich <pau@dabax.net>
+#    Contributors Roger Pueyo Centelles <roger.pueyo@guifi.net>
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#    The full GNU General Public License is included in this distribution in
+#    the file called "COPYING".
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luci-app-bmx7
+PKG_RELEASE:=0.0-alpha
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+PKG_LICENSE:=GPL-2.0+
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luci-app-bmx7
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=3. Applications
+  TITLE:= LuCI support for BMX7
+  DEPENDS:=+luci-lib-json +luci-mod-admin-full +luci-lib-httpclient +bmx7
+  MAINTAINER:= Roger Pueyo Centelles <roger.pueyo@guifi.net>
+endef
+
+define Package/luci-app-bmx7/description
+       LuCI application for web-based configuration and visualization of the BMX7 routing daemon
+endef
+
+define Package/luci-app-bmx7/conffiles
+       /etc/config/luci-bmx7
+endef
+
+define Build/Prepare
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/luci-app-bmx7/install
+       $(CP) ./files/* $(1)/
+       chmod 755 $(1)/www/cgi-bin/bmx7-info
+endef
+
+$(eval $(call BuildPackage,luci-app-bmx7))
+
diff --git a/luci-app-bmx7/files/etc/config/luci-bmx7 b/luci-app-bmx7/files/etc/config/luci-bmx7
new file mode 100644 (file)
index 0000000..46a7727
--- /dev/null
@@ -0,0 +1,7 @@
+config 'bmx7' 'luci'
+       option ignore '0'
+       option place 'admin network BMX7'
+       #option place 'qmp Mesh'
+       option position '3'
+       #option json 'http://127.0.0.1/cgi-bin/bmx7-info?'
+       option json 'exec:/www/cgi-bin/bmx7-info -s'
diff --git a/luci-app-bmx7/files/usr/lib/lua/luci/controller/bmx7.lua b/luci-app-bmx7/files/usr/lib/lua/luci/controller/bmx7.lua
new file mode 100644 (file)
index 0000000..ed62628
--- /dev/null
@@ -0,0 +1,77 @@
+--[[
+    Copyright (C) 2011 Pau Escrich <pau@dabax.net>
+    Contributors Jo-Philipp Wich <xm@subsignal.org>
+                 Roger Pueyo Centelles <roger.pueyo@guifi.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+    The full GNU General Public License is included in this distribution in
+    the file called "COPYING".
+--]]
+
+module("luci.controller.bmx7", package.seeall)
+
+function index()
+       local place = {}
+       local ucim = require "luci.model.uci"
+       local uci = ucim.cursor()
+
+       -- checking if ignore is on
+       if uci:get("luci-bmx7","luci","ignore") == "1" then
+               return nil
+       end
+
+       -- getting value from uci database
+       local uci_place = uci:get("luci-bmx7","luci","place")
+
+       -- default values
+       if uci_place == nil then
+               place = {"bmx7"}
+       else
+               local util = require "luci.util"
+               place = util.split(uci_place," ")
+       end
+
+       -- getting position of menu
+       local uci_position = uci:get("luci-bmx7","luci","position")
+
+
+       ---------------------------
+       -- Placing the pages in the menu
+       ---------------------------
+
+       -- Status (default)
+       entry(place,call("action_status_j"),place[#place],tonumber(uci_position))
+
+       table.insert(place,"Status")
+       entry(place,call("action_status_j"),"Status",0)
+       table.remove(place)
+
+       -- Nodes list
+       table.insert(place,"Nodes")
+       entry(place,call("action_nodes_j"),"Nodes",1)
+       table.remove(place)
+end
+
+
+function action_status_j()
+       luci.template.render("bmx7/status_j", {})
+end
+
+function action_nodes_j()
+       local http = require "luci.http"
+       local link_non_js = "/cgi-bin/luci" .. http.getenv("PATH_INFO") .. '/nodes_nojs'
+       luci.template.render("bmx7/nodes_j", {link_non_js=link_non_js})
+end
diff --git a/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/nodes_j.htm b/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/nodes_j.htm
new file mode 100644 (file)
index 0000000..347af42
--- /dev/null
@@ -0,0 +1,175 @@
+<%#
+   Copyright © 2011 Pau Escrich <pau@dabax.net>
+   Contributors Lluis Esquerda <eskerda@gmail.com>
+                Roger Pueyo Centelles <roger.pueyo@guifi.net>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation, Inc.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+   The full GNU General Public License is included in this distribution in
+   the file called "COPYING".
+-%>
+
+<%+header%>
+<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
+
+
+<style>
+
+       div.hideme{
+               display: none;
+       }
+
+       div.info{
+               background: #FFF;
+               border: solid 0px;
+               height: 90px;
+               display: block;
+               overflow: auto;
+       }
+
+       div.inforow{
+               text-align:left;
+               display:inline-block;
+               margin:10px;
+               vertical-align:top;
+               float: left;
+               white-space:nowrap;
+       }
+
+       div.inforow.newline{
+               clear: both;
+       }
+
+       u {
+    text-decoration: underline;
+       } 
+
+#extra-info ul { list-style: none outside none; margin-left: 0em; }
+
+</style>
+<div class="cbi-map">
+
+<h2>Mesh nodes</h2>
+<div class="cbi-map-descr"></div>
+<div id="extra-info" class="info">
+       <br />
+       <center>
+       Tip: click the <img src="<%=resource%>/bmx7/world.png" /> icon to see individual node information.
+       </center>
+</div>
+<fieldset class="cbi-section">
+       <legend><%:Originators%></legend>
+       <table class="cbi-section-table" id="descriptions_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"></th>
+                       <th class="cbi-section-table-cell"><%:Name%></th>
+                       <th class="cbi-section-table-cell"><%:Short ID%></th>
+                       <th class="cbi-section-table-cell"><%:S/s/T/t%></th>
+                       <th class="cbi-section-table-cell"><%:Primary IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Via neighbour%></th>
+                       <th class="cbi-section-table-cell"><%:Metric%></th>
+                       <th class="cbi-section-table-cell"><%:Last desc.%></th>
+                       <th class="cbi-section-table-cell"><%:Last ref.%></th>
+                       <th class="cbi-section-table-cell"><%: %></th>
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="11"><br /><center><em><%:Collecting data...%></em></center></td>
+               </tr>
+       </table>
+</fieldset>
+
+</div>
+
+<script type="text/javascript">//<![CDATA[
+               var displayExtraInfo = function ( id ) {
+                       console.log('aaa'+id)
+                       document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
+               }
+
+               new TablePooler(5,"/cgi-bin/bmx7-info", {'$originators':''}, "descriptions_table", function(st){
+                       var infoicon = "<%=resource%>/bmx7/world_small.png";
+                       var originators = st.originators;
+                       var res = Array();
+
+                       originators.forEach(function(originator,i){
+                               var name =  originator.name;
+                               var shortId =  originator.shortId;
+                               var nodeId = originator.nodeId;
+                               var extensions = originator.name;
+                               var SsTt = originator.S+'/'+originator.s+'/'+originator.T+'/'+originator.t;
+                               var nodeKey = originator.nodeKey;
+                               var descSize = originator.descSize;
+                               var primaryIp = originator.primaryIp;
+                               var nbName = originator.nbName;
+                               var dev = originator.dev;
+                               var nbLocalIp = originator.nbLocalIp;
+                               var metric = originator.metric;
+                               var lastDesc = originator.lastDesc;
+                               var lastRef = originator.lastRef;
+                               
+                       var extrainfo = '<a onclick="displayExtraInfo(\'ip-' + i + '\')"><img src="' + infoicon + '" / ></a>';
+                       var extrainfo_link = '<a onclick="displayExtraInfo(\'ip-' + i + '\')">' +  '<img src="' + infoicon + '" />' + '</a>';
+       
+                       extrainfo = '<div id="ip-'+ i +'" class="hideme">'
+
+                       + "<div class='inforow'>"
+                       + "<h4><u>" + name  + '</u></h4>\n'
+                       + 'Node ID: ' + nodeId + "</div>"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Primary IPv6 address</h5>\n"
+                       + primaryIp + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Support & Trust</h5>\n"
+                       + SsTt + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Node key</h5>\n"
+                       + nodeKey + "</div>\n"
+
+                       + "<div class='inforow newline'>"
+                       + "<h5>Via neighbour</h5>\n"
+                       + nbName + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Via device</h5>\n"
+                       + dev + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Via remote link-local IPv6 address</h5>\n"
+                       + nbLocalIp + "</div>\n"
+                       
+                       + "<div class='inforow'>"
+                       + "<h5>Route metric</h5>\n"
+                       + metric + "</div>\n"
+
+                       + "<div class='inforow'>"
+                       + "<h5>Desc. size</h5>\n"
+                       + descSize + "</div>\n"
+
+                       + "\n</div>";
+
+                       res.push([extrainfo_link, name, shortId, SsTt, primaryIp,
+                                                               nbName, metric, lastDesc, lastRef, extrainfo]);
+
+                 });
+                 return res;
+               });
+//]]></script>
+
+<%+footer%>
+
diff --git a/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/status_j.htm b/luci-app-bmx7/files/usr/lib/lua/luci/view/bmx7/status_j.htm
new file mode 100644 (file)
index 0000000..c6920f9
--- /dev/null
@@ -0,0 +1,182 @@
+<%+header%>
+<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+<script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
+
+<style>
+       div.hideme{
+               display: none;
+       }
+
+       div.info{
+               background: #FFF;
+               border: solid 1px;
+               height: 80px;
+               display: block;
+               overflow: auto;
+       }
+
+       div.inforow{
+               text-align:left;
+               display:inline-block;
+               width:20%;
+               margin:5px;
+               vertical-align:top;
+       }
+
+       #extra-info ul { list-style: none outside none; margin-left: 0em; }
+</style>
+
+<div class="cbi-map">
+       <center>
+               <img src="<%=resource%>/bmx7/bmx7logo.png" />
+               <br />
+               <br />
+               A mesh routing protocol for Linux devices.<br />
+               Visit <a href="http://bmx6.net">bmx6.net</a> for more information.<br />
+               <br />
+       </center>
+
+<div class="cbi-map-descr"></div>
+
+<fieldset class="cbi-section">
+       <legend><%:Node configuration%></legend>
+       <table class="cbi-section-table" id="config_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Short ID%></th>
+                       <th class="cbi-section-table-cell"><%:Node name%></th>
+                       <th class="cbi-section-table-cell"><%:Primary IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Node key%></th>
+                       <th class="cbi-section-table-cell"><%:BMX7 revision%></th>
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="5"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <legend><%:Node status%></legend>
+       <table class="cbi-section-table" id="status_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Nodes seen%></th>
+                       <th class="cbi-section-table-cell"><%:Neighbours%></th>
+                       <th class="cbi-section-table-cell"><%:Tunnelled IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Tunnelled IPv4 address%></th>
+                       <th class="cbi-section-table-cell"><%:Uptime%></th>
+                       <th class="cbi-section-table-cell"><%:CPU usage%></th>
+                       <th class="cbi-section-table-cell"><%:Memory usage%></th>
+                       <th class="cbi-section-table-cell"><%:Tx queue%></th>
+
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="8"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <legend><%:Interfaces%></legend>
+       <table class="cbi-section-table" id="ifaces_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Interface%></th>
+                       <th class="cbi-section-table-cell"><%:State%></th>
+                       <th class="cbi-section-table-cell"><%:Type%></th>
+                       <th class="cbi-section-table-cell"><%:Max. rate%></th>
+                       <th class="cbi-section-table-cell"><%:Link-local IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Rx BpP%></th>
+                       <th class="cbi-section-table-cell"><%:Tx BpP%></th>
+
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="7"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <legend><%:Links%></legend>
+       <table class="cbi-section-table" id="links_table">
+               <tr class="cbi-section-table-titles">
+                       <th class="cbi-section-table-cell"><%:Short ID%></th>
+                       <th class="cbi-section-table-cell"><%:Name%></th>
+                       <th class="cbi-section-table-cell"><%:Link key%></th>
+                       <th class="cbi-section-table-cell"><%:Remote link-local IPv6 address%></th>
+                       <th class="cbi-section-table-cell"><%:Device%></th>
+                       <th class="cbi-section-table-cell"><%:Rx rate%></th>
+                       <th class="cbi-section-table-cell"><%:Tx rate%></th>
+                       <th class="cbi-section-table-cell"><%:Routes%></th>
+
+               </tr>
+               <tr class="cbi-section-table-row">
+                       <td colspan="8"><em><br /><%:Collecting data...%></em></td>
+               </tr>
+       </table>
+</fieldset>
+
+
+</div>
+
+<script type="text/javascript">//<![CDATA[
+       new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "config_table", function(st){
+               var res = Array();
+               var sta = st.info[0].status;
+               var ifaces = st.info[1].interfaces;
+
+               res.push([sta.shortId, sta.name, sta.primaryIp, sta.nodeKey, sta.revision]);
+               res.push(['','','','',''])
+               res.push(['','','','',''])
+
+               return res;
+       });
+
+
+       new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "status_table", function(st){
+               var res = Array();
+               var sta = st.info[0].status;
+               var mem = st.info[3].memory;
+
+               var txQ = sta.txQ.split('/');
+               console.log(txQ)
+
+               var ptxQ = '<p style="color:rgb('+parseInt(255*txQ[0]/txQ[1])+','+parseInt(128*(txQ[1]-txQ[0])/txQ[1])+',0)")>'+sta.txQ+'</p>';
+               console.log(ptxQ)
+
+               res.push([sta.nodes, sta.nbs, sta.tun6Address, sta.tun4Address, sta.uptime, sta.cpu, mem.bmx7, ptxQ]);
+
+               res.push(['','','','','','','',''])
+               res.push(['','','','','','','',''])
+
+               return res;
+       });
+
+               new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "ifaces_table", function(st){
+               var res = Array();
+               var sta = st.info[0].status;
+               var ifaces = st.info[1].interfaces;
+
+               ifaces.forEach(function(iface){
+                       res.push([iface.dev, iface.state, iface.type, iface.rateMax, iface.localIp, iface.rxBpP, iface.txBpP]);
+               });
+               res.push(['','','','','','',''])
+               if (ifaces.length % 2 == 0)
+                       res.push('')
+               res.push(['','','','','','',''])
+               return res;
+       });
+
+               new TablePooler(1,"/cgi-bin/bmx7-info", {'links':''}, "links_table", function(st){
+               var res = Array();
+               links = st.links;
+
+               links.forEach(function(link){
+                       res.push([link.shortId, link.name, link.linkKey, link.nbLocalIp, link.dev, link.rxRate, link.txRate, link.routes]);
+               });
+               res.push(['','','','','','','',''])
+               if (links.length % 2 == 0)
+                       res.push([])
+               res.push(['','','','','','','',''])
+               return res;
+       });
+//]]></script>
+
+<%+footer%>
diff --git a/luci-app-bmx7/files/www/cgi-bin/bmx7-info b/luci-app-bmx7/files/www/cgi-bin/bmx7-info
new file mode 100755 (executable)
index 0000000..8c501c5
--- /dev/null
@@ -0,0 +1,136 @@
+#!/bin/sh
+#    Copyright © 2011 Pau Escrich
+#    Contributors Jo-Philipp Wich <xm@subsignal.org>
+#                 Roger Pueyo Centelles <roger.pueyo@guifi.net>
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#    The full GNU General Public License is included in this distribution in
+#    the file called "COPYING".
+#
+#    This script gives information about bmx7
+#    Can be executed from a linux shell: ./bmx7-info -s links
+#    Or from web interfae (with cgi enabled): http://host/cgi-bin/bmx7-info?links
+#    If you ask for a directory you wil get the directory contents in JSON forman
+
+BMX7_DIR="$(uci get bmx7.general.runtimeDir 2>/dev/null)" || BMX7_DIR="/var/run/bmx7/json"
+
+#Checking if shell mode or cgi-bin mode
+if [ "$1" == "-s" ]; then
+       QUERY="$2"
+else
+       QUERY="${QUERY_STRING%%=*}"
+       echo "Content-type: application/json"
+       echo ""
+
+fi
+
+check_path() {
+        [ -d "$1" ] && path=$(cd $1; pwd)
+        [ -f "$1" ] && path=$(cd $1/..; pwd)
+        [ $(echo "$path" | grep -c "^$BMX7_DIR") -ne 1 ] && exit 1
+}
+
+print_mem() {
+       echo -n '{ "memory": { "bmx7": "'
+       cat /proc/$(cat /var/run/bmx7/pid)/status |grep -i VmSize | tr -s " " | cut -d " " -f 2,3 | tr -d "\n"
+       echo '"}}'
+}
+
+print_query() {
+       # If the query is a directory
+       [ -d "$BMX7_DIR/$1" ] &&
+        {
+       # If /all has not been specified
+               [ -z "$QALL" ] &&
+               {
+               total=$(ls $BMX7_DIR/$1 | wc -w)
+               i=1
+               echo -n "{ \"$1\": [ "
+               for f in $(ls $BMX7_DIR/$1); do
+                       echo -n "{ \"name\": \"$f\" }"
+                       [ $i -lt $total ]  && echo -n ','
+                       i=$(( $i + 1 ))
+               done
+               echo -n " ] }"
+
+       # If /all has been specified, printing all the files together
+               } || {
+               comma=""
+               echo -n "[ "
+               for entry in "$BMX7_DIR/$1/"*; do
+                       [ -f "$entry" ] &&
+                       {
+                               ${comma:+echo "$comma"}
+                               tr -d '\n' < "$entry"
+                               comma=","
+                       }
+               done
+               echo -n " ]"
+               }
+        }
+
+       # If the query is a file, just printing the file
+       [ -f "$BMX7_DIR/$1" ] && cat "$BMX7_DIR/$1";
+}
+
+if [ "${QUERY##*/}" == "all" ]; then
+       QUERY="${QUERY%/all}"
+       QALL=1
+fi
+
+if [ "$QUERY" == '$info' ]; then
+       echo '{ "info": [ '
+       print_query status
+       echo -n ","
+       print_query interfaces
+       echo -n ","
+       print_query links
+       echo -n ","
+       print_mem
+       echo "] }"
+fi
+
+if [ "$QUERY" == '$neighbours' ]; then
+       QALL=1
+       echo '{ "neighbours": [ '
+       echo '{ "originators": '
+       print_query originators
+       echo '}, '
+       echo '{ "descriptions": '
+       print_query descriptions
+       echo "} ] }"
+       exit 0
+
+else if [ "$QUERY" == '$tunnels' ]; then
+       bmx7 -c --jshow tunnels /r=0
+       exit 0
+
+       else if [ "$QUERY" == '$originators' ]; then
+               bmx7 -c --jshow originators /r=0
+               exit 0
+
+               else
+               check_path "$BMX7_DIR/$QUERY"
+               print_query $QUERY
+               exit 0
+               fi
+       fi
+fi
+fi
+
+ls -1F "$BMX7_DIR"
+exit 0
+
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png b/luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png
new file mode 100644 (file)
index 0000000..c7d9cea
Binary files /dev/null and b/luci-app-bmx7/files/www/luci-static/resources/bmx7/bmx7logo.png differ
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/js/polling.js b/luci-app-bmx7/files/www/luci-static/resources/bmx7/js/polling.js
new file mode 100644 (file)
index 0000000..4a382eb
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+    Copyright © 2011 Pau Escrich <pau@dabax.net>
+    Contributors Lluis Esquerda <eskerda@gmail.com>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+    The full GNU General Public License is included in this distribution in
+    the file called "COPYING".
+*/
+
+
+/*
+       Table pooler is a function to easy call XHR poller. 
+
+       new TablePooler(5,"/cgi-bin/bmx7-info", {'status':''}, "status_table", function(st){
+               var table = Array()
+               table.push(st.first,st.second)
+               return table
+       }
+
+       The parameters are: 
+               polling_time: time between pollings
+               json_url: the json url to fetch the data
+               json_call: the json call
+               output_table_id: the table where javascript will put the data
+               callback_function: the function that will be executed each polling_time
+       
+       The callback_function must return an array of arrays (matrix).
+       In the code st is the data obtained from the json call
+*/
+
+function TablePooler (time, jsonurl, getparams, table_id, callback) {
+       this.table = document.getElementById(table_id);
+       this.callback = callback;
+       this.jsonurl = jsonurl;
+       this.getparams = getparams;
+       this.time = time;
+
+       /* clear all rows */
+       this.clear = function(){
+               while( this.table.rows.length > 1 ) this.table.deleteRow(1);
+       }
+
+       this.start = function(){
+               XHR.poll(this.time, this.jsonurl, this.getparams, function(x, st){
+                       var data = this.callback(st);
+                       var content, tr, td;
+                       this.clear();
+                       for (var i = 0; i < data.length; i++){
+                               tr = this.table.insertRow(-1);
+                               tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
+
+                               for (var j = 0; j < data[i].length; j++){
+                                       td = tr.insertCell(-1);
+                                       if (data[i][j].length == 2) {
+                                               td.colSpan = data[i][j][1];
+                                               content = data[i][j][0];
+                                       }
+                                       else content = data[i][j];
+                                       td.innerHTML = content;
+                               }
+                       }
+               }.bind(this));
+       }
+
+
+       this.start();
+}
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png
new file mode 100644 (file)
index 0000000..29b53c9
Binary files /dev/null and b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world.png differ
diff --git a/luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png
new file mode 100644 (file)
index 0000000..f5f3105
Binary files /dev/null and b/luci-app-bmx7/files/www/luci-static/resources/bmx7/world_small.png differ
index d0c2f06..36faa8d 100644 (file)
@@ -27,7 +27,7 @@ define Package/minimalist-pcproxy
   CATEGORY:=Network
   TITLE:=Lightweight PCP proxy
   URL:=https://github.com/fingon/minimalist-pcproxy
-  DEPENDS:=+libubox +@IPV6
+  DEPENDS:=+libubox @IPV6
 endef
 
 define Package/minimalist-pcproxy/description
index 1822926..97f0b6c 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=miniupnpd
-PKG_VERSION:=1.9.20150609
-PKG_RELEASE:=1
+PKG_VERSION:=2.0
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=http://miniupnp.free.fr/files
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=01ee891286683891240a29b7272d790e
+PKG_MD5SUM:=1c07a215dd9b362e75a9efc05e2fb3b4
 
 PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi>
 PKG_LICENSE:=BSD-3-Clause
@@ -23,7 +23,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/miniupnpd
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables
+  DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables +libuuid
   TITLE:=Lightweight UPnP IGD, NAT-PMP & PCP daemon
   SUBMENU:=Firewall
   URL:=http://miniupnp.free.fr/
@@ -50,9 +50,10 @@ define Build/Prepare
 endef
 
 MAKE_FLAGS += \
-       TEST=0 \
+       TARGET_OPENWRT=1 TEST=0 \
        LIBS="" \
-       CC="$(TARGET_CC) -DIPTABLES_143 -lip4tc $(if $(CONFIG_IPV6),-lip6tc)" \
+       CC="$(TARGET_CC) -DIPTABLES_143 \
+               -lip4tc $(if $(CONFIG_IPV6),-lip6tc) -luuid" \
        CONFIG_OPTIONS="$(if $(CONFIG_IPV6),--ipv6) --leasefile" \
        -f Makefile.linux \
        miniupnpd
index 818af9d..0eb96d7 100644 (file)
@@ -5,6 +5,7 @@ IP6TABLES=/usr/sbin/ip6tables
 
 iptables -t filter -N MINIUPNPD 2>/dev/null
 iptables -t nat -N MINIUPNPD 2>/dev/null
+iptables -t nat -N MINIUPNPD-POSTROUTING 2>/dev/null
 
 [ -x $IP6TABLES ] && $IP6TABLES -t filter -N MINIUPNPD 2>/dev/null
 
@@ -20,6 +21,7 @@ add_extzone_rules() {
     # IPv4 - due to NAT, need to add both to nat and filter table
     iptables -t filter -I zone_${ext_zone}_forward -j MINIUPNPD
     iptables -t nat -I zone_${ext_zone}_prerouting -j MINIUPNPD
+    iptables -t nat -I zone_${ext_zone}_postrouting -j MINIUPNPD-POSTROUTING
 
     # IPv6 if available - filter only
     [ -x $IP6TABLES ] && {
diff --git a/miniupnpd/patches/100-no-ssl.patch b/miniupnpd/patches/100-no-ssl.patch
deleted file mode 100644 (file)
index 343e615..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/Makefile.linux
-+++ b/Makefile.linux
-@@ -147,7 +147,8 @@ LDLIBS += $(shell $(PKG_CONFIG) --static
- LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
- endif # ($(TEST),1)
--LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
-+# n/a - we don't enable https server for IGD v2 anyway
-+#LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
- TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
diff --git a/miniupnpd/patches/101-no-ssl-uuid.patch b/miniupnpd/patches/101-no-ssl-uuid.patch
new file mode 100644 (file)
index 0000000..81cea10
--- /dev/null
@@ -0,0 +1,23 @@
+We do not need to autodetect SSL/UUID; SSL we do not support, UUID we always do.
+
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -153,14 +153,18 @@ LDLIBS += $(shell $(PKG_CONFIG) --static
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
+ endif # ($(TEST),1)
++ifeq ($(TARGET_OPENWRT),)
++# n/a - we don't enable https server for IGD v2 anyway in OpenWrt
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
++# n/a - we hardcodedly support libuuid
+ TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1)
+ ifeq ($(TEST),1)
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l uuid)
+ else
+ $(info please install uuid-dev package / libuuid)
+ endif # ($(TEST),1)
++endif
+ TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
index fdb2af4..806c7fd 100644 (file)
@@ -1,6 +1,6 @@
 --- a/pcpserver.c
 +++ b/pcpserver.c
-@@ -1004,6 +1004,7 @@ static int CreatePCPMap_NAT(pcp_info_t *
+@@ -982,6 +982,7 @@ static int CreatePCPMap_NAT(pcp_info_t *
                                   timestamp);
        if (r < 0)
                return PCP_ERR_NO_RESOURCES;
index 61c023a..50d5a39 100644 (file)
@@ -17,7 +17,7 @@ As the OpenWRT buildsystem already passes the right compile flags, we can skip t
  #        testiptpinhole
 --- a/Makefile.linux
 +++ b/Makefile.linux
-@@ -70,7 +70,6 @@ CPPFLAGS += -DIPTABLES_143
+@@ -73,7 +73,6 @@ CPPFLAGS += -DIPTABLES_143
  endif
  
  CFLAGS  += $(shell $(PKG_CONFIG) --cflags libiptc)
diff --git a/miniupnpd/patches/104-always-libuuid.patch b/miniupnpd/patches/104-always-libuuid.patch
new file mode 100644 (file)
index 0000000..d6c0770
--- /dev/null
@@ -0,0 +1,20 @@
+As it turns out, the 'magic' libuuid/bsd uuid check just checks
+outside buildtree altogether for the uuid_generate. So we just
+hardcode it.
+
+--- a/genconfig.sh
++++ b/genconfig.sh
+@@ -367,12 +367,7 @@ case $FW in
+ esac
+ # UUID API
+-if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then
+-      echo "#define BSD_UUID" >> ${CONFIGFILE}
+-fi
+-if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then
+-      echo "#define LIB_UUID" >> ${CONFIGFILE}
+-fi
++echo "#define LIB_UUID" >> ${CONFIGFILE}
+ # set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above
+ if [ -z "$V6SOCKETS_ARE_V6ONLY" ] ; then
index 65b92c2..0283dd4 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=nat46
-PKG_VERSION:=6
+PKG_VERSION:=7
 PKG_RELEASE:=$(PKG_SOURCE_VERSION)
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
@@ -37,7 +37,7 @@ define Package/464xlat
 endef
 
 define KernelPackage/nat46
-  DEPENDS:=+kmod-ipv6
+  DEPENDS:=@IPV6
   TITLE:=Stateless NAT46 translation kernel module
   SECTION:=kernel
   SUBMENU:=Network Support
index ebc764c..9a3d55e 100644 (file)
@@ -11,11 +11,11 @@ PKG_NAME:=ndppd
 PKG_VERSION:=0.2.3
 PKG_RELEASE:=1
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=$(PKG_VERSION).tar.gz
 
 # Latest release
-PKG_SOURCE_URL:=http://www.priv.nu/projects/ndppd/files/
-PKG_MD5SUM:=d6f3243bb7fc04c8085371c9acddc50e
+PKG_SOURCE_URL:=https://github.com/DanielAdolfsson/ndppd/archive
+PKG_MD5SUM:=1391c063db64b47541e58da12e5ae60d
 PKG_LICENSE:=GPL-3.0+
 
 # Development snapshot
@@ -32,7 +32,7 @@ define Package/ndppd
   TITLE:=NDP Proxy Daemon
   URL:=http://www.priv.nu/projects/ndppd/
   MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
-  DEPENDS:=+kmod-ipv6 $(CXX_DEPENDS)
+  DEPENDS:=@IPV6 $(CXX_DEPENDS)
 endef
 
 define Package/ndppd/description
index 11fa5fc..76a5e14 100644 (file)
@@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nodogsplash
 PKG_FIXUP:=autoreconf
-PKG_VERSION:=0.9_beta9.9.9
-PKG_RELEASE:=6
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=git://github.com/nodogsplash/nodogsplash.git
-PKG_SOURCE_VERSION:=v0.9_beta9.9.9
+PKG_SOURCE_VERSION:=v1.0.0
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=GPL-2.0+
index dbefeb4..986a3d9 100644 (file)
@@ -1,9 +1,15 @@
-config instance
+
+# The options available here are an adaptation of the settings used in nodogsplash.conf.
+# See https://github.com/nodogsplash/nodogsplash/blob/master/resources/nodogsplash.conf
+
+config nodogsplash
   # Set to 1 to enable nodogsplash
   option enabled 0
 
-  # Use plain configuration file as well
+  # Use plain configuration file
   #option config '/etc/nodogsplash/nodogsplash.conf'
+
+  # The network the users are connected to
   option network 'lan'
   option gatewayname 'OpenWrt Nodogsplash'
   option maxclients '250'
@@ -36,4 +42,12 @@ config instance
   list users_to_router 'allow tcp port 80'
   list users_to_router 'allow tcp port 443'
 
-  # See https://github.com/nodogsplash for a full list of available options.
+  # MAC addresses that are / are not allowed to access the splash page
+  # Value is either 'allow' or 'block'. The allowedmac or blockedmac list is used.
+  #option macmechanism 'allow'
+  #list allowedmac '00:00:C0:01:D0:0D'
+  #list allowedmac '00:00:C0:01:D0:1D'
+  #list blockedmac '00:00:C0:01:D0:2D'
+
+  #MAC addresses that do not need to authenticate
+  #list trustedmac '00:00:C0:01:D0:1D'
index 0712fa9..f3df6a1 100755 (executable)
@@ -60,26 +60,6 @@ append_config_option() {
   [ -n "$val" ] && echo "$option_name $val" >> $config_file
 }
 
-setup_user_authentication() {
-  local cfg="$1"
-  local val
-
-  config_get_bool val "$cfg" authenticate_immediately 0
-  [ $val -gt 0 ] && echo "AuthenticateImmediately yes" >> $CONFIGFILE
-
-  config_get val "$cfg" username
-  if [ -n "$val" ] ; then
-    echo "UsernameAuthentication" >> $CONFIGFILE
-    echo "Username $val" >> $CONFIGFILE
-  fi
-
-  config_get val "$cfg" password
-  if [ -n "$val" ] ; then
-    echo "PasswordAuthentication" >> $CONFIGFILE
-    echo "Password $val" >> $CONFIGFILE
-  fi
-}
-
 setup_mac_lists() {
   local cfg="$1"
   local MAC=""
@@ -152,11 +132,11 @@ generate_uci_config() {
 
   config_get val "$cfg" config
   if [ -n "$val" ] ; then
-    if [ -f "$val" ] ; then
+    if [ -f "$val" ] ; then
       nolog error "Configuration file '$file' doesn't exist"
       return 0
     fi
-    cat $val > CONFIGFILE
+    cat "$val" >> $CONFIGFILE
   fi
 
   config_get val "$cfg" network
@@ -225,7 +205,6 @@ generate_uci_config() {
   [ -n "$upload" -o -n "$download" ] && echo "TrafficControl yes" >> $CONFIGFILE
 
   setup_mac_lists "$cfg"
-  setup_user_authentication "$cfg"
   setup_firewall "$cfg"
 }
 
@@ -257,7 +236,7 @@ start_service() {
   mkdir -p /tmp/etc/
   config_load nodogsplash
 
-  config_foreach create_instance instance
+  config_foreach create_instance nodogsplash
 }
 
 stop_service() {
index 1d96804..7d88f5d 100644 (file)
@@ -7,8 +7,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ohybridproxy
-PKG_SOURCE_VERSION:=f2ba152799c481471ddc0213b3f98b1c143d97a3
-PKG_VERSION:=2015-01-12-$(PKG_SOURCE_VERSION)
+PKG_SOURCE_VERSION:=8a28ae92c97099e771c9ede5641e3782ae809c27
+PKG_VERSION:=2016-06-28-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
@@ -51,3 +51,24 @@ define Package/ohybridproxy/install
 endef
 
 $(eval $(call BuildPackage,ohybridproxy))
+
+define Package/zonestitcher
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=dynamically combine multiple DNS zones into one
+  URL:=https://github.com/sbyx/ohybridproxy
+  DEPENDS+=+libubox
+endef
+
+define Package/zonestitcher/description
+ This package provides a statically configured daemon for translating DNS
+ requests to Multicast DNS and back again.
+endef
+
+define Package/zonestitcher/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/zonestitcher $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,zonestitcher))
index 4e8c7b0..e6f85f7 100644 (file)
@@ -1,5 +1,5 @@
 # 
-# Copyright (C) 2009-2012 OpenWrt.org
+# Copyright (C) 2009-2016 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,13 +8,16 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=olsrd
-PKG_VERSION:=0.9.0.2
-PKG_RELEASE:=4
+PKG_VERSION:=0.9.0.3
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://www.olsr.org/releases/0.9
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/OLSR/olsrd.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=v0.9.0.3
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_MIRROR_MD5SUM:=
 
-PKG_MD5SUM:=8a2675c33990706cc291b59934024783
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=BSD-3-Clause
 
index 3ced911..43c7e67 100644 (file)
@@ -397,7 +397,7 @@ olsrd_write_olsrd() {
        [ "$OLSRD_COUNT" -gt 0 ] && return 0
 
        config_get ipversion "$cfg" IpVersion
-       if [ "$UCI_CONF_NAME" == "olsrd6" ]; then
+       if [ "$UCI_CONF_NAME" = "olsrd6" ]; then
                OLSRD_OLSRD_SCHEMA="$OLSRD_OLSRD_SCHEMA IpVersion=6"
                if [ "$ipversion" = "6and4" ]; then
                        error "IpVersion 6and4 not supported in olsrd6"
@@ -703,21 +703,29 @@ olsrd_setup_smartgw_rules() {
        IP6T=$(which ip6tables)
 
        # Delete smartgw firewall rules first
-       for IPT in $IP4T $IP6T; do
-               while $IPT -D forwarding_rule -o tnl_+ -j ACCEPT 2> /dev/null; do :;done
+       if [ "$UCI_CONF_NAME" = "olsrd6" ]; then
+               while $IP6T -D forwarding_rule -o tnl_+ -j ACCEPT 2> /dev/null; do :;done
                for IFACE in $wanifnames; do
-                       while $IPT -D forwarding_rule -i tunl0 -o $IFACE -j ACCEPT 2> /dev/null; do :; done
+                       while $IP6T -D forwarding_rule -i tunl0 -o $IFACE -j ACCEPT 2> /dev/null; do :; done
                done
                for IFACE in $ifsglobal; do
-                       while $IPT -D input_rule -i $IFACE -p 4 -j ACCEPT 2> /dev/null; do :; done
+                       while $IP6T -D input_rule -i $IFACE -p 4 -j ACCEPT 2> /dev/null; do :; done
                done
-       done
-       while $IP4T -t nat -D postrouting_rule -o tnl_+ -j MASQUERADE 2> /dev/null; do :;done
+       else
+               while $IP4T -D forwarding_rule -o tnl_+ -j ACCEPT 2> /dev/null; do :;done
+               for IFACE in $wanifnames; do
+                       while $IP4T -D forwarding_rule -i tunl0 -o $IFACE -j ACCEPT 2> /dev/null; do :; done
+               done
+               for IFACE in $ifsglobal; do
+                       while $IP4T -D input_rule -i $IFACE -p 4 -j ACCEPT 2> /dev/null; do :; done
+               done
+               while $IP4T -t nat -D postrouting_rule -o tnl_+ -j MASQUERADE 2> /dev/null; do :;done
+       fi
 
-       if [ "$smartgateway" == "yes" ]; then
+       if [ "$smartgateway" = "yes" ]; then
                log "$funcname() Notice: Inserting firewall rules for SmartGateway"
-               if [ ! "$smartgatewayuplink" == "none" ]; then
-                       if [ "$smartgatewayuplink" == "ipv4" ]; then
+               if [ ! "$smartgatewayuplink" = "none" ]; then
+                       if [ "$smartgatewayuplink" = "ipv4" ]; then
                                # Allow everything to be forwarded to tnl_+ and use NAT for it
                                $IP4T -I forwarding_rule -o tnl_+ -j ACCEPT
                                $IP4T -t nat -I postrouting_rule -o tnl_+ -j MASQUERADE
@@ -731,7 +739,7 @@ olsrd_setup_smartgw_rules() {
                                for IFACE in $ifsglobal; do
                                        $IP4T -I input_rule -i $IFACE -p 4 -j ACCEPT
                                done
-                       elif [ "$smartgatewayuplink" == "ipv6" ]; then
+                       elif [ "$smartgatewayuplink" = "ipv6" ]; then
                                $IP6T -I forwarding_rule -o tnl_+ -j ACCEPT
                                if [ "$nowan"="0" ]; then
                                        for IFACE in $wanifnames; do
index b230b94..e0002b3 100755 (executable)
@@ -3,7 +3,7 @@
 case "${ACTION}" in
        ifup)
                . /etc/rc.common /etc/init.d/${DAEMON} enabled && {
-                       logger -t '${DAEMON}[hotplug]' -p daemon.info 'reloading configuration'
+                       logger -t "${DAEMON}[hotplug]" -p daemon.info 'reloading configuration'
                        . /etc/rc.common /etc/init.d/${DAEMON} reload
                }
        ;;
diff --git a/pimbd/Makefile b/pimbd/Makefile
new file mode 100644 (file)
index 0000000..9f97107
--- /dev/null
@@ -0,0 +1,48 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pimbd
+PKG_SOURCE_VERSION:=68f5fc803119e4b33a88b35c096f4d6ac28b6de5
+PKG_VERSION:=2015-08-18-$(PKG_SOURCE_VERSION)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/Oryon/pimbd.git
+PKG_MAINTAINER:=Pierre Pfister <pierre.pfister@darou.fr>
+PKG_LICENSE:=Apache-2.0
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+# Spammy debug builds for now
+CMAKE_OPTIONS += -DL_LEVEL=7
+
+define Package/pimbd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=PIM BIDIR daemon
+  URL:=https://github.com/Oryon/pimbd.git
+  DEPENDS+=@IPV6
+  DEPENDS+=netifd
+endef
+
+define Package/pimbd/description
+This package provides a daemon which implements the Protocol Independent
+Multicast BIDIR routing protocol. Note that a routing protocol must be 
+installed and running in order for PIM to function.
+endef
+
+define Package/pimbd/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/pimbd $(1)/usr/sbin/pimbd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/pimbc.sh $(1)/usr/sbin/pimbc
+       ln -s pimbd $(1)/usr/sbin/pimb-ipc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pimbd.init $(1)/etc/init.d/pimbd
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) files/firewall-uci.sh $(1)/etc/uci-defaults/99_pimbd_firewall
+endef
+
+$(eval $(call BuildPackage,pimbd))
diff --git a/pimbd/files/firewall-uci.sh b/pimbd/files/firewall-uci.sh
new file mode 100644 (file)
index 0000000..5ee20b3
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+pim_rule () {
+uci -q batch <<-EOT
+       delete firewall.$1
+       set firewall.$1=rule
+       set firewall.$1.name='$2 multicast forward for $3'
+       set firewall.$1.src='*'
+       set firewall.$1.dest='*'
+       set firewall.$1.family='$2'
+       set firewall.$1.proto='udp'
+       set firewall.$1.dest_ip='$3'
+       set firewall.$1.target='ACCEPT'
+EOT
+}
+
+pim_rule pimbd4 ipv4 224.0.0.0/4
+pim_rule pimbd6 ipv6 ff00::/8
+uci commit firewall
+
+exit 0
+
diff --git a/pimbd/files/pimbd.init b/pimbd/files/pimbd.init
new file mode 100644 (file)
index 0000000..20b27bd
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+
+START=90
+STOP=10
+USE_PROCD=1
+
+start_service() {
+    . /lib/functions.sh
+    . /lib/functions/network.sh
+    config_load pimb
+
+    procd_open_instance
+    procd_set_param command /usr/sbin/pimbd
+    procd_append_param command -S
+    procd_append_param command -L 6
+
+    procd_set_param respawn
+    procd_close_instance
+}
+
+