1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Put 6in4 support in an other package

This commit is contained in:
Ycarus 2018-05-29 18:05:02 +02:00
parent 3652b85cef
commit fe39ad4d90
4 changed files with 68 additions and 7 deletions

37
omr-6in4/Makefile Normal file
View file

@ -0,0 +1,37 @@
#
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=omr-6in4
PKG_VERSION:=0.1
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
MY_DEPENDS := \
6in4
define Package/$(PKG_NAME)
SECTION:=OMR
CATEGORY:=OpenMPTCProuter
DEPENDS:=$(foreach p,$(MY_DEPENDS),+$(p))
TITLE:=OpenMPTCProuter 6in4
endef
define Package/$(PKG_NAME)/description
OpenMPTCProuter 6in4 package
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View file

@ -0,0 +1,27 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2014 OpenWrt.org
START=99
USE_PROCD=1
service_triggers() {
procd_add_network_trigger "glorytun"
}
reload_service() {
addr=$(ifstatus glorytun | jsonfilter -e '@["ipv4-address"][0].address')
peer=$(ifstatus glorytun | jsonfilter -e '@["route"][0].nexthop')
if [ "$addr" != "$(uci -q get network.omr6in4.ipaddr)" ] || [ "$peer" != "$(uci -q get network.omr6in4.peeraddr)" ]; then
uci -q batch <<-EOF
set network.omr6in4.ipaddr=$addr
set network.omr6in4.peeraddr=$peer
EOF
if [ "$(uci -q get glorytun.vpn.proto)" = "udp" ]; then
uci -q set network.omr6in4.gateway=fe80::a00:101
elif [ "$(uci -q get glorytun.vpn.proto)" = "tcp" ]; then
uci -q set network.omr6in4.gateway=fe80::a00:1
fi
uci -q commit network
ifup omr6in4
fi
}

View file

@ -0,0 +1,20 @@
#!/bin/sh
. /lib/functions.sh
if [ "$(uci -q show network | grep omr6in4)" = "" ]; then
uci -q batch <<-EOF
set network.omr6in4=interface
set network.omr6in4.proto=6in4
set network.omr6in4.ip4table=vpn
set network.omr6in4.multipath=off
set network.omr6in4.ipaddr=10.0.0.2
set network.omr6in4.peeraddr=10.0.0.1
set network.omr6in4.gateway=fe80::a00:1
commit network
add_list firewall.@zone[2].network=omr6in4
commit firewall
EOF
rm -f /tmp/luci-indexcache
fi
exit 0