From 2d9f9e7fa26ff33fa73fa2941bea0a6879bc1bfe Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 14 Apr 2022 19:57:01 +0200 Subject: [PATCH 1/2] Change RUTX network configuration (vlan1 & 2 are reserved) --- .../files/etc/uci-defaults/1920-omr-network | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/openmptcprouter/files/etc/uci-defaults/1920-omr-network b/openmptcprouter/files/etc/uci-defaults/1920-omr-network index 5ed5603d9..a480d0d12 100755 --- a/openmptcprouter/files/etc/uci-defaults/1920-omr-network +++ b/openmptcprouter/files/etc/uci-defaults/1920-omr-network @@ -88,6 +88,34 @@ elif [ -d /sys/class/net/lan1 -o -n "$(ip link | grep ' lan1')" ] && [ -d /sys/c lanif="wan" elif [ -d /sys/class/net/lan ] || [ -n "$(ip link | grep ' lan')" ]; then lanif="lan" +elif [ "$(swconfig list 2>&1 | grep switch0)" != "" ] && [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.platform' | tr -d '\n')" = "RUTX" ]; then + lanif="eth1" + uci -q batch <<-EOF + set network.@switch_vlan[0]=switch_vlan + set network.@switch_vlan[0].device='switch0' + set network.@switch_vlan[0].vlan=1 + set network.@switch_vlan[0].ports='1t 2t 3t 4t 0t' + set network.@switch_vlan[1]=switch_vlan + set network.@switch_vlan[1].device='switch0' + set network.@switch_vlan[1].vlan=1 + set network.@switch_vlan[1].ports='5 0' + add network switch_vlan + set network.@switch_vlan[2].device='switch0' + set network.@switch_vlan[2].vlan=3 + set network.@switch_vlan[2].ports='0t 1' + add network switch_vlan + set network.@switch_vlan[3].device='switch0' + set network.@switch_vlan[3].vlan=4 + set network.@switch_vlan[3].ports='0t 2' + add network switch_vlan + set network.@switch_vlan[4].device='switch0' + set network.@switch_vlan[4].vlan=5 + set network.@switch_vlan[4].ports='0t 3' + add network switch_vlan + set network.@switch_vlan[5].device='switch0' + set network.@switch_vlan[5].vlan=6 + set network.@switch_vlan[5].ports='0t 4' + EOF elif [ "$(swconfig list 2>&1 | grep switch0)" != "" ] && [ -d '/sys/class/net/eth1.5' ]; then lanif="eth1.5" uci -q batch <<-EOF @@ -131,6 +159,7 @@ set network.lan.proto=static set network.lan.ipaddr=192.168.100.1 set network.lan.netmask=255.255.255.0 set network.lan.device=${lanif} +set network.lan.ifname=${lanif} set network.lan.metric=2048 set network.lan.ipv6=0 set network.lan.delegate=0 @@ -181,6 +210,11 @@ if [ "$(uci -q show network.wan1 | grep multipath)" = "" ] && [ -z "$(uci -q get _setup_wan_interface wan2 eth0 on macvlan _setup_macvlan wan1 _setup_macvlan wan2 + elif [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.platform' | tr -d '\n')" = "RUTX" ]; then + _setup_wan_interface wan1 eth0.3 master + _setup_wan_interface wan2 eth0.4 on + _setup_wan_interface wan3 eth0.5 on + _setup_wan_interface wan4 eth0.6 on elif [ "$(swconfig list 2>&1 | grep switch0)" != "" ]; then _setup_wan_interface wan1 eth0.1 master _setup_wan_interface wan2 eth0.2 on From 3e8c9b87f8800e3e42e16f371c22f28a49a70db4 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 14 Apr 2022 19:57:40 +0200 Subject: [PATCH 2/2] Add grpcurl package --- grpcurl/Makefile | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 grpcurl/Makefile diff --git a/grpcurl/Makefile b/grpcurl/Makefile new file mode 100644 index 000000000..8bec5ccf4 --- /dev/null +++ b/grpcurl/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2022 Ycarus (Yannick Chabanois) for OpenMPTCProuter +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=grpcurl +PKG_VERSION:=1.8.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/fullstorydev/grpcurl/archive/refs/tags/ +PKG_HASH:=18b457f644baabeef0de350596dd8d23563586ee94a3ed3cb290063e097ab934 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Yannick Chabanois + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/fullstorydev/grpcurl +GO_PKG_BUILD_PKG:=github.com/fullstorydev/grpcurl/cmd/grpcurl +GO_PKG_LDFLAGS_X:= \ + $(GO_PKG)/constant.Version=$(PKG_VERSION) \ + $(GO_PKG)/constant.Commit=v$(PKG_VERSION) +GO_PKG_LDFLAGS:=-s -w +GO_PKG_TAGS:=master + +include $(INCLUDE_DIR)/package.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk + +define Package/grpcurl + TITLE:=grpcurl is a command-line tool that lets you interact with gRPC servers + URL:=https://github.com/fullstorydev/grpcurl + SECTION:=net + CATEGORY:=Network + DEPENDS:=$(GO_ARCH_DEPENDS) +protobuf +endef + +define Package/grpcurl/description + grpcurl is a command-line tool that lets you interact with gRPC servers. It's basically curl for gRPC servers. + + The main purpose for this tool is to invoke RPC methods on a gRPC server from the command-line. gRPC servers use a binary encoding on the wire (protocol buffers, or "protobufs" for short). So they are basically impossible to interact with using regular curl (and older versions of curl that do not support HTTP/2 are of course non-starters). This program accepts messages using JSON encoding, which is much more friendly for both humans and scripts. +endef + +define Package/v2ray-core/install + $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR)) + + $(INSTALL_DIR) $(1)/usr/bin + + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/grpcurl $(1)/usr/bin +endef + +$(eval $(call GoBinPackage,grpcurl)) +$(eval $(call BuildPackage,grpcurl))