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:
suyuan168 2022-05-03 17:26:05 +08:00
parent 577b699193
commit 160ff7018b
6 changed files with 189 additions and 22 deletions

View file

@ -8,13 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2 PKG_NAME:=iproute2
PKG_VERSION:=5.15.0
PKG_RELEASE:=$(AUTORELEASE) PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/network/iproute2/iproute2.git PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
PKG_SOURCE_VERSION:=29da83f89f6e1fe528c59131a01f5d43bcd0a000 PKG_HASH:=38e3e4a5f9a7f5575c015027a10df097c149111eeb739993128e5b2b35b291ff
PKG_VERSION:=5.16.0-$(PKG_SOURCE_VERSION)
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=iptables PKG_BUILD_DEPENDS:=iptables
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
@ -58,7 +57,16 @@ $(call Package/iproute2/Default)
DEFAULT_VARIANT:=1 DEFAULT_VARIANT:=1
PROVIDES:=tc PROVIDES:=tc
ALTERNATIVES:=200:/sbin/tc:/usr/libexec/tc-tiny ALTERNATIVES:=200:/sbin/tc:/usr/libexec/tc-tiny
DEPENDS:=+kmod-sched-core +libxtables +tc-mod-iptables +(PACKAGE_devlink||PACKAGE_rdma):libmnl DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl
endef
define Package/tc-bpf
$(call Package/iproute2/Default)
TITLE:=Traffic control utility (bpf)
VARIANT:=tcbpf
PROVIDES:=tc
ALTERNATIVES:=300:/sbin/tc:/usr/libexec/tc-bpf
DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf
endef endef
define Package/tc-full define Package/tc-full
@ -66,13 +74,14 @@ $(call Package/iproute2/Default)
TITLE:=Traffic control utility (full) TITLE:=Traffic control utility (full)
VARIANT:=tcfull VARIANT:=tcfull
PROVIDES:=tc PROVIDES:=tc
ALTERNATIVES:=300:/sbin/tc:/usr/libexec/tc-full ALTERNATIVES:=400:/sbin/tc:/usr/libexec/tc-full
DEPENDS:=+kmod-sched-core +libxtables +tc-mod-iptables +libbpf +(PACKAGE_devlink||PACKAGE_rdma):libmnl DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf +libxtables +tc-mod-iptables
endef endef
define Package/tc-mod-iptables define Package/tc-mod-iptables
$(call Package/iproute2/Default) $(call Package/iproute2/Default)
TITLE:=Traffic control module - iptables action TITLE:=Traffic control module - iptables action
VARIANT:=tcfull
DEPENDS:=+libxtables DEPENDS:=+libxtables
endef endef
@ -124,13 +133,29 @@ endif
ifeq ($(BUILD_VARIANT),tctiny) ifeq ($(BUILD_VARIANT),tctiny)
LIBBPF_FORCE:=off LIBBPF_FORCE:=off
endif
ifeq ($(BUILD_VARIANT),tcbpf)
HAVE_ELF:=y
LIBBPF_FORCE:=on
SHARED_LIBS:=y SHARED_LIBS:=y
endif endif
ifeq ($(BUILD_VARIANT),tcfull) ifeq ($(BUILD_VARIANT),tcfull)
#enable iptables/xtables requirement only if tciptables variant is selected
TC_CONFIG_XT:=y
TC_CONFIG_XT_OLD:=y
TC_CONFIG_XT_OLD_H:=y
TC_CONFIG_IPSET:=y
HAVE_ELF:=y HAVE_ELF:=y
LIBBPF_FORCE:=on LIBBPF_FORCE:=on
SHARED_LIBS:=y SHARED_LIBS:=y
else
#disable iptables requirement by default
TC_CONFIG_XT:=n
TC_CONFIG_XT_OLD:=n
TC_CONFIG_XT_OLD_H:=n
TC_CONFIG_IPSET:=n
endif endif
ifdef CONFIG_PACKAGE_devlink ifdef CONFIG_PACKAGE_devlink
@ -161,6 +186,10 @@ MAKE_FLAGS += \
HAVE_CAP=$(HAVE_CAP) \ HAVE_CAP=$(HAVE_CAP) \
IPT_LIB_DIR=/usr/lib/iptables \ IPT_LIB_DIR=/usr/lib/iptables \
XT_LIB_DIR=/usr/lib/iptables \ XT_LIB_DIR=/usr/lib/iptables \
TC_CONFIG_XT=$(TC_CONFIG_XT) \
TC_CONFIG_XT_OLD=$(TC_CONFIG_XT_OLD) \
TC_CONFIG_XT_OLD_H=$(TC_CONFIG_XT_OLD_H) \
TC_CONFIG_IPSET=$(TC_CONFIG_IPSET) \
FPIC="$(FPIC)" \ FPIC="$(FPIC)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
@ -191,6 +220,11 @@ define Package/tc-tiny/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-tiny $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-tiny
endef endef
define Package/tc-bpf/install
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-bpf
endef
define Package/tc-full/install define Package/tc-full/install
$(INSTALL_DIR) $(1)/usr/libexec $(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-full $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-full
@ -231,12 +265,13 @@ define Package/rdma/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
endef endef
#$(eval $(call BuildPackage,ip-tiny)) $(eval $(call BuildPackage,ip-tiny))
$(eval $(call BuildPackage,ip-full)) $(eval $(call BuildPackage,ip-full))
# build tc-mod-iptables before its dependents, to avoid # build tc-mod-iptables before its dependents, to avoid
# spurious rebuilds when building multiple variants. # spurious rebuilds when building multiple variants.
$(eval $(call BuildPackage,tc-mod-iptables)) $(eval $(call BuildPackage,tc-mod-iptables))
#$(eval $(call BuildPackage,tc-tiny)) $(eval $(call BuildPackage,tc-tiny))
$(eval $(call BuildPackage,tc-bpf))
$(eval $(call BuildPackage,tc-full)) $(eval $(call BuildPackage,tc-full))
$(eval $(call BuildPackage,genl)) $(eval $(call BuildPackage,genl))
$(eval $(call BuildPackage,ip-bridge)) $(eval $(call BuildPackage,ip-bridge))

View file

@ -0,0 +1,110 @@
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -17,6 +17,13 @@ RTMONOBJ=rtmon.o
include ../config.mk
+STATIC_SYM_FILTER:=
+ifeq ($(IP_CONFIG_TINY),y)
+ STATIC_SYM_FILTER:=iplink_can.c iplink_ipoib.c iplink_vxlan.c
+ CFLAGS += -DIPROUTE2_TINY
+endif
+STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
+
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
SCRIPTS=ifcfg rtpr routel routef
TARGETS=ip rtmon
@@ -46,7 +53,7 @@ else
ip: static-syms.o
static-syms.o: static-syms.h
-static-syms.h: $(wildcard *.c)
+static-syms.h: $(STATIC_SYM_SOURCES)
files="$^" ; \
for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -64,11 +64,17 @@ static void usage(void)
fprintf(stderr,
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
" ip [ -force ] -batch filename\n"
+#ifndef IPROUTE2_TINY
"where OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp | link |\n"
" macsec | maddress | monitor | mptcp | mroute | mrule |\n"
" neighbor | neighbour | netconf | netns | nexthop | ntable |\n"
" ntbl | route | rule | sr | tap | tcpmetrics |\n"
" token | tunnel | tuntap | vrf | xfrm }\n"
+#else
+ "where OBJECT := { address | ila | link | macsec | maddress | monitor |\n"
+ " mroute | mrule | neighbor | neighbour | netns | route |\n"
+ " rule | sr | token | tunnel | vrf }\n"
+#endif
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
" -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"
" -f[amily] { inet | inet6 | mpls | bridge | link } |\n"
@@ -91,37 +97,51 @@ static const struct cmd {
int (*func)(int argc, char **argv);
} cmds[] = {
{ "address", do_ipaddr },
+#ifndef IPROUTE2_TINY
{ "addrlabel", do_ipaddrlabel },
+#endif
{ "maddress", do_multiaddr },
{ "route", do_iproute },
{ "rule", do_iprule },
{ "neighbor", do_ipneigh },
{ "neighbour", do_ipneigh },
+#ifndef IPROUTE2_TINY
{ "ntable", do_ipntable },
{ "ntbl", do_ipntable },
+#endif
{ "link", do_iplink },
+#ifndef IPROUTE2_TINY
{ "l2tp", do_ipl2tp },
{ "fou", do_ipfou },
+#endif
{ "ila", do_ipila },
{ "macsec", do_ipmacsec },
{ "tunnel", do_iptunnel },
{ "tunl", do_iptunnel },
+#ifndef IPROUTE2_TINY
{ "tuntap", do_iptuntap },
{ "tap", do_iptuntap },
{ "token", do_iptoken },
{ "tcpmetrics", do_tcp_metrics },
{ "tcp_metrics", do_tcp_metrics },
+#endif
{ "monitor", do_ipmonitor },
+#ifndef IPROUTE2_TINY
{ "xfrm", do_xfrm },
+#endif
{ "mroute", do_multiroute },
{ "mrule", do_multirule },
{ "netns", do_netns },
+#ifndef IPROUTE2_TINY
{ "netconf", do_ipnetconf },
+#endif
{ "vrf", do_ipvrf},
{ "sr", do_seg6 },
+#ifndef IPROUTE2_TINY
{ "nexthop", do_ipnh },
{ "mptcp", do_mptcp },
{ "ioam", do_ioam6 },
+#endif
{ "help", do_help },
{ 0 }
};
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -3,6 +3,10 @@ include ../config.mk
CFLAGS += $(FPIC)
+ifeq ($(IP_CONFIG_TINY),y)
+ CFLAGS += -DIPROUTE2_TINY
+endif
+
UTILOBJ = utils.o utils_math.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \
inet_proto.o namespace.o json_writer.o json_print.o json_print_math.o \
names.o color.o bpf_legacy.o bpf_glue.o exec.o fs.o cg_map.o

View file

@ -0,0 +1,22 @@
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -26,7 +26,7 @@ STATIC_SYM_SOURCES:=$(filter-out $(STATI
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
SCRIPTS=ifcfg rtpr routel routef
-TARGETS=ip rtmon
+TARGETS=$(findstring ip,$(BUILD_VARIANT)) rtmon
all: $(TARGETS) $(SCRIPTS)
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -141,7 +141,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
-all: tc $(TCSO)
+all: $(findstring tc,$(BUILD_VARIANT)) $(TCSO)
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
$(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@

View file

@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=xtables-addons PKG_NAME:=xtables-addons
PKG_VERSION:=3.18 PKG_VERSION:=3.19
PKG_RELEASE:=4 PKG_RELEASE:=$(AUTORELEASE)
PKG_HASH:=a77914a483ff381663f52120577e5e9355ca07cca73958b038e09d91247458d5 PKG_HASH:=5e36ea027ab15a84d9af1f3f8e84a78b80a617093657f08089bd44657722f661
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://inai.de/files/xtables-addons/ PKG_SOURCE_URL:=https://inai.de/files/xtables-addons/
@ -162,7 +162,7 @@ define Package/iptgeoip/install
$(1)/usr/lib/xtables-addons/ $(1)/usr/lib/xtables-addons/
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(CP) \ $(CP) \
$(PKG_INSTALL_DIR)/usr/bin/xt_geoip_fetch \ $(PKG_INSTALL_DIR)/usr/bin/xt_geoip_query \
$(1)/usr/bin/ $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/share/xt_geoip $(INSTALL_DIR) $(1)/usr/share/xt_geoip
touch $(1)/usr/share/xt_geoip/.keep touch $(1)/usr/share/xt_geoip/.keep

View file

@ -1,8 +1,8 @@
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return @@ -42,7 +42,7 @@ regular_CFLAGS="-Wall -Waggregate-return
if test -n "$kbuilddir"; then AS_IF([test -n "$kbuilddir"], [
AC_MSG_CHECKING([kernel version that we will build against]) AC_MSG_CHECKING([kernel version that we will build against])
- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')" - krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"
+ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')" + krel="$(make -sC "$kbuilddir" M=$PWD kernelversion | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"

View file

@ -1137,7 +1137,7 @@
+ struct xt_lua_tginfo *info = (void *)target->data; + struct xt_lua_tginfo *info = (void *)target->data;
+ +
+ info->state_id = 0; + info->state_id = 0;
+ strncpy(info->function, "process_packet\0", sizeof("process_packet\0")); + strcpy(info->function, "process_packet\0");
+} +}
+ +
+static int +static int
@ -5301,7 +5301,7 @@
+ case OP_FORLOOP: + case OP_FORLOOP:
+ case OP_FORPREP: + case OP_FORPREP:
+ checkreg(pt, a+3); + checkreg(pt, a+3);
+ /* go through */ + fallthrough;
+ case OP_JMP: { + case OP_JMP: {
+ int dest = pc+1+b; + int dest = pc+1+b;
+ /* not full check and jump is forward and do not skip `lastpc'? */ + /* not full check and jump is forward and do not skip `lastpc'? */
@ -7716,6 +7716,7 @@
+ } + }
+ else if (sep == -1) return '['; + else if (sep == -1) return '[';
+ else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
+ fallthrough;
+ } + }
+ case '=': { + case '=': {
+ next(ls); + next(ls);
@ -7809,7 +7810,6 @@
+ lua_assert(ls->lookahead.token == TK_EOS); + lua_assert(ls->lookahead.token == TK_EOS);
+ ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
+} +}
+
--- /dev/null --- /dev/null
+++ b/extensions/LUA/lua/llex.h +++ b/extensions/LUA/lua/llex.h
@@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
@ -12471,7 +12471,7 @@
+ lua_number2int(k, n); + lua_number2int(k, n);
+ if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ + if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */
+ return luaH_getnum(t, k); /* use specialized version */ + return luaH_getnum(t, k); /* use specialized version */
+ /* else go through */ + fallthrough;
+ } + }
+ default: { + default: {
+ Node *n = mainposition(t, key); + Node *n = mainposition(t, key);
@ -17984,7 +17984,7 @@
+ int32_t ret; + int32_t ret;
+ struct lua_env * env = kmalloc(sizeof(struct lua_env), GFP_KERNEL); + struct lua_env * env = kmalloc(sizeof(struct lua_env), GFP_KERNEL);
+ +
+ if (!script_size > 0) { + if (!script_size) {
+ pr_debug("LUA [%d]: script_size %lu < 0\n", state_id, script_size); + pr_debug("LUA [%d]: script_size %lu < 0\n", state_id, script_size);
+ return false; + return false;
+ } + }