Browse Source

OpenWRT build files and instructions

pull/166/head
emanuele-f 5 years ago
parent
commit
fa695e9f2b
  1. 1
      n2n_transforms.h
  2. 55
      openwrt/kamikaze/Makefile
  3. 85
      packages/openwrt/Makefile
  4. 10
      packages/openwrt/README.md
  5. 25
      packages/openwrt/etc/init.d/edge
  6. 25
      packages/openwrt/etc/init.d/supernode

1
n2n_transforms.h

@ -19,6 +19,7 @@
#if !defined(N2N_TRANSFORMS_H_) #if !defined(N2N_TRANSFORMS_H_)
#define N2N_TRANSFORMS_H_ #define N2N_TRANSFORMS_H_
#include <time.h>
#include "n2n_wire.h" #include "n2n_wire.h"
#define N2N_TRANSFORM_ID_USER_START 64 #define N2N_TRANSFORM_ID_USER_START 64

55
openwrt/kamikaze/Makefile

@ -1,55 +0,0 @@
#
# Copyright (C) 2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
include $(TOPDIR)/rules.mk
PKG_BRANCH:=trunk
PKG_SOURCE_URL:=https://svn.ntop.org/svn/ntop/trunk/n2n
PKG_REV:=$(shell LC_ALL=C svn info ${PKG_SOURCE_URL} | sed -ne's/^Last Changed Rev: //p')
PKG_NAME:=n2n
PKG_VERSION:=svn$(PKG_REV)
PKG_RELEASE:=1
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
PKG_SOURCE_PROTO:=svn
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_BUILD_DEPENDS:=
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)
include $(INCLUDE_DIR)/package.mk
define Package/n2n
SECTION:=net
CATEGORY:=Network
TITLE:=VPN tunneling daemon
URL:=http://www.ntop.org/n2n/
SUBMENU:=VPN
DEPENDS:=libpthread
endef
define Build/Configure
endef
define Build/Compile
$(MAKE) CC="$(TARGET_CC)" -C $(PKG_BUILD_DIR)
endef
define Package/n2n/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/edge $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/supernode $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,n2n))

85
packages/openwrt/Makefile

@ -0,0 +1,85 @@
#
# Copyright (C) 2019 - ntop.org and contributors
#
include $(TOPDIR)/rules.mk
PKG_NAME:=n2n
PKG_SOURCE_URL:=https://github.com/ntop/n2n.git
PKG_SOURCE_VERSION:=4d36f9f6135a19684c3509566de007b27ab31abc
PKG_VERSION:=2.5.1_git$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_PROTO:=git
PKG_MAINTAINER:=Emanuele Faranda <faranda@ntop.org>
PKG_LICENSE:=GPL3
PKG_BUILD_PARALLEL:=1
# autogen fix
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/n2n/Default
SECTION:=net
CATEGORY:=Network
TITLE:=N2N Peer-to-peer VPN
URL:=http://www.ntop.org/n2n
SUBMENU:=VPN
endef
define Package/n2n-edge
$(call Package/n2n/Default)
TITLE+= client (edge node)
DEPENDS+=+kmod-tun +resolveip +libopenssl
endef
define Package/n2n-supernode
$(call Package/n2n/Default)
TITLE+= server (supernode)
endef
define Package/n2n-edge/description
The client node for the N2N infrastructure
endef
define Package/n2n-supernode/description
The supernode for the N2N infrastructure
endef
define Build/Configure
( cd $(PKG_BUILD_DIR); ./autogen.sh )
$(call Build/Configure/Default)
endef
define Package/n2n-edge/conffiles
/etc/config/n2n-edge.conf
endef
define Package/n2n-edge/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/edge $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/edge $(1)/etc/init.d/edge
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/packages/etc/n2n/edge.conf.sample $(1)/etc/config/n2n-edge.conf
endef
define Package/n2n-supernode/conffiles
/etc/config/n2n-supernode.conf
endef
define Package/n2n-supernode/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/supernode $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/supernode $(1)/etc/init.d/supernode
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/packages/etc/n2n/supernode.conf.sample $(1)/etc/config/n2n-supernode.conf
endef
$(eval $(call BuildPackage,n2n-edge))
$(eval $(call BuildPackage,n2n-supernode))

10
packages/openwrt/README.md

@ -0,0 +1,10 @@
## Instructions
From the OpenWRT build directory:
```
git clone https://github.com/MuJJus/openwrt-n2n n2n
ln -s n2n/packages/n2n package/n2n
make menuconfig # select Network -> VPN -> n2n-edge and n2n-supernode
make package/n2n/compile V=s
```

25
packages/openwrt/etc/init.d/edge

@ -0,0 +1,25 @@
#!/bin/sh /etc/rc.common
START=90
STOP=10
USE_PROCD=1
PROG=/usr/bin/edge
CONFIGFILE=/etc/config/n2n-edge.conf
start_service() {
procd_open_instance
procd_set_param command $PROG $CONFIGFILE
procd_set_param file $CONFIGFILE
procd_set_param respawn
procd_close_instance
}
stop_service()
{
service_stop $PROG
}
service_triggers()
{
procd_add_reload_trigger "edge"
}

25
packages/openwrt/etc/init.d/supernode

@ -0,0 +1,25 @@
#!/bin/sh /etc/rc.common
START=90
STOP=10
USE_PROCD=1
PROG=/usr/bin/supernode
CONFIGFILE=/etc/config/n2n-supernode.conf
start_service() {
procd_open_instance
procd_set_param command $PROG $CONFIGFILE
procd_set_param file $CONFIGFILE
procd_set_param respawn
procd_close_instance
}
stop_service()
{
service_stop $PROG
}
service_triggers()
{
procd_add_reload_trigger "supernode"
}
Loading…
Cancel
Save