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

Merge pull request #305 from Ysurac/develop

升级 iproute2
This commit is contained in:
suyuan 2023-03-03 22:25:44 +08:00 committed by GitHub
commit f67d8abc30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 197 additions and 17 deletions

View file

@ -8,13 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/network/iproute2/iproute2.git
PKG_SOURCE_VERSION:=29da83f89f6e1fe528c59131a01f5d43bcd0a000
PKG_VERSION:=5.16.0-$(PKG_SOURCE_VERSION)
PKG_VERSION:=6.2.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
PKG_HASH:=4d72730200ec5b2aabaa1a2f20553c6748292f065d9a154c7d5e22559df9fd62
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=iptables
PKG_LICENSE:=GPL-2.0
@ -58,7 +57,16 @@ $(call Package/iproute2/Default)
DEFAULT_VARIANT:=1
PROVIDES:=tc
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
define Package/tc-full
@ -66,14 +74,15 @@ $(call Package/iproute2/Default)
TITLE:=Traffic control utility (full)
VARIANT:=tcfull
PROVIDES:=tc
ALTERNATIVES:=300:/sbin/tc:/usr/libexec/tc-full
DEPENDS:=+kmod-sched-core +libxtables +tc-mod-iptables +libbpf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
ALTERNATIVES:=400:/sbin/tc:/usr/libexec/tc-full
DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf +libxtables +tc-mod-iptables
endef
define Package/tc-mod-iptables
$(call Package/iproute2/Default)
TITLE:=Traffic control module - iptables action
DEPENDS:=+libxtables
VARIANT:=tcfull
DEPENDS:=+libxtables +libbpf
endef
define Package/genl
@ -124,13 +133,29 @@ endif
ifeq ($(BUILD_VARIANT),tctiny)
LIBBPF_FORCE:=off
endif
ifeq ($(BUILD_VARIANT),tcbpf)
HAVE_ELF:=y
LIBBPF_FORCE:=on
SHARED_LIBS:=y
endif
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
LIBBPF_FORCE:=on
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
ifdef CONFIG_PACKAGE_devlink
@ -151,7 +176,7 @@ TARGET_LDFLAGS += -Wl,--gc-sections -Wl,--as-needed
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
MAKE_FLAGS += \
KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
KERNEL_INCLUDE="$(LINUX_DIR)/include/uapi" \
SHARED_LIBS=$(SHARED_LIBS) \
IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
BUILD_VARIANT=$(BUILD_VARIANT) \
@ -159,8 +184,13 @@ MAKE_FLAGS += \
HAVE_ELF=$(HAVE_ELF) \
HAVE_MNL=$(HAVE_MNL) \
HAVE_CAP=$(HAVE_CAP) \
HAVE_TIRPC=n \
IPT_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)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
@ -191,6 +221,11 @@ define Package/tc-tiny/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-tiny
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
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-full
@ -231,12 +266,13 @@ define Package/rdma/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
endef
#$(eval $(call BuildPackage,ip-tiny))
$(eval $(call BuildPackage,ip-tiny))
$(eval $(call BuildPackage,ip-full))
# build tc-mod-iptables before its dependents, to avoid
# spurious rebuilds when building multiple variants.
$(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,genl))
$(eval $(call BuildPackage,ip-bridge))

View file

@ -1,11 +1,14 @@
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,7 @@ WFLAGS += -Wmissing-declarations -Wold-s
@@ -65,9 +65,9 @@ WFLAGS += -Wmissing-declarations -Wold-s
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
YACCFLAGS = -d -t -v
-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa
+SUBDIRS=lib ip tc bridge misc genl devlink rdma
-SUBDIRS=lib ip tc bridge misc netem genl man
+SUBDIRS=lib ip tc bridge misc genl
ifeq ($(HAVE_MNL),y)
-SUBDIRS += tipc devlink rdma dcb vdpa
+SUBDIRS += devlink rdma
endif
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
LDLIBS += $(LIBNETLINK)

View file

@ -0,0 +1,11 @@
--- a/configure
+++ b/configure
@@ -398,7 +398,7 @@ check_selinux()
check_tirpc()
{
- if ${PKG_CONFIG} libtirpc --exists; then
+ if [ "${HAVE_TIRPC}" = "y" ] && ${PKG_CONFIG} libtirpc --exists; then
echo "HAVE_RPC:=y" >>$CONFIG
echo "yes"

View file

@ -0,0 +1,108 @@
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -19,6 +19,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=routel
TARGETS=ip rtmon
@@ -48,7 +55,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
@@ -61,11 +61,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 | amt | fou | help | ila | ioam | l2tp |\n"
" link | 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 | link | maddress | monitor |\n"
+ " neighbor | neighbour | netns | route |\n"
+ " rule | token | tunnel }\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"
@@ -88,37 +94,49 @@ 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 },
{ "ila", do_ipila },
{ "macsec", do_ipmacsec },
+#endif
{ "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 },
{ "mroute", do_multiroute },
{ "mrule", do_multirule },
+#endif
{ "netns", do_netns },
+#ifndef IPROUTE2_TINY
{ "netconf", do_ipnetconf },
{ "vrf", do_ipvrf},
{ "sr", do_seg6 },
{ "nexthop", do_ipnh },
{ "mptcp", do_mptcp },
{ "ioam", do_ioam6 },
+#endif
{ "help", do_help },
{ "stats", do_ipstats },
{ 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 ppp_proto.o

View file

@ -0,0 +1,22 @@
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -28,7 +28,7 @@ STATIC_SYM_SOURCES:=$(filter-out $(STATI
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
SCRIPTS=routel
-TARGETS=ip rtmon
+TARGETS=$(findstring ip,$(BUILD_VARIANT)) rtmon
all: $(TARGETS) $(SCRIPTS)
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -140,7 +140,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 $@