olsrd: Merge branch 'olsrd_6and4' by Alessio Caiazza.
authorSaverio Proto <zioproto@gmail.com>
Sun, 8 Jun 2014 09:00:27 +0000 (11:00 +0200)
committerSaverio Proto <zioproto@gmail.com>
Sun, 8 Jun 2014 09:29:54 +0000 (11:29 +0200)
41 files changed:
alfred/Makefile
babeld/Makefile
babeld/files/babeld.config
babeld/files/babeld.init
batctl/Makefile [new file with mode: 0644]
batman-adv/Config.in
batman-adv/Makefile
batman-adv/files/etc/config/batman-adv
batman-adv/files/lib/batman-adv/config.sh
batman-adv/files/lib/netifd/proto/batadv_vlan.sh [new file with mode: 0644]
batman-adv/patches/0001-batman-adv-fix-neigh_ifinfo-imbalance.patch [deleted file]
batman-adv/patches/0002-batman-adv-fix-neigh-reference-imbalance.patch [deleted file]
batman-adv/patches/0003-batman-adv-always-run-purge_orig_neighbors.patch [deleted file]
batman-adv/patches/0004-batman-adv-fix-removing-neigh_ifinfo.patch [deleted file]
batman-adv/patches/0005-batman-adv-fix-local-TT-check-for-outgoing-arp-reque.patch [deleted file]
batman-adv/patches/0006-batman-adv-change-the-MAC-of-each-VLAN-upon-ndo_set_.patch [deleted file]
batman-adv/patches/0007-batman-adv-fix-indirect-hard_iface-NULL-dereference.patch [deleted file]
batman-adv/patches/0008-batman-adv-fix-reference-counting-imbalance-while-se.patch [deleted file]
batman-adv/patches/0009-batman-adv-increase-orig-refcount-when-storing-ref-i.patch [deleted file]
bmx6/files/etc/init.d/bmx6
hnetd/Makefile
hnetd/files/hnet.config [new file with mode: 0644]
hnetd/files/hnetd.init
hnetd/files/pcp-script [new file with mode: 0644]
minimalist-pcproxy/Makefile [new file with mode: 0644]
minimalist-pcproxy/files/minimalist-pcproxy.defaults [new file with mode: 0644]
miniupnpd/Makefile [new file with mode: 0644]
miniupnpd/files/firewall.include [new file with mode: 0644]
miniupnpd/files/miniupnpd.defaults [new file with mode: 0644]
miniupnpd/files/miniupnpd.hotplug [new file with mode: 0644]
miniupnpd/files/miniupnpd.init [new file with mode: 0644]
miniupnpd/files/upnpd.config [new file with mode: 0644]
miniupnpd/patches/100-no-ssl.patch [new file with mode: 0644]
miniupnpd/patches/101-ipv6-pinhole.patch [new file with mode: 0644]
miniupnpd/patches/102-ipv6-ext-port.patch [new file with mode: 0644]
nat46/Makefile [new file with mode: 0644]
olsrd/Makefile
olsrd/patches/001-Fix-processing-error-for-fragmented-hellos.patch [deleted file]
olsrd/patches/002-hotfix-long-http-headers-txtinfo.patch [deleted file]
olsrd/patches/003-hotfix-long-http-headers-json.patch [deleted file]
olsrd/patches/004-jsonplugin-http-headers.patch [deleted file]

index 44d66c3d1c0b369150212e7a593ec776ddf849af..9aa3c7d57f95ee82703fd2dfc01f96637fbe9af8 100644 (file)
@@ -11,9 +11,9 @@ include $(TOPDIR)/rules.mk
 # The latest alfred git hash in PKG_REV can be obtained from http://git.open-mesh.org/alfred.git
 #
 PKG_NAME:=alfred
-PKG_VERSION:=2014.1.0
+PKG_VERSION:=2014.2.0
 PKG_RELEASE:=0
-PKG_MD5SUM:=aaee0fbbc3aa011ba9c0a1d3f3b2801e
+PKG_MD5SUM:=d9afaa2fb1f518938fef9ca8145a762c
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
index d858ad6c9aed3447689709636d8db6c668db9dd3..d7a9ddcc34f50e7af34adf321bbf48cd7195bf17 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=babeld
-PKG_VERSION:=1.4.2
-PKG_RELEASE:=2
+PKG_VERSION:=1.5.0
+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:=a48e8129f221f66640ae1ccf73190991
+PKG_MD5SUM:=ac884beb644792bdb79f0042755820ee
 
 include $(INCLUDE_DIR)/package.mk
 
index a4f00e68da8cee1d46daca4af7e7a578307cca98..88fdf2de7963a72d04f4dbb5ad00c14dd580e5b6 100644 (file)
@@ -49,6 +49,12 @@ config interface wlan
        # packet loss is expected.  The default is four times the hello
        # interval.
        ## option 'update_interval' '16'
+       # Options to enable and configure RTT-based metric
+       ## option 'enable_timestamps' 'false'
+       ## option 'max_rtt_penalty' '0'
+       ## option 'rtt_decay' '42'
+       ## option 'rtt_min' '10'
+       ## option 'rtt_max' '120'
 
 config interface lan
        option 'ignore' 'true'
index f2cf50ac4cf81bce99e5876f9438d5a37b394a78..0e1f039b5a00787ce0a82bd2aaef8f90a1738027 100755 (executable)
@@ -93,6 +93,11 @@ babel_addif() {
        append_parm "$cfg" 'rxcost' 'rxcost'
        append_parm "$cfg" 'hello_interval' 'hello-interval'
        append_parm "$cfg" 'update_interval' 'update-interval'
+       append_bool "$cfg" 'enable_timestamps' 'enable-timestamps'
+       append_parm "$cfg" 'max_rtt_penalty' 'max-rtt-penalty'
+       append_parm "$cfg" 'rtt_decay' 'rtt-decay'
+       append_parm "$cfg" 'rtt_min' 'rtt-min'
+       append_parm "$cfg" 'rtt_max' 'rtt-max'
 
        append args ' ' "'"
 }
diff --git a/batctl/Makefile b/batctl/Makefile
new file mode 100644 (file)
index 0000000..ae22286
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=batctl
+
+PKG_VERSION:=2014.2.0
+PKG_RELEASE:=1
+PKG_MD5SUM:=c196cf95b7324d9123b701a56b06b31d
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
+
+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/
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-batman-adv +libnl-tiny +libc
+  TITLE:=B.A.T.M.A.N. Advanced user space configuration tool batctl
+  MAINTAINER:=Marek Lindner <mareklindner@neomailbox.ch>
+endef
+
+define Package/batctl/description
+batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
+It is an easier method for configuring batman-adv and provides some
+additional tools for debugging as well. This package builds
+version $(PKG_VERSION) of the user space utility.
+endef
+
+# The linker can identify unused sections of a binary when each symbol is stored
+# in a separate section. This mostly removes unused linker sections and reduces
+# the size by ~3% on mipsel.
+
+TARGET_CFLAGS  += -ffunction-sections -fdata-sections
+TARGET_LDFLAGS += -Wl,--gc-sections
+
+# Link-time optimization allows to move parts of the optimization from the single
+# source file to the global source view. This is done by emitting the GIMPLE
+# representation in each object file and analyzing it again during the link step.
+
+TARGET_CFLAGS  += -flto
+TARGET_LDFLAGS += -fuse-linker-plugin
+
+MAKE_BATCTL_ENV += \
+        CPPFLAGS="$(TARGET_CPPFLAGS)" \
+        CFLAGS="$(TARGET_CFLAGS)" \
+        LDFLAGS="$(TARGET_LDFLAGS)" \
+        LIBNL_NAME="libnl-tiny"
+
+MAKE_BATCTL_ARGS += \
+        REVISION="$(PKG_BATCTL_SHORTREV)" \
+        CC="$(TARGET_CC)" \
+        DESTDIR="$(PKG_INSTALL_DIR)" \
+        batctl install
+
+
+define Build/Compile
+       $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS)
+endef
+
+define Build/Clean
+       rm -rf $(BUILD_DIR)/$(PKG_NAME)/
+endef
+
+define Package/batctl/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,batctl))
index 133052568f84345f4eaa40aa71ee3238f8e659fb..86fc795a6218243700d26f82f322f303bf6a4636 100644 (file)
@@ -14,16 +14,13 @@ config KMOD_BATMAN_ADV_DAT
        depends on PACKAGE_kmod-batman-adv
        default y
 
+config KMOD_BATMAN_ADV_MCAST
+       bool "enable multicast transmission optimization"
+       depends on PACKAGE_kmod-batman-adv
+       default y
+
 config KMOD_BATMAN_ADV_NC
        bool "enable network coding [requires promisc mode support]"
        depends on PACKAGE_kmod-batman-adv
        default n
 
-config KMOD_BATMAN_ADV_BATCTL
-       bool "enable batctl"
-       depends on PACKAGE_kmod-batman-adv
-       default y
-       help
-         batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
-         It is an easier method for configuring batman-adv and
-         provides some additional tools for debugging as well.
index 4ab66f1517df5af0314a86f46cd0d25c67a1423f..889dea7bbe7abf3bbbe5234244407e37dbfb3d9f 100644 (file)
@@ -10,17 +10,14 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
 
-PKG_VERSION:=2014.1.0
-BATCTL_VERSION:=2014.1.0
-PKG_RELEASE:=3
-PKG_MD5SUM:=d55aabb2bc508194407187648c773c1b
-BATCTL_MD5SUM:=92fd4cb60e38ec952fb5fdda4b2e6933
+PKG_VERSION:=2014.2.0
+PKG_RELEASE:=1
+PKG_MD5SUM:=1243029b3a3e2f4fa721d1a59c2faaf5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
-PKG_BATCTL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION)
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/kernel.mk
@@ -29,7 +26,7 @@ define KernelPackage/batman-adv
   URL:=http://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 +libc +libnl-tiny
+  DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c
   TITLE:=B.A.T.M.A.N. Adv
   FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
   AUTOLOAD:=$(call AutoLoad,50,batman-adv)
@@ -37,9 +34,8 @@ endef
 
 define KernelPackage/batman-adv/description
 B.A.T.M.A.N. advanced is a kernel module which allows to
-build layer 2 mesh networks. This package contains the
-version $(PKG_VERSION) of the kernel module plus its user space
-configuration & managerment tool batctl.
+build layer 2 mesh networks. This package builds
+version $(PKG_VERSION) of the kernel module.
 endef
 
 define KernelPackage/batman-adv/config
@@ -57,74 +53,18 @@ MAKE_BATMAN_ADV_ARGS += \
        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
 
-# The linker can identify unused sections of a binary when each symbol is stored
-# in a separate section. This mostly removes unused linker sections and reduces 
-# the size by ~3% on mipsel.
-
-TARGET_CFLAGS  += -ffunction-sections -fdata-sections
-TARGET_LDFLAGS += -Wl,--gc-sections
-
-# Link-time optimization allows to move parts of the optimization from the single
-# source file to the global source view. This is done by emitting the GIMPLE
-# representation in each object file and analyzing it again during the link step.
-
-TARGET_CFLAGS  += -flto
-TARGET_LDFLAGS += -fuse-linker-plugin
-
-MAKE_BATCTL_ENV += \
-       CPPFLAGS="$(TARGET_CPPFLAGS)" \
-       CFLAGS="$(TARGET_CFLAGS)" \
-       LDFLAGS="$(TARGET_LDFLAGS)" \
-       LIBNL_NAME="libnl-tiny"
-
-MAKE_BATCTL_ARGS += \
-       REVISION="" \
-       CC="$(TARGET_CC)" \
-       DESTDIR="$(PKG_INSTALL_DIR)" \
-       batctl install
-
-ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
-define Download/batctl
-  FILE:=batctl-$(BATCTL_VERSION).tar.gz
-  URL:=$(PKG_SOURCE_URL)
-  MD5SUM:=$(BATCTL_MD5SUM)
-endef
-$(eval $(call Download,batctl))
-
-BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
-BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*")
-BATCTL_BUILD = $(MAKE_BATCTL_ENV) $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
-BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
-endif
-
-KPATCH ?= $(PATCH)
-define Build/DoPatch
-       @if [ -d "$(2)" ]; then \
-               if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \
-                       $(KPATCH) "$(1)" "$(2)" "$(3)"; \
-               fi; \
-       fi
-endef
-
-define Build/Patch
-       $(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)","*batman*")
-       $(BATCTL_EXTRACT)
-       $(BATCTL_PATCH)
-endef
-
 define Build/Prepare
        $(call Build/Prepare/Default)
        $(SED) '/#define _NET_BATMAN_ADV_MAIN_H_/a\#undef CONFIG_MODULE_STRIPPED' \
                $(PKG_BUILD_DIR)/main.h
 endef
 
-
 define Build/Compile
        $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS)
-       $(BATCTL_BUILD)
 endef
 
 define Build/Clean
@@ -137,7 +77,7 @@ define KernelPackage/batman-adv/install
        $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
        $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
        $(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
-       $(BATCTL_INSTALL)
+       $(INSTALL_BIN) ./files/lib/netifd/proto/batadv_vlan.sh $(1)/lib/netifd/proto
 endef
 
 $(eval $(call KernelPackage,batman-adv))
index 8865ce995e853dfe71595c275ae3ee1e41ed3eee..f38855ebac5873c0f1243f33e37cfc979df3da87 100644 (file)
@@ -12,6 +12,7 @@ config 'mesh' 'bat0'
        option 'vis_mode'
        option 'bridge_loop_avoidance'
        option 'distributed_arp_table'
+       option 'multicast_mode'
        option 'network_coding'
        option 'hop_penalty'
        option 'isolation_mark'
index c65a4b47424a5899442c8c0d6d78d233c0366de1..1429a43a9053f3f6c96a5747144b1c31265b3917 100644 (file)
@@ -26,6 +26,7 @@ bat_config()
        config_get gw_sel_class "$mesh" gw_sel_class
        config_get hop_penalty "$mesh" hop_penalty
        config_get isolation_mark "$mesh" isolation_mark
+       config_get multicast_mode "$mesh" multicast_mode
        config_get network_coding "$mesh" network_coding
        config_get log_level "$mesh" log_level
        config_get orig_interval "$mesh" orig_interval
@@ -44,6 +45,7 @@ bat_config()
        [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
        [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
        [ -n "$isolation_mark" ] && echo $isolation_mark > /sys/class/net/$mesh/mesh/isolation_mark
+       [ -n "$multicast_mode" ] && echo $multicast_mode > /sys/class/net/$mesh/mesh/multicast_mode 2>&-
        [ -n "$network_coding" ] && echo $network_coding > /sys/class/net/$mesh/mesh/network_coding 2>&-
        [ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&-
        [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval
diff --git a/batman-adv/files/lib/netifd/proto/batadv_vlan.sh b/batman-adv/files/lib/netifd/proto/batadv_vlan.sh
new file mode 100644 (file)
index 0000000..85002c3
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. ../netifd-proto.sh
+init_proto "$@"
+
+proto_batadv_vlan_init_config() {
+       proto_config_add_string "ap_isolation"
+}
+
+proto_batadv_vlan_setup() {
+       local config="$1"
+       local iface="$2"
+
+       # VLAN specific variables
+       local device="${iface%.*}"
+       local vid="${iface#*.}"
+
+       # batadv_vlan options
+       local ap_isolation
+
+       json_get_vars ap_isolation
+
+       echo "$ap_isolation" > "/sys/class/net/${device}/mesh/vlan${vid}/ap_isolation"
+       proto_init_update "$iface" 1
+       proto_send_update "$config"
+}
+
+add_protocol batadv_vlan
diff --git a/batman-adv/patches/0001-batman-adv-fix-neigh_ifinfo-imbalance.patch b/batman-adv/patches/0001-batman-adv-fix-neigh_ifinfo-imbalance.patch
deleted file mode 100644 (file)
index 528845b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-From a424cd5a2c956ef1f0353d7e5f2b7fbc4af7d2d8 Mon Sep 17 00:00:00 2001
-From: Simon Wunderlich <simon@open-mesh.com>
-Date: Wed, 26 Mar 2014 15:46:21 +0100
-Subject: [PATCH 1/9] batman-adv: fix neigh_ifinfo imbalance
-
-The neigh_ifinfo object must be freed if it has been used in
-batadv_iv_ogm_process_per_outif().
-
-This is a regression introduced by
-9bb33b8d88e318c4879d37d06ad28e3e018b9036 ("batman-adv: split tq
-information in neigh_node struct")
-
-Reported-by: Antonio Quartulli <antonio@open-mesh.com>
-Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
----
- bat_iv_ogm.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
-index 8323bce..d074d06 100644
---- a/bat_iv_ogm.c
-+++ b/bat_iv_ogm.c
-@@ -1545,6 +1545,8 @@ out_neigh:
-       if ((orig_neigh_node) && (!is_single_hop_neigh))
-               batadv_orig_node_free_ref(orig_neigh_node);
- out:
-+      if (router_ifinfo)
-+              batadv_neigh_ifinfo_free_ref(router_ifinfo);
-       if (router)
-               batadv_neigh_node_free_ref(router);
-       if (router_router)
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0002-batman-adv-fix-neigh-reference-imbalance.patch b/batman-adv/patches/0002-batman-adv-fix-neigh-reference-imbalance.patch
deleted file mode 100644 (file)
index 9df9855..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-From cdd09f69871ce8c98b8ae9fa0583f73938768943 Mon Sep 17 00:00:00 2001
-From: Simon Wunderlich <simon@open-mesh.com>
-Date: Wed, 26 Mar 2014 15:46:22 +0100
-Subject: [PATCH 2/9] batman-adv: fix neigh reference imbalance
-
-When an interface is removed from batman-adv, the orig_ifinfo of a
-orig_node may be removed without releasing the router first.
-This will prevent the reference for the neighbor pointed at by the
-orig_ifinfo->router to be released, and this leak may result in
-reference leaks for the interface used by this neighbor. Fix that.
-
-This is a regression introduced by
-de6bcc76ea84fecb136f8c8f5ba1862e4a13f06b ("batman-adv: split out router
-from orig_node").
-
-Reported-by: Antonio Quartulli <antonio@open-mesh.com>
-Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
----
- originator.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/originator.c b/originator.c
-index 8539416..25df60d 100644
---- a/originator.c
-+++ b/originator.c
-@@ -500,12 +500,17 @@ batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
- static void batadv_orig_ifinfo_free_rcu(struct rcu_head *rcu)
- {
-       struct batadv_orig_ifinfo *orig_ifinfo;
-+      struct batadv_neigh_node *router;
-       orig_ifinfo = container_of(rcu, struct batadv_orig_ifinfo, rcu);
-       if (orig_ifinfo->if_outgoing != BATADV_IF_DEFAULT)
-               batadv_hardif_free_ref_now(orig_ifinfo->if_outgoing);
-+      /* this is the last reference to this object */
-+      router = rcu_dereference_protected(orig_ifinfo->router, true);
-+      if (router)
-+              batadv_neigh_node_free_ref_now(router);
-       kfree(orig_ifinfo);
- }
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0003-batman-adv-always-run-purge_orig_neighbors.patch b/batman-adv/patches/0003-batman-adv-always-run-purge_orig_neighbors.patch
deleted file mode 100644 (file)
index 78e381b..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-From 72125152cc46e55793329984428032769648904e Mon Sep 17 00:00:00 2001
-From: Simon Wunderlich <simon@open-mesh.com>
-Date: Wed, 26 Mar 2014 15:46:23 +0100
-Subject: [PATCH 3/9] batman-adv: always run purge_orig_neighbors
-
-The current code will not execute batadv_purge_orig_neighbors() when an
-orig_ifinfo has already been purged. However we need to run it in any
-case. Fix that.
-
-This is a regression introduced by
-de6bcc76ea84fecb136f8c8f5ba1862e4a13f06b ("batman-adv: split out router
-from orig_node")
-
-Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
----
- originator.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/originator.c b/originator.c
-index 25df60d..47b0886 100644
---- a/originator.c
-+++ b/originator.c
-@@ -857,7 +857,7 @@ static bool batadv_purge_orig_node(struct batadv_priv *bat_priv,
- {
-       struct batadv_neigh_node *best_neigh_node;
-       struct batadv_hard_iface *hard_iface;
--      bool changed;
-+      bool changed_ifinfo, changed_neigh;
-       if (batadv_has_timed_out(orig_node->last_seen,
-                                2 * BATADV_PURGE_TIMEOUT)) {
-@@ -867,10 +867,10 @@ static bool batadv_purge_orig_node(struct batadv_priv *bat_priv,
-                          jiffies_to_msecs(orig_node->last_seen));
-               return true;
-       }
--      changed = batadv_purge_orig_ifinfo(bat_priv, orig_node);
--      changed = changed || batadv_purge_orig_neighbors(bat_priv, orig_node);
-+      changed_ifinfo = batadv_purge_orig_ifinfo(bat_priv, orig_node);
-+      changed_neigh = batadv_purge_orig_neighbors(bat_priv, orig_node);
--      if (!changed)
-+      if (!changed_ifinfo && !changed_neigh)
-               return false;
-       /* first for NULL ... */
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0004-batman-adv-fix-removing-neigh_ifinfo.patch b/batman-adv/patches/0004-batman-adv-fix-removing-neigh_ifinfo.patch
deleted file mode 100644 (file)
index 495dae5..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-From 9b9cdbe28e2b9c8bdf9c761f22ba9655963d13d4 Mon Sep 17 00:00:00 2001
-From: Simon Wunderlich <simon@open-mesh.com>
-Date: Wed, 26 Mar 2014 15:46:24 +0100
-Subject: [PATCH 4/9] batman-adv: fix removing neigh_ifinfo
-
-When an interface is removed separately, all neighbors need to be
-checked if they have a neigh_ifinfo structure for that particular
-interface. If that is the case, remove that ifinfo so any references to
-a hard interface can be freed.
-
-This is a regression introduced by
-9bb33b8d88e318c4879d37d06ad28e3e018b9036 ("batman-adv: split tq
-information in neigh_node struct")
-
-Reported-by: Antonio Quartulli <antonio@open-mesh.com>
-Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
----
- originator.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 46 insertions(+)
-
-diff --git a/originator.c b/originator.c
-index 47b0886..aa2468b 100644
---- a/originator.c
-+++ b/originator.c
-@@ -702,6 +702,47 @@ free_orig_node:
- }
- /**
-+ * batadv_purge_neigh_ifinfo - purge obsolete ifinfo entries from neighbor
-+ * @bat_priv: the bat priv with all the soft interface information
-+ * @neigh_node: orig node which is to be checked
-+ */
-+static void
-+batadv_purge_neigh_ifinfo(struct batadv_priv *bat_priv,
-+                        struct batadv_neigh_node *neigh)
-+{
-+      struct batadv_neigh_ifinfo *neigh_ifinfo;
-+      struct batadv_hard_iface *if_outgoing;
-+      struct hlist_node *node_tmp;
-+
-+      spin_lock_bh(&neigh->ifinfo_lock);
-+
-+      /* for all ifinfo objects for this neighinator */
-+      hlist_for_each_entry_safe(neigh_ifinfo, node_tmp,
-+                                &neigh->ifinfo_list, list) {
-+              if_outgoing = neigh_ifinfo->if_outgoing;
-+
-+              /* always keep the default interface */
-+              if (if_outgoing == BATADV_IF_DEFAULT)
-+                      continue;
-+
-+              /* don't purge if the interface is not (going) down */
-+              if ((if_outgoing->if_status != BATADV_IF_INACTIVE) &&
-+                  (if_outgoing->if_status != BATADV_IF_NOT_IN_USE) &&
-+                  (if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED))
-+                      continue;
-+
-+              batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
-+                         "neighbor/ifinfo purge: neighbor %pM, iface: %s\n",
-+                         neigh->addr, if_outgoing->net_dev->name);
-+
-+              hlist_del_rcu(&neigh_ifinfo->list);
-+              batadv_neigh_ifinfo_free_ref(neigh_ifinfo);
-+      }
-+
-+      spin_unlock_bh(&neigh->ifinfo_lock);
-+}
-+
-+/**
-  * batadv_purge_orig_ifinfo - purge obsolete ifinfo entries from originator
-  * @bat_priv: the bat priv with all the soft interface information
-  * @orig_node: orig node which is to be checked
-@@ -800,6 +841,11 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv,
-                       hlist_del_rcu(&neigh_node->list);
-                       batadv_neigh_node_free_ref(neigh_node);
-+              } else {
-+                      /* only neccesary if not the whole neighbor is to be deleted,
-+                       * but some interface has been removed.
-+                       */
-+                      batadv_purge_neigh_ifinfo(bat_priv, neigh_node);
-               }
-       }
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0005-batman-adv-fix-local-TT-check-for-outgoing-arp-reque.patch b/batman-adv/patches/0005-batman-adv-fix-local-TT-check-for-outgoing-arp-reque.patch
deleted file mode 100644 (file)
index 85ce69a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-From 1c2e700fa93e6de3a2ae3725cf437504683b894a Mon Sep 17 00:00:00 2001
-From: Antonio Quartulli <antonio@open-mesh.com>
-Date: Sat, 29 Mar 2014 17:27:38 +0100
-Subject: [PATCH 5/9] batman-adv: fix local TT check for outgoing arp requests
- in DAT
-
-Change introduced by d6bd8b36fa1f3d72a6fd5942a6e9bde6ddafcd0d
-("batman-adv: make DAT drop ARP requests targeting local clients")
-implements a check that prevents DAT from using the caching
-mechanism when the client that is supposed to provide a reply
-to an arp request is local.
-
-However change brought by 3e26722bc9f248ec4316749fc1957365c0fa5e4b
-("batman-adv: make the Distributed ARP Table vlan aware")
-has not converted the above check into its vlan aware version
-thus making it useless when the local client is behind a vlan.
-
-Fix the behaviour by properly specifying the vlan when
-checking for a client being local or not.
-
-Reported-by: Simon Wunderlich <simon@open-mesh.com>
-Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
----
- distributed-arp-table.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/distributed-arp-table.c b/distributed-arp-table.c
-index 5bb37a8..a5d75be 100644
---- a/distributed-arp-table.c
-+++ b/distributed-arp-table.c
-@@ -940,8 +940,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
-                * additional DAT answer may trigger kernel warnings about
-                * a packet coming from the wrong port.
-                */
--              if (batadv_is_my_client(bat_priv, dat_entry->mac_addr,
--                                      BATADV_NO_FLAGS)) {
-+              if (batadv_is_my_client(bat_priv, dat_entry->mac_addr, vid)) {
-                       ret = true;
-                       goto out;
-               }
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0006-batman-adv-change-the-MAC-of-each-VLAN-upon-ndo_set_.patch b/batman-adv/patches/0006-batman-adv-change-the-MAC-of-each-VLAN-upon-ndo_set_.patch
deleted file mode 100644 (file)
index 239b5d9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-From 31f391475cc08724e96ab060ef4aa6503d11da8e Mon Sep 17 00:00:00 2001
-From: Antonio Quartulli <antonio@open-mesh.com>
-Date: Mon, 31 Mar 2014 13:48:10 +0200
-Subject: [PATCH 6/9] batman-adv: change the MAC of each VLAN upon
- ndo_set_mac_address
-
-The MAC address of the soft-interface is used to initialise
-the "non-purge" TT entry of each existing VLAN. Therefore
-when the user invokes ndo_set_mac_address() all the
-"non-purge" TT entries have to be updated, not only the one
-belonging to the non-tagged network.
-
-Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
----
- soft-interface.c | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/soft-interface.c b/soft-interface.c
-index f82c267..d962363 100644
---- a/soft-interface.c
-+++ b/soft-interface.c
-@@ -105,6 +105,7 @@ static struct net_device_stats *batadv_interface_stats(struct net_device *dev)
- static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
- {
-       struct batadv_priv *bat_priv = netdev_priv(dev);
-+      struct batadv_softif_vlan *vlan;
-       struct sockaddr *addr = p;
-       uint8_t old_addr[ETH_ALEN];
-@@ -115,12 +116,17 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
-       memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-       /* only modify transtable if it has been initialized before */
--      if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
--              batadv_tt_local_remove(bat_priv, old_addr, BATADV_NO_FLAGS,
-+      if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
-+              return 0;
-+
-+      rcu_read_lock();
-+      hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
-+              batadv_tt_local_remove(bat_priv, old_addr, vlan->vid,
-                                      "mac address changed", false);
--              batadv_tt_local_add(dev, addr->sa_data, BATADV_NO_FLAGS,
-+              batadv_tt_local_add(dev, addr->sa_data, vlan->vid,
-                                   BATADV_NULL_IFINDEX, BATADV_NO_MARK);
-       }
-+      rcu_read_unlock();
-       return 0;
- }
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0007-batman-adv-fix-indirect-hard_iface-NULL-dereference.patch b/batman-adv/patches/0007-batman-adv-fix-indirect-hard_iface-NULL-dereference.patch
deleted file mode 100644 (file)
index aa29c5d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-From 2ac2c94590d49e69ad8400a9df959533195143ed Mon Sep 17 00:00:00 2001
-From: Marek Lindner <mareklindner@neomailbox.ch>
-Date: Thu, 24 Apr 2014 03:44:25 +0800
-Subject: [PATCH 7/9] batman-adv: fix indirect hard_iface NULL dereference
-
-If hard_iface is NULL and goto out is made batadv_hardif_free_ref()
-doesn't check for NULL before dereferencing it to get to refcount.
-
-Introduced in f13f960797fd1969b3c0470cc97435ddfb6aecb4
-("batman-adv: add debugfs support to view multiif tables").
-
-Reported-by: Sven Eckelmann <sven@narfation.org>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
-Acked-by: Antonio Quartulli <antonio@meshcoding.com>
----
- originator.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/originator.c b/originator.c
-index aa2468b..35b42f8 100644
---- a/originator.c
-+++ b/originator.c
-@@ -1074,7 +1074,8 @@ int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset)
-       bat_priv->bat_algo_ops->bat_orig_print(bat_priv, seq, hard_iface);
- out:
--      batadv_hardif_free_ref(hard_iface);
-+      if (hard_iface)
-+              batadv_hardif_free_ref(hard_iface);
-       return 0;
- }
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0008-batman-adv-fix-reference-counting-imbalance-while-se.patch b/batman-adv/patches/0008-batman-adv-fix-reference-counting-imbalance-while-se.patch
deleted file mode 100644 (file)
index ab5a4b7..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-From 113f264b60bc4f50011a8f736d74f91ff7da11f1 Mon Sep 17 00:00:00 2001
-From: Antonio Quartulli <antonio@open-mesh.com>
-Date: Wed, 23 Apr 2014 14:05:16 +0200
-Subject: [PATCH 8/9] batman-adv: fix reference counting imbalance while
- sending fragment
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-In the new fragmentation code the batadv_frag_send_packet()
-function obtains a reference to the primary_if, but it does
-not release it upon return.
-
-This reference imbalance prevents the primary_if (and then
-the related netdevice) to be properly released on shut down.
-
-Fix this by releasing the primary_if in batadv_frag_send_packet().
-
-Introduced by db56e4ecf5c2b179a0101138eacc2ec52b6ef45d
-("batman-adv: Fragment and send skbs larger than mtu")
-
-Cc: Martin Hundebøll <martin@hundeboll.net>
-Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
-Acked-by: Martin Hundebøll <martin@hundeboll.net>
----
- fragmentation.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/fragmentation.c b/fragmentation.c
-index 88df9b1..cc1cfd6 100644
---- a/fragmentation.c
-+++ b/fragmentation.c
-@@ -418,12 +418,13 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
-                            struct batadv_neigh_node *neigh_node)
- {
-       struct batadv_priv *bat_priv;
--      struct batadv_hard_iface *primary_if;
-+      struct batadv_hard_iface *primary_if = NULL;
-       struct batadv_frag_packet frag_header;
-       struct sk_buff *skb_fragment;
-       unsigned mtu = neigh_node->if_incoming->net_dev->mtu;
-       unsigned header_size = sizeof(frag_header);
-       unsigned max_fragment_size, max_packet_size;
-+      bool ret = false;
-       /* To avoid merge and refragmentation at next-hops we never send
-        * fragments larger than BATADV_FRAG_MAX_FRAG_SIZE
-@@ -483,7 +484,11 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
-                          skb->len + ETH_HLEN);
-       batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
--      return true;
-+      ret = true;
-+
- out_err:
--      return false;
-+      if (primary_if)
-+              batadv_hardif_free_ref(primary_if);
-+
-+      return ret;
- }
--- 
-2.0.0.rc2
-
diff --git a/batman-adv/patches/0009-batman-adv-increase-orig-refcount-when-storing-ref-i.patch b/batman-adv/patches/0009-batman-adv-increase-orig-refcount-when-storing-ref-i.patch
deleted file mode 100644 (file)
index d6f3dd6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-From 8dbdee55810adceecf51548d44da893076c99219 Mon Sep 17 00:00:00 2001
-From: Antonio Quartulli <antonio@open-mesh.com>
-Date: Fri, 2 May 2014 01:35:13 +0200
-Subject: [PATCH 9/9] batman-adv: increase orig refcount when storing ref in
- gw_node
-
-A pointer to the orig_node representing a bat-gateway is
-stored in the gw_node->orig_node member, but the refcount
-for such orig_node is never increased.
-This leads to memory faults when gw_node->orig_node is accessed
-and the originator has already been freed.
-
-Fix this by increasing the refcount on gw_node creation
-and decreasing it on gw_node free.
-
-Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
-Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
----
- gateway_client.c | 11 +++++++++--
- 1 file changed, 9 insertions(+), 2 deletions(-)
-
-diff --git a/gateway_client.c b/gateway_client.c
-index d7fafc1..d5a40ab 100644
---- a/gateway_client.c
-+++ b/gateway_client.c
-@@ -42,8 +42,10 @@
- static void batadv_gw_node_free_ref(struct batadv_gw_node *gw_node)
- {
--      if (atomic_dec_and_test(&gw_node->refcount))
-+      if (atomic_dec_and_test(&gw_node->refcount)) {
-+              batadv_orig_node_free_ref(gw_node->orig_node);
-               kfree_rcu(gw_node, rcu);
-+      }
- }
- static struct batadv_gw_node *
-@@ -406,9 +408,14 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
-       if (gateway->bandwidth_down == 0)
-               return;
-+      if (!atomic_inc_not_zero(&orig_node->refcount))
-+              return;
-+
-       gw_node = kzalloc(sizeof(*gw_node), GFP_ATOMIC);
--      if (!gw_node)
-+      if (!gw_node) {
-+              batadv_orig_node_free_ref(orig_node);
-               return;
-+      }
-       INIT_HLIST_NODE(&gw_node->list);
-       gw_node->orig_node = orig_node;
--- 
-2.0.0.rc2
-
index 4926e2ba30c8b50a0cb5649315b6e758fbd71852..cb2d5b3cd7e3142190e53729c99140b8e281372b 100755 (executable)
@@ -27,6 +27,7 @@ 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 &
 }
index fe7ccb4d27eaa0d137cc8517aff068065be77c21..a44651ed1a2eaef598315b944c98e27e15fec77a 100644 (file)
@@ -7,8 +7,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hnetd
-PKG_SOURCE_VERSION:=a7fb081a9b98a150f2fda913886c6c0ef0725048
-PKG_VERSION:=2014-05-04-$(PKG_SOURCE_VERSION)
+PKG_SOURCE_VERSION:=e60ce270f5a1ab01c6e262e1b9ee5cc20223b8c4
+PKG_VERSION:=2014-06-06-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
@@ -39,10 +39,15 @@ endef
 define Package/hnet-full
   SECTION:=net
   CATEGORY:=Network
-  TITLE:=HNCP Homenet metapackage (hnetd + ohybridproxy + babels)
+  TITLE:=HNCP Homenet metapackage
   URL:=https://github.com/sbyx/hnetd
-  DEPENDS:=+odhcpd +odhcp6c +netifd +hnetd +ohybridproxy +babels
-  DEPENDS+=+@IPV6
+  DEPENDS:=+hnetd
+  # Routing
+  DEPENDS+=+babels
+  # Service discovery
+  DEPENDS+=+ohybridproxy
+  # Distributed PCP support
+  DEPENDS+=+miniupnpd +minimalist-pcproxy
 endef
 
 define Package/hnetd/description
@@ -60,7 +65,10 @@ define Package/hnetd/install
        ln -s hnetd $(1)/usr/sbin/hnet-call
        $(INSTALL_DIR) $(1)/etc/init.d
        $(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/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
diff --git a/hnetd/files/hnet.config b/hnetd/files/hnet.config
new file mode 100644 (file)
index 0000000..e67e6eb
--- /dev/null
@@ -0,0 +1,8 @@
+config pa pa
+#      option ip4prefix 10.0.0.0/8
+#      option ulaprefix fd12:3456:789A::/48
+#      option persistent_store /etc/hnet-pa.store
+
+config sd sd
+#      option router_name openwrt
+#      option domain_name home.
index 70d0d70dd9dfb6995f18bf0b889fbab62c38ca9c..b24ba56c05c7de91b7f50ac6c846685bd9973d69 100644 (file)
@@ -12,8 +12,14 @@ DNSMASQ_DIR=/tmp/dnsmasq.d
 DNSMASQ_SCRIPT=/etc/init.d/dnsmasq
 OHP_SCRIPT=/usr/sbin/hnetd-ohp-script
 OHP_BINARY=/usr/sbin/ohybridproxy
+PCP_SCRIPT=/usr/sbin/hnetd-pcp-script
+PCP_BINARY=/usr/sbin/minimalist-pcproxy
 
 start_service() {
+    . /lib/functions.sh
+    . /lib/functions/network.sh
+    config_load hnet
+
     mkdir -p $DNSMASQ_DIR
     procd_open_instance
     procd_set_param command /usr/sbin/hnetd
@@ -23,7 +29,7 @@ start_service() {
     then
         mkdir -p $DNSMASQ_DIR
         procd_append_param command -d $DNSMASQ_SCRIPT
-        procd_append_param command -f $DNSMASQ_DIR/hnet.conf 
+        procd_append_param command -f $DNSMASQ_DIR/hnet.conf
         procd_append_param command -o $OHP_SCRIPT
         HOSTNAME=`cat /proc/sys/kernel/hostname`
         if [ -n "$HOSTNAME" ]
@@ -31,12 +37,32 @@ start_service() {
             procd_append_param command -n "$HOSTNAME"
         fi
     fi
+
+    # Enable PCP, if it's present
+    if [ -f $PCP_BINARY -a -f $PCP_SCRIPT ]
+    then
+        procd_append_param command -c $PCP_SCRIPT
+    fi
+
     # State file
-    procd_append_param command -s /tmp/hnetd.pa_state
+    config_get val pa persistent_store
+    procd_append_param command -s ${val:-/tmp/hnetd.pa_state}
 
     # Routing script
     procd_append_param command -r /usr/sbin/hnetd-routing
 
+    config_get val pa ip4prefix
+    [ -n "$val" ] && procd_append_param command --ip4prefix $val
+
+    config_get val pa ulaprefix
+    [ -n "$val" ] && procd_append_param command --ulaprefix $val
+
+    config_get val sd router_name
+    [ -n "$val" ] && procd_append_param command -n $val
+
+    config_get val sd domain_name
+    [ -n "$val" ] && procd_append_param command -m $val
+
     procd_set_param respawn
     procd_close_instance
 }
diff --git a/hnetd/files/pcp-script b/hnetd/files/pcp-script
new file mode 100644 (file)
index 0000000..88648d2
--- /dev/null
@@ -0,0 +1,46 @@
+#!/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
diff --git a/minimalist-pcproxy/Makefile b/minimalist-pcproxy/Makefile
new file mode 100644 (file)
index 0000000..1a4f16d
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=minimalist-pcproxy
+PKG_SOURCE_VERSION:=c8d47ff42c4354f502830faeae13bd8f269401af
+PKG_VERSION:=2014-06-02-$(PKG_SOURCE_VERSION)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/fingon/minimalist-pcproxy.git
+PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi>
+
+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
+
+define Package/minimalist-pcproxy
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Lightweight PCP proxy
+  URL:=https://github.com/fingon/minimalist-pcproxy
+  DEPENDS:=+libubox +@IPV6
+endef
+
+define Package/minimalist-pcproxy/description
+This package contains a daemon which can be used to forward
+PCP (Port Control Protocol - RFC6887) requests requests to PCP remote servers.
+
+In and of itself, it is not very useful, but combined with hnetd+miniupnpd
+it allows for control of NAT forwarding and firewall pinholes from multiple
+hops away.
+endef
+
+define Package/minimalist-pcproxy/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/minimalist-pcproxy $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/minimalist-pcproxy.defaults $(1)/etc/uci-defaults/x-minimalist-pcproxy.defaults
+endef
+
+define Package/minimalist-pcproxy/postinst
+!/bin/sh
+[ -n "$${IPKG_INSTROOT}" ] || {
+       (. /etc/uci-defaults/x-minimalist-pcproxy.defaults) && rm -f /etc/uci-defaults/x-minimalist-pcproxy.defaults
+}
+exit 0
+endef
+
+$(eval $(call BuildPackage,minimalist-pcproxy))
diff --git a/minimalist-pcproxy/files/minimalist-pcproxy.defaults b/minimalist-pcproxy/files/minimalist-pcproxy.defaults
new file mode 100644 (file)
index 0000000..4e041e5
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ `uci get -q upnpd.config._pcproxy_configured` = "1" ]
+then
+    exit
+fi
+
+uci batch <<EOF
+set upnpd.config.enable_upnp=0
+set upnpd.config.pcp_allow_thirdparty=1
+set upnpd.config.internal_iface=loopback
+set upnpd.config.ipv6_listening_ip=::1
+set upnpd.config._pcproxy_configured=1
+commit upnpd
+EOF
diff --git a/miniupnpd/Makefile b/miniupnpd/Makefile
new file mode 100644 (file)
index 0000000..a26283e
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=miniupnpd
+PKG_VERSION:=1.8.20140523
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://miniupnp.free.fr/files
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=fcac89e11da091b1cc61f43d83c9e4f5
+
+PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/miniupnpd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables +libnfnetlink
+  TITLE:=Lightweight UPnP daemon
+  SUBMENU:=Firewall
+  URL:=http://miniupnp.free.fr/
+endef
+
+define Package/miniupnpd/conffiles
+/etc/config/upnpd
+endef
+
+define Package/miniupnpd/postinst
+#!/bin/sh
+
+if [ -z "$$IPKG_INSTROOT" ]; then
+  ( . /etc/uci-defaults/99-miniupnpd )
+  rm -f /etc/uci-defaults/99-miniupnpd
+fi
+
+exit 0
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       echo "OpenWrt/$(OPENWRTVERSION)" | tr \(\)\  _ >$(PKG_BUILD_DIR)/os.openwrt
+endef
+
+MAKE_FLAGS += \
+       LIBS="" \
+       CC="$(TARGET_CC) -DIPTABLES_143 -lnfnetlink -lip4tc $(if $(CONFIG_IPV6),-lip6tc)" \
+       CONFIG_OPTIONS="$(if $(CONFIG_IPV6),--ipv6) --leasefile" \
+       -f Makefile.linux \
+       miniupnpd
+
+define Package/miniupnpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults $(1)/etc/hotplug.d/iface $(1)/usr/share/miniupnpd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/sbin/miniupnpd
+       $(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
+       $(INSTALL_CONF) ./files/upnpd.config $(1)/etc/config/upnpd
+       $(INSTALL_DATA) ./files/miniupnpd.hotplug $(1)/etc/hotplug.d/iface/50-miniupnpd
+       $(INSTALL_DATA) ./files/miniupnpd.defaults $(1)/etc/uci-defaults/99-miniupnpd
+       $(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/miniupnpd/firewall.include
+endef
+
+$(eval $(call BuildPackage,miniupnpd))
diff --git a/miniupnpd/files/firewall.include b/miniupnpd/files/firewall.include
new file mode 100644 (file)
index 0000000..5294c45
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# miniupnpd integration for firewall3
+
+# Note: Correct way to do this would be probably to use
+# /lib/functions/network.sh, and use network_find_wan{,6}, and then
+# network_get_device, then determine their zones using fw3 -q network
+# etc. However, network_find_wan* return only one device, and
+# frequently incorrect one if multiple ISPs are in use. So this
+# current ugly solution works, although perhaps makes holes where it
+# shouldn't (if so, do override it in e.g. firewall.user)
+
+IP6TABLES=/usr/sbin/ip6tables
+
+iptables -t filter -N MINIUPNPD 2>/dev/null
+iptables -t nat -N MINIUPNPD 2>/dev/null
+
+[ -x $IP6TABLES ] && $IP6TABLES -t filter -N MINIUPNPD 2>/dev/null
+
+# IPv4 - due to NAT, need to add both to nat and filter table
+iptables -t filter -I delegate_forward 2 -j MINIUPNPD
+iptables -t nat -I delegate_prerouting 2 -j MINIUPNPD
+
+# IPv6 if available - filter only
+[ -x $IP6TABLES ] && {
+    $IP6TABLES -t filter -I delegate_forward 2 -j MINIUPNPD
+}
diff --git a/miniupnpd/files/miniupnpd.defaults b/miniupnpd/files/miniupnpd.defaults
new file mode 100644 (file)
index 0000000..7271389
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+uci -q batch <<-EOT
+       delete firewall.miniupnpd
+       set firewall.miniupnpd=include
+       set firewall.miniupnpd.type=script
+       set firewall.miniupnpd.path=/usr/share/miniupnpd/firewall.include
+       set firewall.miniupnpd.family=any
+       set firewall.miniupnpd.reload=1
+       commit firewall
+EOT
+
+exit 0
diff --git a/miniupnpd/files/miniupnpd.hotplug b/miniupnpd/files/miniupnpd.hotplug
new file mode 100644 (file)
index 0000000..7ff363a
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+if [ ! /etc/init.d/miniupnpd enabled ]
+then
+    exit 0
+fi
+
+. /lib/functions/service.sh
+
+# If miniupnpd is not running:
+# - check on _any_ event (even updates may contribute to network_find_wan*)
+# If miniupnpd _is_ running:
+# - check only on ifup
+
+[ ! "$ACTION" = "ifup" ] && service_check /usr/sbin/miniupnpd && exit 0
+
+local iface
+local ext_iface
+local ext_iface6
+
+. /lib/functions/network.sh
+network_find_wan ext_iface
+network_find_wan6 ext_iface6
+
+for iface in $ext_iface $ext_iface6 $(uci_get upnpd config internal_iface; uci_get upnpd config external_iface); do
+    [ "$INTERFACE" = "$iface" ] && /etc/init.d/miniupnpd restart
+    exit 0
+done
diff --git a/miniupnpd/files/miniupnpd.init b/miniupnpd/files/miniupnpd.init
new file mode 100644 (file)
index 0000000..a109244
--- /dev/null
@@ -0,0 +1,198 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=95
+
+SERVICE_USE_PID=1
+
+upnpd_get_port_range() {
+       local _var="$1"; shift
+       local _val
+
+       config_get _val "$@"
+
+       case "$_val" in
+               [0-9]*[:-][0-9]*)
+                       export -n -- "${_var}_start=${_val%%[:-]*}"
+                       export -n -- "${_var}_end=${_val##*[:-]}"
+               ;;
+               [0-9]*)
+                       export -n -- "${_var}_start=$_val"
+                       export -n -- "${_var}_end="
+               ;;
+       esac
+}
+
+conf_rule_add() {
+       local cfg="$1"
+       local tmpconf="$2"
+       local action external_port_start external_port_end int_addr
+       local internal_port_start internal_port_end
+
+       config_get action "$cfg" action "deny"               # allow or deny
+       upnpd_get_port_range "ext" "$cfg" ext_ports "0-65535" # external ports: x, x-y, x:y
+       config_get int_addr "$cfg" int_addr "0.0.0.0/0"       # ip or network and subnet mask (internal)
+       upnpd_get_port_range "int" "$cfg" int_ports "0-65535" # internal ports: x, x-y, x:y or range
+
+       # Make a single IP IP/32 so that miniupnpd.conf can use it.
+       case "$int_addr" in
+               */*) ;;
+               *) int_addr="$int_addr/32" ;;
+       esac
+
+       echo "${action} ${ext_start}${ext_end:+-}${ext_end} ${int_addr} ${int_start}${int_end:+-}${int_end}" >>$tmpconf
+}
+
+upnpd_write_bool() {
+       local opt="$1"
+       local def="${2:-0}"
+       local alt="$3"
+       local val
+
+       config_get_bool val config "$opt" "$def"
+       if [ "$val" -eq 0 ]; then
+               echo "${alt:-$opt}=no" >> $tmpconf
+       else
+               echo "${alt:-$opt}=yes" >> $tmpconf
+       fi
+}
+
+boot() {
+       return
+}
+
+start() {
+       config_load "upnpd"
+       local extiface intiface upload download logging secure enabled natpmp
+       local extip port usesysuptime conffile serial_number model_number
+       local uuid notify_interval presentation_url enable_upnp
+       local upnp_lease_file clean_ruleset_threshold clean_ruleset_interval
+        local ipv6_listening_ip
+
+       config_get extiface config external_iface
+       config_get intiface config internal_iface
+       config_get extip config external_ip
+       config_get port config port 5000
+       config_get upload   config upload
+       config_get download config download
+       config_get_bool logging config log_output 0
+       config_get conffile config config_file
+       config_get serial_number config serial_number
+       config_get model_number config model_number
+       config_get uuid config uuid
+       config_get notify_interval config notify_interval
+       config_get presentation_url config presentation_url
+       config_get upnp_lease_file config upnp_lease_file
+       config_get clean_ruleset_threshold config clean_ruleset_threshold
+       config_get clean_ruleset_interval config clean_ruleset_interval
+       config_get ipv6_listening_ip config ipv6_listening_ip
+
+       local args
+
+       . /lib/functions/network.sh
+
+       local ifname
+
+        [ -n "$extiface" ] || network_find_wan extiface
+        [ -n "$extiface" ] || network_find_wan6 extiface
+
+       network_get_device ifname ${extiface}
+
+       if [ -n "$conffile" ]; then
+               args="-f $conffile"
+       else
+               local tmpconf="/var/etc/miniupnpd.conf"
+               args="-f $tmpconf"
+               mkdir -p /var/etc
+
+               echo "ext_ifname=$ifname" >$tmpconf
+
+               [ -n "$extip" ] && \
+                       echo "ext_ip=$extip" >>$tmpconf
+
+               local iface
+               for iface in ${intiface:-lan}; do
+                       local device
+                       network_get_device device "$iface" && {
+                               echo "listening_ip=$device" >>$tmpconf
+                       }
+               done
+
+               [ "$port" != "auto" ] && \
+                       echo "port=$port" >>$tmpconf
+
+               config_load "upnpd"
+               upnpd_write_bool enable_natpmp 1
+               upnpd_write_bool enable_upnp 1
+               upnpd_write_bool secure_mode 1
+               upnpd_write_bool pcp_allow_thirdparty 0
+               upnpd_write_bool system_uptime 1
+
+               [ -n "$upnp_lease_file" ] && \
+                       echo "lease_file=$upnp_lease_file" >>$tmpconf
+
+               [ -n "$upload" -a -n "$download" ] && {
+                       echo "bitrate_down=$(($download * 1024 * 8))" >>$tmpconf
+                       echo "bitrate_up=$(($upload * 1024 * 8))" >>$tmpconf
+               }
+
+               [ -n "${presentation_url}" ] && \
+                       echo "presentation_url=${presentation_url}" >>$tmpconf
+
+               [ -n "${notify_interval}" ] && \
+                       echo "notify_interval=${notify_interval}" >>$tmpconf
+
+               [ -n "${clean_ruleset_threshold}" ] && \
+                       echo "clean_ruleset_threshold=${clean_ruleset_threshold}" >>$tmpconf
+
+               [ -n "${clean_ruleset_interval}" ] && \
+                       echo "clean_ruleset_interval=${clean_ruleset_interval}" >>$tmpconf
+
+               [ -n "${ipv6_listening_ip}" ] && \
+                       echo "ipv6_listening_ip=${ipv6_listening_ip}" >>$tmpconf
+
+               [ -z "$uuid" ] && {
+                       uuid="$(cat /proc/sys/kernel/random/uuid)"
+                       uci set upnpd.config.uuid=$uuid
+                       uci commit upnpd
+               }
+
+               [ "$uuid" = "nocli" ] || \
+                       echo "uuid=$uuid" >>$tmpconf
+
+               [ -n "${serial_number}" ] && \
+                       echo "serial=${serial_number}" >>$tmpconf
+
+               [ -n "${model_number}" ] && \
+                       echo "model_number=${model_number}" >>$tmpconf
+
+           config_foreach conf_rule_add perm_rule "$tmpconf"
+       fi
+
+
+       if [ -n "$ifname" ]; then
+               # start firewall
+               iptables -L MINIUPNPD >/dev/null 2>/dev/null || fw3 reload
+
+               if [ "$logging" = "1" ]; then
+                       SERVICE_DAEMONIZE=1 \
+                       service_start /usr/sbin/miniupnpd $args -d
+               else
+                       SERVICE_DAEMONIZE= \
+                       service_start /usr/sbin/miniupnpd $args
+               fi
+       else
+               logger -t "upnp daemon" "external interface not found, not starting"
+       fi
+}
+
+stop() {
+       service_stop /usr/sbin/miniupnpd
+
+       iptables -t nat -F MINIUPNPD 2>/dev/null
+       iptables -t filter -F MINIUPNPD 2>/dev/null
+
+        [ -x /usr/sbin/ip6tables ] && {
+           ip6tables -t filter -F MINIUPNPD 2>/dev/null
+        }
+}
diff --git a/miniupnpd/files/upnpd.config b/miniupnpd/files/upnpd.config
new file mode 100644 (file)
index 0000000..56cde57
--- /dev/null
@@ -0,0 +1,26 @@
+config upnpd config
+       option enable_natpmp    1
+       option enable_upnp      1
+       option secure_mode      1
+       option log_output       0
+       option download         1024
+       option upload           512
+        #by default, looked up dynamically from ubus
+       #option external_iface  wan
+       option internal_iface   lan
+       option port             5000
+       option upnp_lease_file  /var/upnp.leases
+       
+config perm_rule
+       option action           allow
+       option ext_ports        1024-65535
+       option int_addr         0.0.0.0/0       # Does not override secure_mode
+       option int_ports        1024-65535
+       option comment          "Allow high ports"
+
+config perm_rule
+       option action           deny
+       option ext_ports                0-65535
+       option int_addr         0.0.0.0/0
+       option int_ports                0-65535
+       option comment          "Default deny"
diff --git a/miniupnpd/patches/100-no-ssl.patch b/miniupnpd/patches/100-no-ssl.patch
new file mode 100644 (file)
index 0000000..f058c3b
--- /dev/null
@@ -0,0 +1,14 @@
+diff --git a/Makefile.linux b/Makefile.linux
+index bcca779..7946108 100644
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -147,7 +147,8 @@ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libmnl)
+ 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-ipv6-pinhole.patch b/miniupnpd/patches/101-ipv6-pinhole.patch
new file mode 100644 (file)
index 0000000..0ab4d4d
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/netfilter/iptpinhole.c b/netfilter/iptpinhole.c
+index 61ed41b..5cb0e0e 100644
+--- a/netfilter/iptpinhole.c
++++ b/netfilter/iptpinhole.c
+@@ -206,6 +206,8 @@ int add_pinhole(const char * ifname,
+       e = calloc(1, sizeof(struct ip6t_entry));
+       e->ipv6.proto = proto;
++      if (proto)
++              e->ipv6.flags |= IP6T_F_PROTO;
+       if(ifname)
+               strncpy(e->ipv6.iniface, ifname, IFNAMSIZ);
diff --git a/miniupnpd/patches/102-ipv6-ext-port.patch b/miniupnpd/patches/102-ipv6-ext-port.patch
new file mode 100644 (file)
index 0000000..d0c68ae
--- /dev/null
@@ -0,0 +1,12 @@
+diff --git a/pcpserver.c b/pcpserver.c
+index dec4b58..3cdf460 100644
+--- a/pcpserver.c
++++ b/pcpserver.c
+@@ -1020,6 +1020,7 @@ static int CreatePCPMap_FW(pcp_info_t *pcp_msg_info)
+                                       &uid);
+       if (r < 0)
+               return PCP_ERR_NO_RESOURCES;
++      pcp_msg_info->ext_port = pcp_msg_info->int_port;
+       return PCP_SUCCESS;
+ #else
+       return PCP_ERR_NO_RESOURCES;
diff --git a/nat46/Makefile b/nat46/Makefile
new file mode 100644 (file)
index 0000000..d1dfcd9
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=nat46
+PKG_VERSION:=1
+PKG_RELEASE:=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=758a02e6f9e4c43553e0fc37d83c286c77febe94
+PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/nat46
+  DEPENDS:=+kmod-ipv6
+  TITLE:=Stateless NAT46 translation kernel module
+  SECTION:=kernel
+  SUBMENU:=Network Support
+  FILES:=$(PKG_BUILD_DIR)/nat46/modules/nat46.ko 
+  AUTOLOAD:=$(call AutoLoad,33,nat46)
+endef
+
+include $(INCLUDE_DIR)/kernel-defaults.mk
+
+define Build/Compile
+       $(MAKE) $(KERNEL_MAKEOPTS) SUBDIRS="$(PKG_BUILD_DIR)/nat46/modules" \
+               MODFLAGS="-DMODULE -mlong-calls" \
+               modules
+endef
+
+$(eval $(call KernelPackage,nat46))
index 5004b5f976ab9cb831107327d9ecac5379d3f291..d1516744e6d65f3d7855242d466267789f4dd021 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=olsrd
-PKG_VERSION:=0.6.6.1
-PKG_RELEASE:=4
+PKG_VERSION:=0.6.6.2
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.olsr.org/releases/0.6
 
-PKG_MD5SUM:=ef480495f307232f1df931ae5df18bf9
+PKG_MD5SUM:=e4e04bb033cffd99b3be397fa9063a54
 PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
diff --git a/olsrd/patches/001-Fix-processing-error-for-fragmented-hellos.patch b/olsrd/patches/001-Fix-processing-error-for-fragmented-hellos.patch
deleted file mode 100644 (file)
index a1bc5a7..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-commit bdca59455c9b91b112a5c27eba2ccba3f606797d
-Author: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
-Date:   Mon Mar 31 11:18:30 2014 +0200
-
-    Fix processing error for fragmented hellos
-
-diff --git a/src/process_package.c b/src/process_package.c
-index 780efab..b39b692 100644
---- a/src/process_package.c
-+++ b/src/process_package.c
-@@ -441,21 +441,15 @@ olsr_hello_tap(struct hello_message *message, struct interface *in_if, const uni
-     /* find the input interface in the list of neighbor interfaces */
-     for (walker = message->neighbors; walker != NULL; walker = walker->next) {
--      if (walker->link != UNSPEC_LINK
--          && ipequal(&walker->address, &in_if->ip_addr)) {
-+      if (ipequal(&walker->address, &in_if->ip_addr)) {
-+        /*
-+         * memorize our neighbour's idea of the link quality, so that we
-+         * know the link quality in both directions
-+         */
-+        olsr_memorize_foreign_hello_lq(lnk, walker->link != UNSPEC_LINK ? walker : NULL);
-         break;
-       }
-     }
--
--    /*
--     * memorize our neighbour's idea of the link quality, so that we
--     * know the link quality in both directions
--     *
--     * walker is NULL if there the current interface was not included in
--     * the message (or was included as an UNSPEC_LINK)
--     */
--    olsr_memorize_foreign_hello_lq(lnk, walker);
--
-     /* update packet loss for link quality calculation */
-     olsr_received_hello_handler(lnk);
-   }
-@@ -493,7 +487,7 @@ olsr_hello_tap(struct hello_message *message, struct interface *in_if, const uni
-   if (neighbor->willingness != WILL_NEVER)
-     process_message_neighbors(neighbor, message);
--  /* Process changes immedeatly in case of MPR updates */
-+  /* Process changes immediately in case of MPR updates */
-   olsr_process_changes();
-   olsr_free_hello_packet(message);
diff --git a/olsrd/patches/002-hotfix-long-http-headers-txtinfo.patch b/olsrd/patches/002-hotfix-long-http-headers-txtinfo.patch
deleted file mode 100644 (file)
index e04e815..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-commit d68c96cf53f188030452aadec466aa6389e81511
-Author: Henning Rogge <hrogge@gmail.com>
-Date:   Tue May 13 21:23:36 2014 +0200
-
-    Hotfix for much too long http headers
-
-diff --git a/lib/txtinfo/src/olsrd_txtinfo.c b/lib/txtinfo/src/olsrd_txtinfo.c
-index b56545d..2bcce41 100644
---- a/lib/txtinfo/src/olsrd_txtinfo.c
-+++ b/lib/txtinfo/src/olsrd_txtinfo.c
-@@ -301,8 +301,15 @@ ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int flags __att
-   FD_ZERO(&rfds);
-   FD_SET((unsigned int)ipc_connection, &rfds);  /* Win32 needs the cast here */
-   if (0 <= select(ipc_connection + 1, &rfds, NULL, NULL, &tv)) {
--    char requ[128];
--    ssize_t s = recv(ipc_connection, (void *)&requ, sizeof(requ), 0);   /* Win32 needs the cast here */
-+    char requ[1024];
-+    ssize_t s = recv(ipc_connection, (void *)&requ, sizeof(requ)-1, 0);   /* Win32 needs the cast here */
-+
-+    if (s == sizeof(requ)-1) {
-+      /* input was much too long, just skip the rest */
-+      char dummy[1024];
-+
-+      while (recv(ipc_connection, (void *)&dummy, sizeof(dummy), 0) == sizeof(dummy), 0);
-+    }
-     if (0 < s) {
-       requ[s] = 0;
-       /* To print out neighbours only on the Freifunk Status
-@@ -329,6 +336,7 @@ ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int flags __att
-         if (0 != strstr(requ, "/ver")) send_what |= SIW_VERSION;
-       }
-     }
-+
-     if ( send_what == 0 ) send_what = SIW_ALL;
-   }
diff --git a/olsrd/patches/003-hotfix-long-http-headers-json.patch b/olsrd/patches/003-hotfix-long-http-headers-json.patch
deleted file mode 100644 (file)
index 8774856..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-commit 528176910ee1d00278e4108cc23d9f4f2de8a639
-Author: Alessio Caiazza <nolith@abisso.org>
-Date:   Wed May 14 22:45:33 2014 +0200
-
-    Hotfix for very long http headers also for jsoninfo
-
-diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c b/lib/jsoninfo/src/olsrd_jsoninfo.c
-index 966292c..817c64a 100644
---- a/lib/jsoninfo/src/olsrd_jsoninfo.c
-+++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
-@@ -508,8 +508,15 @@ ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int flags __att
-   FD_ZERO(&rfds);
-   FD_SET((unsigned int)ipc_connection, &rfds);  /* Win32 needs the cast here */
-   if (0 <= select(ipc_connection + 1, &rfds, NULL, NULL, &tv)) {
--    char requ[128];
--    ssize_t s = recv(ipc_connection, (void *)&requ, sizeof(requ), 0);   /* Win32 needs the cast here */
-+    char requ[1024];
-+    ssize_t s = recv(ipc_connection, (void *)&requ, sizeof(requ)-1, 0);   /* Win32 needs the cast here */
-+
-+    if (s == sizeof(requ)-1) {
-+      /* input was too much long, just skip the rest */
-+      char dummy[1024];
-+
-+      while (recv(ipc_connection, (void *)&dummy, sizeof(dummy), 0) == sizeof(dummy), 0);
-+    }
-     if (0 < s) {
-       requ[s] = 0;
-       /* print out the requested tables */
diff --git a/olsrd/patches/004-jsonplugin-http-headers.patch b/olsrd/patches/004-jsonplugin-http-headers.patch
deleted file mode 100644 (file)
index cd76006..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-commit b342385531c18b8afb42db64c7a38d7879668566
-Author: Alessio Caiazza <nolith@abisso.org>
-Date:   Fri May 16 12:53:15 2014 +0200
-
-    jsoninfo: HTTP headers with CORS (if requested)
-    
-    The new "httpheaders" parameter prepends HTTP headers to the reply.
-    If not set it will default to "no" and have the same behaviour as before.
-    Cross-origin resource sharing headers (CORS) are included in reply allowing the
-    json retrieval by javascript applications not served by olsrd itself.
-    This will allow to easily develop js applications running directly in the
-    browser.
-    
-    Reviewed-by: Ferry Huberts <ferry.huberts@pelagic.nl>
-
-diff --git a/lib/jsoninfo/README_JSONINFO b/lib/jsoninfo/README_JSONINFO
-index 709c975..8311ade 100644
---- a/lib/jsoninfo/README_JSONINFO
-+++ b/lib/jsoninfo/README_JSONINFO
-@@ -73,6 +73,14 @@ LoadPlugin "olsrd_jsoninfo.so.0.0"
-     # if you set it to 0.0.0.0, it will accept all connections
-     #PlParam      "accept" "0.0.0.0"
-+    # The "httpheaders" parameter prepends HTTP headers to the reply.
-+    # If not set it will default to "no" and have the same behaviour as before.
-+    # Among with a minimal set of headers also Cross-origin resource sharing
-+    # headers (CORS) are included in reply allowing the json retrieval by
-+    # javascript applications not served by olsrd itself.
-+    # You can enable it uncommenting the following line:
-+    #PlParam      "httpheaders" "yes"
-+
-     # specify a UUID for this node to track it for debugging
-     #PlParam      "UUIDFile" "/etc/olsrd/olsrd.uuid"
- }
-diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c b/lib/jsoninfo/src/olsrd_jsoninfo.c
-index 817c64a..f29a37c 100644
---- a/lib/jsoninfo/src/olsrd_jsoninfo.c
-+++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
-@@ -96,6 +96,9 @@
- static int ipc_socket;
-+/* Response types */
-+#define HTTP_200 "HTTP/1.1 200 OK"
-+
- /* IPC initialization function */
- static int plugin_ipc_init(void);
-@@ -126,6 +129,18 @@ static void ipc_print_interfaces(struct autobuf *);
- static void ipc_print_plugins(struct autobuf *);
- static void ipc_print_olsrd_conf(struct autobuf *abuf);
-+static size_t build_http_header(const char *status, const char *mime,
-+  uint32_t msgsize, char *buf, uint32_t bufsize);
-+
-+/*
-+ * this is the size of the buffer used for build_http_header
-+ * the amount of data written into the buffer will be less than
-+ * 400 bytes approximatively.
-+ * The size may vary because the Content-Length header contains
-+ * the length of the json data
-+ */
-+#define MAX_HTTPHEADER_SIZE 512
-+
- #define TXT_IPC_BUFSIZE 256
- /* these provide all of the runtime status info */
-@@ -1282,6 +1297,9 @@ static void
- send_info(unsigned int send_what, int the_socket)
- {
-   struct autobuf abuf;
-+  size_t header_len = 0;
-+  char header_buf[MAX_HTTPHEADER_SIZE];
-+  const char *content_type = "application/json";
-   /* global variables for tracking when to put a comma in for JSON */
-   entrynumber[0] = 0;
-@@ -1320,12 +1338,17 @@ send_info(unsigned int send_what, int the_socket)
-     ipc_print_olsrd_conf(&abuf);
-   }
--  outbuffer[outbuffer_count] = olsr_malloc(abuf.len, "txt output buffer");
--  outbuffer_size[outbuffer_count] = abuf.len;
-+  if(http_headers) {
-+    header_len = build_http_header(HTTP_200, content_type, abuf.len, header_buf, sizeof(header_buf));
-+  }
-+
-+  outbuffer[outbuffer_count] = olsr_malloc(header_len + abuf.len, "json output buffer");
-+  outbuffer_size[outbuffer_count] = header_len + abuf.len;
-   outbuffer_written[outbuffer_count] = 0;
-   outbuffer_socket[outbuffer_count] = the_socket;
--  memcpy(outbuffer[outbuffer_count], abuf.buf, abuf.len);
-+  memcpy(outbuffer[outbuffer_count], header_buf, header_len);
-+  memcpy((outbuffer[outbuffer_count]) + header_len, abuf.buf, abuf.len);
-   outbuffer_count++;
-   if (outbuffer_count == 1) {
-@@ -1340,6 +1363,53 @@ send_info(unsigned int send_what, int the_socket)
-   abuf_free(&abuf);
- }
-+static size_t
-+build_http_header(const char *status, const char *mime, uint32_t msgsize,
-+  char *buf, uint32_t bufsize)
-+{
-+  time_t currtime;
-+  size_t size;
-+
-+  size = snprintf(buf, bufsize, "%s\r\n", status);
-+
-+  /* Date */
-+  time(&currtime);
-+  size += strftime(&buf[size], bufsize - size, "Date: %a, %d %b %Y %H:%M:%S GMT\r\n", localtime(&currtime));
-+
-+  /* Server version */
-+  size += snprintf(&buf[size], bufsize - size, "Server: OLSRD JSONInfo plugin\r\n");
-+
-+  /* connection-type */
-+  size += snprintf(&buf[size], bufsize - size, "Connection: closed\r\n");
-+
-+  /* MIME type */
-+  if(mime != NULL) {
-+    size += snprintf(&buf[size], bufsize - size, "Content-type: %s\r\n", mime);
-+  }
-+
-+  /* CORS data */
-+  /**No needs to be strict here, access control is based on source IP*/
-+  size += snprintf(&buf[size], bufsize - size, "Access-Control-Allow-Origin: *\r\n");
-+  size += snprintf(&buf[size], bufsize - size, "Access-Control-Allow-Methods: GET, POST, OPTIONS\r\n");
-+  size += snprintf(&buf[size], bufsize - size, "Access-Control-Allow-Headers: Accept, Origin, X-Requested-With\r\n");
-+  size += snprintf(&buf[size], bufsize - size, "Access-Control-Max-Age: 1728000\r\n");
-+
-+  /* Content length */
-+  if (msgsize > 0) {
-+    size += snprintf(&buf[size], bufsize - size, "Content-length: %i\r\n", msgsize);
-+  }
-+
-+  /* Cache-control
-+   * No caching dynamic pages
-+   */
-+  size += snprintf(&buf[size], bufsize - size, "Cache-Control: no-cache\r\n");
-+
-+  /* End header */
-+  size += snprintf(&buf[size], bufsize - size, "\r\n");
-+
-+  return size;
-+}
-+
- /*
-  * Local Variables:
-  * mode: c
-diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.h b/lib/jsoninfo/src/olsrd_jsoninfo.h
-index 8478f62..56acb70 100644
---- a/lib/jsoninfo/src/olsrd_jsoninfo.h
-+++ b/lib/jsoninfo/src/olsrd_jsoninfo.h
-@@ -62,6 +62,7 @@ extern union olsr_ip_addr jsoninfo_accept_ip;
- extern union olsr_ip_addr jsoninfo_listen_ip;
- extern int ipc_port;
- extern int nompr;
-+extern bool http_headers;
- int olsrd_plugin_interface_version(void);
- int olsrd_plugin_init(void);
-diff --git a/lib/jsoninfo/src/olsrd_plugin.c b/lib/jsoninfo/src/olsrd_plugin.c
-index 36550a8..03aa45f 100644
---- a/lib/jsoninfo/src/olsrd_plugin.c
-+++ b/lib/jsoninfo/src/olsrd_plugin.c
-@@ -64,6 +64,7 @@ union olsr_ip_addr jsoninfo_accept_ip;
- union olsr_ip_addr jsoninfo_listen_ip;
- int ipc_port;
- int nompr;
-+bool http_headers;
- static void my_init(void) __attribute__ ((constructor));
- static void my_fini(void) __attribute__ ((destructor));
-@@ -79,6 +80,7 @@ my_init(void)
-   /* defaults for parameters */
-   ipc_port = 9090;
-+  http_headers = false;
-   if (olsr_cnf->ip_version == AF_INET) {
-     jsoninfo_accept_ip.v4.s_addr = htonl(INADDR_LOOPBACK);
-     jsoninfo_listen_ip.v4.s_addr = htonl(INADDR_ANY);
-@@ -120,11 +122,26 @@ store_string(const char *value, void *data, set_plugin_parameter_addon addon __a
-   return 0;
- }
-+static int
-+store_boolean(const char *value, void *data, set_plugin_parameter_addon addon __attribute__ ((unused)))
-+{
-+  bool *dest = data;
-+  if(strcmp(value, "yes") == 0)
-+    *dest = true;
-+  else if (strcmp(value, "no") == 0)
-+    *dest = false;
-+  else
-+    return 1; //error
-+
-+  return 0;
-+}
-+
- static const struct olsrd_plugin_parameters plugin_parameters[] = {
-   {.name = "port",.set_plugin_parameter = &set_plugin_port,.data = &ipc_port},
-   {.name = "accept",.set_plugin_parameter = &set_plugin_ipaddress,.data = &jsoninfo_accept_ip},
-   {.name = "listen",.set_plugin_parameter = &set_plugin_ipaddress,.data = &jsoninfo_listen_ip},
-   {.name = "uuidfile",.set_plugin_parameter = &store_string,.data = uuidfile},
-+  {.name = "httpheaders",.set_plugin_parameter = &store_boolean,.data = &http_headers},
- };
- void