minimalist-pcproxy: Added.
hnetd: Added use of minimalist-pcproxy(/miniupnpd) for PCP, if present.
This commit is contained in:
parent
e58c0555a1
commit
9d6f368724
5 changed files with 138 additions and 6 deletions
|
@ -7,8 +7,8 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=hnetd
|
PKG_NAME:=hnetd
|
||||||
PKG_SOURCE_VERSION:=a7fb081a9b98a150f2fda913886c6c0ef0725048
|
PKG_SOURCE_VERSION:=c6da40c19d0e550cd1e2dd1a459ef6cab9b15cae
|
||||||
PKG_VERSION:=2014-05-04-$(PKG_SOURCE_VERSION)
|
PKG_VERSION:=2014-06-02-$(PKG_SOURCE_VERSION)
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
|
@ -39,10 +39,15 @@ endef
|
||||||
define Package/hnet-full
|
define Package/hnet-full
|
||||||
SECTION:=net
|
SECTION:=net
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
TITLE:=HNCP Homenet metapackage (hnetd + ohybridproxy + babels)
|
TITLE:=HNCP Homenet metapackage
|
||||||
URL:=https://github.com/sbyx/hnetd
|
URL:=https://github.com/sbyx/hnetd
|
||||||
DEPENDS:=+odhcpd +odhcp6c +netifd +hnetd +ohybridproxy +babels
|
DEPENDS:=+hnetd
|
||||||
DEPENDS+=+@IPV6
|
# Routing
|
||||||
|
DEPENDS+=+babels
|
||||||
|
# Service discovery
|
||||||
|
DEPENDS+=+ohybridproxy
|
||||||
|
# Distributed PCP support
|
||||||
|
DEPENDS+=+miniupnpd +minimalist-pcproxy
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/hnetd/description
|
define Package/hnetd/description
|
||||||
|
@ -61,6 +66,7 @@ define Package/hnetd/install
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
|
$(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
|
||||||
$(INSTALL_BIN) ./files/ohp-script $(1)/usr/sbin/hnetd-ohp-script
|
$(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_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
$(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
|
$(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
|
||||||
|
|
|
@ -12,6 +12,8 @@ DNSMASQ_DIR=/tmp/dnsmasq.d
|
||||||
DNSMASQ_SCRIPT=/etc/init.d/dnsmasq
|
DNSMASQ_SCRIPT=/etc/init.d/dnsmasq
|
||||||
OHP_SCRIPT=/usr/sbin/hnetd-ohp-script
|
OHP_SCRIPT=/usr/sbin/hnetd-ohp-script
|
||||||
OHP_BINARY=/usr/sbin/ohybridproxy
|
OHP_BINARY=/usr/sbin/ohybridproxy
|
||||||
|
PCP_SCRIPT=/usr/sbin/hnetd-pcp-script
|
||||||
|
PCP_BINARY=/usr/sbin/minimalist-pcproxy
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
mkdir -p $DNSMASQ_DIR
|
mkdir -p $DNSMASQ_DIR
|
||||||
|
@ -23,7 +25,7 @@ start_service() {
|
||||||
then
|
then
|
||||||
mkdir -p $DNSMASQ_DIR
|
mkdir -p $DNSMASQ_DIR
|
||||||
procd_append_param command -d $DNSMASQ_SCRIPT
|
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
|
procd_append_param command -o $OHP_SCRIPT
|
||||||
HOSTNAME=`cat /proc/sys/kernel/hostname`
|
HOSTNAME=`cat /proc/sys/kernel/hostname`
|
||||||
if [ -n "$HOSTNAME" ]
|
if [ -n "$HOSTNAME" ]
|
||||||
|
@ -31,6 +33,13 @@ start_service() {
|
||||||
procd_append_param command -n "$HOSTNAME"
|
procd_append_param command -n "$HOSTNAME"
|
||||||
fi
|
fi
|
||||||
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
|
# State file
|
||||||
procd_append_param command -s /tmp/hnetd.pa_state
|
procd_append_param command -s /tmp/hnetd.pa_state
|
||||||
|
|
||||||
|
|
46
hnetd/files/pcp-script
Normal file
46
hnetd/files/pcp-script
Normal file
|
@ -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
|
56
minimalist-pcproxy/Makefile
Normal file
56
minimalist-pcproxy/Makefile
Normal file
|
@ -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))
|
15
minimalist-pcproxy/files/minimalist-pcproxy.defaults
Normal file
15
minimalist-pcproxy/files/minimalist-pcproxy.defaults
Normal file
|
@ -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
|
Loading…
Reference in a new issue