1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2021-01-03 22:15:33 +08:00
parent a783ac6f9b
commit 58ae99fc36
6 changed files with 0 additions and 673 deletions

View file

@ -1,45 +0,0 @@
#
# Copyright (C) 2010-2015 OpenWrt.org
# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# - Added gateway setting
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=6in4
PKG_VERSION:=270
PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define Package/6in4
SECTION:=net
CATEGORY:=Network
DEPENDS:=@IPV6 +kmod-sit +uclient-fetch
TITLE:=IPv6-in-IPv4 configuration support
MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKGARCH:=all
endef
define Package/6in4/description
Provides support for 6in4 tunnels in /etc/config/network.
Refer to http://wiki.openwrt.org/doc/uci/network for
configuration details.
endef
define Build/Compile
endef
define Build/Configure
endef
define Package/6in4/install
$(INSTALL_DIR) $(1)/lib/netifd/proto
$(INSTALL_BIN) ./files/6in4.sh $(1)/lib/netifd/proto/6in4.sh
endef
$(eval $(call BuildPackage,6in4))

View file

@ -1,149 +0,0 @@
#!/bin/sh
# 6in4.sh - IPv6-in-IPv4 tunnel backend
# Copyright (c) 2010-2015 OpenWrt.org
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. /lib/functions/network.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_6in4_update() {
sh -c '
timeout=5
(while [ $((timeout--)) -gt 0 ]; do
sleep 1
kill -0 $$ || exit 0
done; kill -9 $$) 2>/dev/null &
exec "$@"
' "$1" "$@"
}
proto_6in4_add_prefix() {
append "$3" "$1"
}
proto_6in4_setup() {
local cfg="$1"
local iface="$2"
local link="6in4-$cfg"
local mtu ttl tos ipaddr peeraddr ip6addr ip6prefix ip6prefixes tunlink tunnelid username password updatekey gateway
json_get_vars mtu ttl tos ipaddr peeraddr ip6addr tunlink tunnelid username password updatekey gateway
json_for_each_item proto_6in4_add_prefix ip6prefix ip6prefixes
[ -z "$peeraddr" ] && {
proto_notify_error "$cfg" "MISSING_ADDRESS"
proto_block_restart "$cfg"
return
}
[ -n "$tunlink" ] && ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
[ -z "$ipaddr" ] && {
local wanif="$tunlink"
if [ -z "$wanif" ] && ! network_find_wan wanif; then
proto_notify_error "$cfg" "NO_WAN_LINK"
return
fi
if ! network_get_ipaddr ipaddr "$wanif"; then
proto_notify_error "$cfg" "NO_WAN_LINK"
return
fi
}
proto_init_update "$link" 1
[ -n "$ip6addr" ] && {
local local6="${ip6addr%%/*}"
local mask6="${ip6addr##*/}"
[[ "$local6" = "$mask6" ]] && mask6=
proto_add_ipv6_address "$local6" "$mask6"
proto_add_ipv6_route "::" 0 "" "" "" "$local6/$mask6"
}
[ -n "$gateway" ] && {
proto_add_ipv6_route "::" 0 "$gateway"
}
for ip6prefix in $ip6prefixes; do
proto_add_ipv6_prefix "$ip6prefix"
proto_add_ipv6_route "::" 0 "" "" "" "$ip6prefix"
done
proto_add_tunnel
json_add_string mode sit
json_add_int mtu "${mtu:-1280}"
json_add_int ttl "${ttl:-64}"
[ -n "$tos" ] && json_add_string tos "$tos"
json_add_string local "$ipaddr"
json_add_string remote "$peeraddr"
[ -n "$tunlink" ] && json_add_string link "$tunlink"
proto_close_tunnel
proto_send_update "$cfg"
[ -n "$tunnelid" -a -n "$username" -a \( -n "$password" -o -n "$updatekey" \) ] && {
[ -n "$updatekey" ] && password="$updatekey"
local http="http"
local urlget="uclient-fetch"
local urlget_opts="-qO-"
local ca_path="${SSL_CERT_DIR:-/etc/ssl/certs}"
[ -f /lib/libustream-ssl.so ] && http=https
[ "$http" = "https" -a -z "$(find $ca_path -name "*.0" 2>/dev/null)" ] && {
urlget_opts="$urlget_opts --no-check-certificate"
}
local url="$http://ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid"
local try=0
local max=3
(
set -o pipefail
while [ $((++try)) -le $max ]; do
if proto_6in4_update $urlget $urlget_opts --user="$username" --password="$password" "$url" 2>&1 | \
sed -e 's,^Killed$,timeout,' -e "s,^,update $try/$max: ," | \
logger -t "$link";
then
logger -t "$link" "updated"
return 0
fi
sleep 5
done
logger -t "$link" "update failed"
)
}
}
proto_6in4_teardown() {
local cfg="$1"
}
proto_6in4_init_config() {
no_device=1
available=1
proto_config_add_string "ipaddr"
proto_config_add_string "ip6addr"
proto_config_add_array "ip6prefix"
proto_config_add_string "peeraddr"
proto_config_add_string "tunlink"
proto_config_add_string "tunnelid"
proto_config_add_string "username"
proto_config_add_string "password"
proto_config_add_string "updatekey"
proto_config_add_string "gateway"
proto_config_add_int "mtu"
proto_config_add_int "ttl"
proto_config_add_string "tos"
}
[ -n "$INCLUDE_ONLY" ] || {
add_protocol 6in4
}

View file

@ -1,84 +0,0 @@
#
# Copyright (C) 2007-2010 OpenWrt.org
# Copyright (C) 2019 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:=iperf
PKG_SOURCE_VERSION:=02a5f4755878b319f0db5ccd490daf61e6d76043
PKG_VERSION:=3.7-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/esnet/iperf.git
PKG_MAINTAINER:=Yannick Chabanois <ycarus@zugaina.org>
PKG_LICENSE:=BSD-3-Clause
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
DISABLE_NLS:=
define Package/iperf3/default
SECTION:=net
CATEGORY:=Network
TITLE:=Internet Protocol bandwidth measuring tool
URL:=https://github.com/esnet/iperf
endef
define Package/iperf3
$(call Package/iperf3/default)
VARIANT:=nossl
endef
define Package/iperf3-ssl
$(call Package/iperf3/default)
TITLE+= with iperf_auth support
VARIANT:=ssl
DEPENDS:= +libopenssl
endef
TARGET_CFLAGS += -D_GNU_SOURCE
CONFIGURE_ARGS += --disable-shared
ifeq ($(BUILD_VARIANT),ssl)
CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr"
else
CONFIGURE_ARGS += --without-openssl
endif
MAKE_FLAGS += noinst_PROGRAMS=
define Package/iperf3/description
Iperf is a modern alternative for measuring TCP and UDP bandwidth
performance, allowing the tuning of various parameters and
characteristics.
endef
# autoreconf fails if the README file isn't present
define Build/Prepare
$(call Build/Prepare/Default)
touch $(PKG_BUILD_DIR)/README
endef
define Package/iperf3/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
endef
define Package/iperf3-ssl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
endef
$(eval $(call BuildPackage,iperf3))
$(eval $(call BuildPackage,iperf3-ssl))

View file

@ -1,108 +0,0 @@
#
# Copyright (C) 2007-2015 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:=protobuf
PKG_VERSION:=3.5.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-cpp-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/google/protobuf/releases/download/v$(PKG_VERSION)
PKG_HASH:=c28dba8782da2cfea1e11c61d335958c31a9c1bc553063546af9cbe98f204092
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=protobuf/host
PKG_USE_MIPS16:=0# MIPS16 prevents protobuf's usage of the 'sync' asm-opcode
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
define Package/protobuf/Default
SECTION:=libs
CATEGORY:=Libraries
TITLE:=A structured data encoding library
URL:=https://github.com/google/protobuf
DEPENDS:=+zlib +libpthread +libstdcpp
MAINTAINER:=Ken Keys <kkeys@caida.org>
endef
define Package/protobuf
$(call Package/protobuf/Default)
DEPENDS+=+protobuf-lite
endef
define Package/protobuf-lite
$(call Package/protobuf/Default)
endef
define Package/protobuf/description/Default
Protocol Buffers are a way of encoding structured data in an efficient
yet extensible format. Google uses Protocol Buffers for almost all
of its internal RPC protocols and file formats.
endef
define Package/protobuf/description
$(call Package/protobuf/description/Default)
This package provides the libprotoc, libprotobuf, and libprotobuf-lite
libraries. For a much smaller protobuf package, see "protobuf-lite".
endef
define Package/protobuf-lite/description
$(call Package/protobuf/description/Default)
This package provides the libprotobuf-lite library.
endef
CONFIGURE_ARGS += --with-protoc=$(STAGING_DIR_HOSTPKG)/bin/protoc
define Build/InstallDev
$(INSTALL_DIR) \
$(1)/usr/lib \
$(1)/usr/include
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/* \
$(1)/usr/include/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/* \
$(1)/usr/lib/
endef
define Package/protobuf-lite/install
$(INSTALL_DIR) \
$(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
$(1)/usr/lib/
endef
define Package/protobuf/install
$(INSTALL_DIR) \
$(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
$(1)/usr/lib/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
$(1)/usr/lib/
endef
$(eval $(call BuildPackage,protobuf))
$(eval $(call BuildPackage,protobuf-lite))
$(eval $(call HostBuild))

View file

@ -1,47 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=umbim
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/umbim.git
PKG_SOURCE_DATE:=2019-09-11
PKG_SOURCE_VERSION:=184b707ddaa0acee84d02e0ffe599cb8b67782bd
PKG_MIRROR_HASH:=482ff69144f81fafed99035840f5a24e772472f2df2f3ac0219d6de791ac5835
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
PKG_BUILD_PARALLEL:=1
PKG_FLAGS:=nonshared
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/umbim
SECTION:=net
CATEGORY:=Network
SUBMENU:=WWAN
DEPENDS:=+libubox +kmod-usb-net +kmod-usb-net-cdc-mbim +wwan
TITLE:=Control utility for mobile broadband modems
endef
define Package/umbim/description
umbim is a command line tool for controlling mobile broadband modems using
the MBIM-protocol.
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections
define Package/umbim/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/umbim $(1)/sbin/
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,umbim))

View file

@ -1,240 +0,0 @@
#!/bin/sh
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
}
#DBG=-v
proto_mbim_init_config() {
available=1
no_device=1
proto_config_add_string "device:device"
proto_config_add_string pdptype
proto_config_add_string apn
proto_config_add_string pincode
proto_config_add_string delay
proto_config_add_string auth
proto_config_add_string username
proto_config_add_string password
proto_config_add_defaults
}
_proto_mbim_setup() {
local interface="$1"
local tid=2
local device pdptype apn pincode delay auth username password $PROTO_DEFAULT_OPTIONS
json_get_vars device pdptype apn pincode delay auth username password $PROTO_DEFAULT_OPTIONS
[ -n "$ctl_device" ] && device=$ctl_device
pdptype=$(echo "$pdptype" | awk '{print tolower($0)}')
case "$pdptype" in
ip )
pdptype="ipv4"
;;
ipv4 | ipv6 | ipv4v6 | ipv4-and-ipv6 )
;;
* ) pdptype="default" ;;
esac
[ -n "$device" ] || {
echo "mbim[$$]" "No control device specified"
proto_notify_error "$interface" NO_DEVICE
proto_set_available "$interface" 0
return 1
}
[ -c "$device" ] || {
echo "mbim[$$]" "The specified control device does not exist"
proto_notify_error "$interface" NO_DEVICE
proto_set_available "$interface" 0
return 1
}
devname="$(basename "$device")"
devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
ifname="$( ls "$devpath"/net )"
[ -n "$ifname" ] || {
echo "mbim[$$]" "Failed to find matching interface"
proto_notify_error "$interface" NO_IFNAME
proto_set_available "$interface" 0
return 1
}
[ -n "$apn" ] || {
echo "mbim[$$]" "No APN specified"
proto_notify_error "$interface" NO_APN
return 1
}
[ -n "$delay" ] && sleep "$delay"
echo "mbim[$$]" "Reading capabilities"
umbim $DBG -n -d $device caps || {
echo "mbim[$$]" "Failed to read modem caps"
proto_notify_error "$interface" PIN_FAILED
return 1
}
tid=$((tid + 1))
[ "$pincode" ] && {
echo "mbim[$$]" "Sending pin"
umbim $DBG -n -t $tid -d $device unlock "$pincode" || {
echo "mbim[$$]" "Unable to verify PIN"
proto_notify_error "$interface" PIN_FAILED
proto_block_restart "$interface"
return 1
}
}
tid=$((tid + 1))
echo "mbim[$$]" "Checking pin"
local pinstate="/var/run/mbim.$$.pinstate"
umbim $DBG -n -t $tid -d $device pinstate > "$pinstate" 2>&1 || {
local pin
pin=$(awk '$2=="pin:" {print $5}' "$pinstate")
# we only need pin1 (the SIM pin) to connect
[ "$pin" = "pin1" ] && {
echo "mbim[$$]" "PIN required"
proto_notify_error "$interface" PIN_FAILED
proto_block_restart "$interface"
return 1
}
}
tid=$((tid + 1))
echo "mbim[$$]" "Checking subscriber"
umbim $DBG -n -t $tid -d $device subscriber || {
echo "mbim[$$]" "Subscriber init failed"
proto_notify_error "$interface" NO_SUBSCRIBER
return 1
}
tid=$((tid + 1))
echo "mbim[$$]" "Register with network"
umbim $DBG -n -t $tid -d $device registration || {
echo "mbim[$$]" "Subscriber registration failed"
proto_notify_error "$interface" NO_REGISTRATION
return 1
}
tid=$((tid + 1))
echo "mbim[$$]" "Attach to network"
umbim $DBG -n -t $tid -d $device attach || {
echo "mbim[$$]" "Failed to attach to network"
proto_notify_error "$interface" ATTACH_FAILED
return 1
}
tid=$((tid + 1))
echo "mbim[$$]" "Connect to network"
while ! umbim $DBG -n -t $tid -d $device connect "$pdptype:$apn" "$auth" "$username" "$password"; do
tid=$((tid + 1))
sleep 1;
done
tid=$((tid + 1))
echo "mbim[$$]" "Connected, obtain IP address and configure interface"
local config="/var/run/mbim.$$.config"
umbim $DBG -n -t $tid -d $device config > "$config" || {
echo "mbim[$$]" "Failed to obtain IP address"
proto_notify_error "$interface" CONFIG_FAILED
return 1
}
tid=$((tid + 1))
proto_init_update "$ifname" 1
proto_add_data
json_add_int tid $tid
proto_close_data
proto_send_update "$interface"
local ip_4 ip_6
ip_4=$(awk '$1=="ipv4address:" {print $2}' "$config")
ip_6=$(awk '$1=="ipv6address:" {print $2}' "$config")
[ -n "$ip_4" ] || [ -n "$ip_6" ] || {
echo "mbim[$$]" "Failed to obtain IP addresses"
proto_notify_error "$interface" CONFIG_FAILED
return 1
}
proto_init_update "$ifname" 1
proto_set_keep 1
local ip mask gateway mtu dns dns_servers
[ -n "$ip_4" ] && {
echo "mbim[$$]" "Configure IPv4 on $ifname"
ip=${ip_4%%/*}
mask=${ip_4##*/}
gateway=$(awk '$1=="ipv4gateway:" {print $2}' "$config")
mtu=$(awk '$1=="ipv4mtu:" {print $2}' "$config")
[ "$mtu" ] && ip link set "$ifname" mtu "$mtu"
proto_add_ipv4_address "$ip" "$mask"
[ "$defaultroute" = 0 ] || proto_add_ipv4_route 0.0.0.0 0 "$gateway" "$ip_4" "$metric"
[ "$peerdns" = 0 ] || {
dns_servers=$(awk '$1=="ipv4dnsserver:" {printf "%s ",$2}' "$config")
for dns in $dns_servers; do
proto_add_dns_server "$dns"
done
}
}
[ -n "$ip_6" ] && {
echo "mbim[$$]" "Configure IPv6 on $ifname"
ip=${ip_6%%/*}
mask=${ip_6##*/}
gateway=$(awk '$1=="ipv6gateway:" {print $2}' "$config")
mtu=$(awk '$1=="ipv6mtu:" {print $2}' "$config")
[ "$mtu" ] && ip -6 link set "$ifname" mtu "$mtu"
proto_add_ipv6_address "$ip" "$mask"
proto_add_ipv6_prefix "$ip_6"
[ "$defaultroute" = 0 ] || proto_add_ipv6_route "::" 0 "$gateway" "$metric" "" "$ip_6"
[ "$peerdns" = 0 ] || {
dns_servers=$(awk '$1=="ipv6dnsserver:" {printf "%s ",$2}' "$config")
for dns in $dns_servers; do
proto_add_dns_server "$dns"
done
}
}
proto_send_update "$interface"
echo "mbim[$$]" "Connection setup complete"
}
proto_mbim_setup() {
local ret
_proto_mbim_setup "$@"
ret=$?
rm -f "/var/run/mbim.$$."*
[ "$ret" = 0 ] || {
logger "mbim bringup failed, retry in 15s"
sleep 15
}
return $ret
}
proto_mbim_teardown() {
local interface="$1"
local device tid
json_get_vars device tid
[ -n "$ctl_device" ] && device=$ctl_device
echo "mbim[$$]" "Stopping network"
[ -n "$tid" ] && umbim $DBG -t$tid -d "$device" disconnect
proto_init_update "*" 0
proto_send_update "$interface"
}
[ -n "$INCLUDE_ONLY" ] || add_protocol mbim