Merge pull request #9938 from breakings/iproute2

This commit is contained in:
aiamadeus 2022-08-16 15:28:47 +08:00 committed by GitHub
commit 7e274cbde2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 110 additions and 34 deletions

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2 PKG_NAME:=iproute2
PKG_VERSION:=5.15.0 PKG_VERSION:=5.19.0
PKG_RELEASE:=$(AUTORELEASE) PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
PKG_HASH:=38e3e4a5f9a7f5575c015027a10df097c149111eeb739993128e5b2b35b291ff PKG_HASH:=26b7a34d6a7fd2f7a42e2b39c5a90cb61bac522d1096067ffeb195e5693d7791
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
@ -57,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
@ -65,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
@ -123,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
@ -158,8 +184,13 @@ MAKE_FLAGS += \
HAVE_ELF=$(HAVE_ELF) \ HAVE_ELF=$(HAVE_ELF) \
HAVE_MNL=$(HAVE_MNL) \ HAVE_MNL=$(HAVE_MNL) \
HAVE_CAP=$(HAVE_CAP) \ HAVE_CAP=$(HAVE_CAP) \
HAVE_TIRPC=n \
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='')
@ -190,6 +221,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
@ -236,6 +272,7 @@ $(eval $(call BuildPackage,ip-full))
# 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

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -34,7 +34,8 @@ int main(int argc, char **argv) { @@ -36,7 +36,8 @@ int main(int argc, char **argv) {
} }
EOF EOF

View File

@ -0,0 +1,27 @@
From c69e8e474936795a2cd7638b11ce3e99ff4d5ae7 Mon Sep 17 00:00:00 2001
From: Nick Hainke <vincent@systemli.org>
Date: Sat, 6 Aug 2022 10:00:20 +0200
Subject: [PATCH] ipstats: Define MIN function to fix undefined references
Fixes errors in the form of:
in function `ipstats_show_64':
<artificial>:(.text+0x4e30): undefined reference to `MIN'
Signed-off-by: Nick Hainke <vincent@systemli.org>
---
ip/ipstats.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/ip/ipstats.c
+++ b/ip/ipstats.c
@@ -6,6 +6,10 @@
#include "utils.h"
#include "ip_common.h"
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
struct ipstats_stat_dump_filters {
/* mask[0] filters outer attributes. Then individual nests have their
* filtering mask at the index of the nested attribute.

View File

@ -1,11 +1,14 @@
--- a/Makefile --- a/Makefile
+++ b/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) CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
YACCFLAGS = -d -t -v YACCFLAGS = -d -t -v
-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa -SUBDIRS=lib ip tc bridge misc netem genl man
+SUBDIRS=lib ip tc bridge misc genl devlink rdma +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 LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
LDLIBS += $(LIBNETLINK)

View File

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -387,7 +387,7 @@ check_selinux() @@ -411,7 +411,7 @@ check_tirpc()
check_mnl() check_mnl()
{ {

View File

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -255,7 +255,7 @@ EOF @@ -266,7 +266,7 @@ EOF
check_elf() check_elf()
{ {

View File

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -445,7 +445,7 @@ EOF @@ -469,7 +469,7 @@ EOF
check_cap() check_cap()
{ {

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

@ -1,6 +1,6 @@
--- a/ip/Makefile --- a/ip/Makefile
+++ b/ip/Makefile +++ b/ip/Makefile
@@ -17,6 +17,13 @@ RTMONOBJ=rtmon.o @@ -19,6 +19,13 @@ RTMONOBJ=rtmon.o
include ../config.mk include ../config.mk
@ -12,9 +12,9 @@
+STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c)) +STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
+ +
ALLOBJ=$(IPOBJ) $(RTMONOBJ) ALLOBJ=$(IPOBJ) $(RTMONOBJ)
SCRIPTS=ifcfg rtpr routel routef SCRIPTS=routel
TARGETS=ip rtmon TARGETS=ip rtmon
@@ -46,7 +53,7 @@ else @@ -48,7 +55,7 @@ else
ip: static-syms.o ip: static-syms.o
static-syms.o: static-syms.h static-syms.o: static-syms.h
@ -30,20 +30,20 @@
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n" "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
" ip [ -force ] -batch filename\n" " ip [ -force ] -batch filename\n"
+#ifndef IPROUTE2_TINY +#ifndef IPROUTE2_TINY
"where OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp | link |\n" "where OBJECT := { address | addrlabel | amt | fou | help | ila | ioam | l2tp |\n"
" macsec | maddress | monitor | mptcp | mroute | mrule |\n" " link | macsec | maddress | monitor | mptcp | mroute | mrule |\n"
" neighbor | neighbour | netconf | netns | nexthop | ntable |\n" " neighbor | neighbour | netconf | netns | nexthop | ntable |\n"
" ntbl | route | rule | sr | tap | tcpmetrics |\n" " ntbl | route | rule | sr | tap | tcpmetrics |\n"
" token | tunnel | tuntap | vrf | xfrm }\n" " token | tunnel | tuntap | vrf | xfrm }\n"
+#else +#else
+ "where OBJECT := { address | ila | link | macsec | maddress | monitor |\n" + "where OBJECT := { address | link | maddress | monitor |\n"
+ " mroute | mrule | neighbor | neighbour | netns | route |\n" + " neighbor | neighbour | netns | route |\n"
+ " rule | sr | token | tunnel | vrf }\n" + " rule | token | tunnel }\n"
+#endif +#endif
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
" -h[uman-readable] | -iec | -j[son] | -p[retty] |\n" " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"
" -f[amily] { inet | inet6 | mpls | bridge | link } |\n" " -f[amily] { inet | inet6 | mpls | bridge | link } |\n"
@@ -91,37 +97,51 @@ static const struct cmd { @@ -91,37 +97,49 @@ static const struct cmd {
int (*func)(int argc, char **argv); int (*func)(int argc, char **argv);
} cmds[] = { } cmds[] = {
{ "address", do_ipaddr }, { "address", do_ipaddr },
@ -63,9 +63,9 @@
+#ifndef IPROUTE2_TINY +#ifndef IPROUTE2_TINY
{ "l2tp", do_ipl2tp }, { "l2tp", do_ipl2tp },
{ "fou", do_ipfou }, { "fou", do_ipfou },
+#endif
{ "ila", do_ipila }, { "ila", do_ipila },
{ "macsec", do_ipmacsec }, { "macsec", do_ipmacsec },
+#endif
{ "tunnel", do_iptunnel }, { "tunnel", do_iptunnel },
{ "tunl", do_iptunnel }, { "tunl", do_iptunnel },
+#ifndef IPROUTE2_TINY +#ifndef IPROUTE2_TINY
@ -78,23 +78,21 @@
{ "monitor", do_ipmonitor }, { "monitor", do_ipmonitor },
+#ifndef IPROUTE2_TINY +#ifndef IPROUTE2_TINY
{ "xfrm", do_xfrm }, { "xfrm", do_xfrm },
+#endif
{ "mroute", do_multiroute }, { "mroute", do_multiroute },
{ "mrule", do_multirule }, { "mrule", do_multirule },
+#endif
{ "netns", do_netns }, { "netns", do_netns },
+#ifndef IPROUTE2_TINY +#ifndef IPROUTE2_TINY
{ "netconf", do_ipnetconf }, { "netconf", do_ipnetconf },
+#endif
{ "vrf", do_ipvrf}, { "vrf", do_ipvrf},
{ "sr", do_seg6 }, { "sr", do_seg6 },
+#ifndef IPROUTE2_TINY
{ "nexthop", do_ipnh }, { "nexthop", do_ipnh },
{ "mptcp", do_mptcp }, { "mptcp", do_mptcp },
{ "ioam", do_ioam6 }, { "ioam", do_ioam6 },
+#endif +#endif
{ "help", do_help }, { "help", do_help },
{ "stats", do_ipstats },
{ 0 } { 0 }
};
--- a/lib/Makefile --- a/lib/Makefile
+++ b/lib/Makefile +++ b/lib/Makefile
@@ -3,6 +3,10 @@ include ../config.mk @@ -3,6 +3,10 @@ include ../config.mk

View File

@ -31,7 +31,7 @@ Subject: [PATCH] add support for dropping with FAILED_POLICY
if (!end || end == arg || *end || res > 255) if (!end || end == arg || *end || res > 255)
--- a/include/uapi/linux/rtnetlink.h --- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h
@@ -256,6 +256,7 @@ enum { @@ -265,6 +265,7 @@ enum {
RTN_THROW, /* Not in this table */ RTN_THROW, /* Not in this table */
RTN_NAT, /* Translate this address */ RTN_NAT, /* Translate this address */
RTN_XRESOLVE, /* Use external resolver */ RTN_XRESOLVE, /* Use external resolver */

View File

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -279,7 +279,7 @@ int main(int argc, char **argv) { @@ -290,7 +290,7 @@ int main(int argc, char **argv) {
} }
EOF EOF
@ -9,7 +9,7 @@
local ret=$? local ret=$?
rm -f $TMPDIR/libbpf_test.c $TMPDIR/libbpf_test rm -f $TMPDIR/libbpf_test.c $TMPDIR/libbpf_test
@@ -297,7 +297,7 @@ int main(int argc, char **argv) { @@ -308,7 +308,7 @@ int main(int argc, char **argv) {
} }
EOF EOF

View File

@ -1,9 +1,9 @@
--- a/ip/Makefile --- a/ip/Makefile
+++ b/ip/Makefile +++ b/ip/Makefile
@@ -26,7 +26,7 @@ STATIC_SYM_SOURCES:=$(filter-out $(STATI @@ -28,7 +28,7 @@ STATIC_SYM_SOURCES:=$(filter-out $(STATI
ALLOBJ=$(IPOBJ) $(RTMONOBJ) ALLOBJ=$(IPOBJ) $(RTMONOBJ)
SCRIPTS=ifcfg rtpr routel routef SCRIPTS=routel
-TARGETS=ip rtmon -TARGETS=ip rtmon
+TARGETS=$(findstring ip,$(BUILD_VARIANT)) rtmon +TARGETS=$(findstring ip,$(BUILD_VARIANT)) rtmon

View File

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -431,14 +431,8 @@ EOF @@ -455,14 +455,8 @@ EOF
if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
echo "no" echo "no"
else else

View File

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -374,7 +374,7 @@ check_libbpf() @@ -385,7 +385,7 @@ check_libbpf()
check_selinux() check_selinux()
# SELinux is a compile time option in the ss utility # SELinux is a compile time option in the ss utility
{ {