iproute2: update to 6.9.0

Support for iptables action has been dropped. Remove tc-mod-iptables and related
patch (175-reduce-dynamic-syms.patch).

We also add the missing libbpf dependency for `ss` since iproute 8740ca9
("ss: add support for BPF socket-local storage") now means that `ss` requires
libbpf as well.

Fix 170-ip_tiny.patch, as the help text didn't match all the included functions.

Drop upstreamed patches 402-bpf-fix-warning-from-basename.patch
and 403-bpf-include-libgen.h-for-basename.patch.

All other patches automatically rebased.

Co-authored-by: Rany Hany <rany_hany@riseup.net>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Rany Hany <rany_hany@riseup.net>
This commit is contained in:
Rui Salvaterra 2024-05-25 15:30:25 +00:00 committed by Hauke Mehrtens
parent b2e0775bc6
commit 2ae1330a22
15 changed files with 21 additions and 142 deletions

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2
PKG_VERSION:=6.7.0
PKG_VERSION:=6.9.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
PKG_HASH:=ff942dd9828d7d1f867f61fe72ce433078c31e5d8e4a78e20f02cb5892e8841d
PKG_HASH:=2f643d09ea11a4a2a043c92e2b469b5f73228cbf241ae806760296ed0ec413d0
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=iptables
PKG_LICENSE:=GPL-2.0
@ -77,14 +77,7 @@ $(call Package/iproute2/Default)
VARIANT:=tcfull
PROVIDES:=tc
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
VARIANT:=tcfull
DEPENDS:=+libxtables +libbpf
DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf +libxtables
endef
define Package/genl
@ -102,7 +95,7 @@ endef
define Package/ss
$(call Package/iproute2/Default)
TITLE:=Socket statistics utility
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +kmod-netlink-diag
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf +kmod-netlink-diag
endef
define Package/nstat
@ -232,11 +225,6 @@ define Package/tc-full/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-full
endef
define Package/tc-mod-iptables/install
$(INSTALL_DIR) $(1)/usr/lib/tc
$(CP) $(PKG_BUILD_DIR)/tc/m_xt.so $(1)/usr/lib/tc
endef
define Package/genl/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
@ -269,9 +257,6 @@ endef
$(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-bpf))
$(eval $(call BuildPackage,tc-full))

View File

@ -1,6 +1,6 @@
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -119,6 +119,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR
@@ -107,6 +107,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR
ifneq ($(IPT_LIB_DIR),)
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
endif

View File

@ -1,6 +1,6 @@
--- a/Makefile
+++ b/Makefile
@@ -68,9 +68,9 @@ WFLAGS += -Wmissing-declarations -Wold-s
@@ -69,9 +69,9 @@ WFLAGS += -Wmissing-declarations -Wold-s
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
YACCFLAGS = -d -t -v

View File

@ -1,6 +1,6 @@
--- a/configure
+++ b/configure
@@ -391,7 +391,7 @@ check_tirpc()
@@ -362,7 +362,7 @@ check_tirpc()
check_mnl()
{

View File

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

View File

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

View File

@ -1,6 +1,6 @@
--- a/configure
+++ b/configure
@@ -378,7 +378,7 @@ check_selinux()
@@ -349,7 +349,7 @@ check_selinux()
check_tirpc()
{

View File

@ -30,15 +30,15 @@
"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"
"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"
" ntbl | route | rule | sr | stats | tap | tcpmetrics |\n"
" token | tunnel | tuntap | vrf | xfrm }\n"
+#else
+ "where OBJECT := { address | link | maddress | monitor |\n"
+ "where OBJECT := { address | help | link | maddress | monitor |\n"
+ " neighbor | neighbour | netns | route |\n"
+ " rule | token | tunnel }\n"
+ " rule | stats | token | tunnel }\n"
+#endif
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
" -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"

View File

@ -1,45 +0,0 @@
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -106,7 +106,7 @@ LDLIBS += -L. -lm
ifeq ($(SHARED_LIBS),y)
LDLIBS += -ldl
-LDFLAGS += -Wl,-export-dynamic
+LDFLAGS += -Wl,--dynamic-list=dynsyms.list
endif
TCLIB := tc_core.o
@@ -135,7 +135,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
all: tc $(TCSO)
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
- $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
+ $(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@
libtc.a: $(TCLIB)
$(QUIET_AR)$(AR) rcs $@ $^
@@ -157,6 +157,7 @@ install: all
clean:
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
rm -f emp_ematch.tab.*
+ rm -f dynsyms.list
m_xt.so: m_xt.c
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c $$($(PKG_CONFIG) xtables --cflags --libs)
@@ -193,4 +194,16 @@ static-syms.h: $(wildcard *.c)
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
done > $@
+else
+
+tc: dynsyms.list
+m_xt.so: dynsyms.list
+dynsyms.list: $(wildcard *.c)
+ files="$(filter-out $(patsubst %.so,%.c,$(TCSO)), $^)" ; \
+ echo "{" > $@ ; \
+ for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
+ sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:\1;:;p}' $$files ; \
+ done >> $@ ; \
+ echo "show_stats; print_nl; print_tm; parse_rtattr; parse_rtattr_flags; get_u32; matches; addattr_l; addattr_nest; addattr_nest_end; };" >> $@
+
endif

View File

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

View File

@ -11,7 +11,7 @@
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -132,7 +132,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
@@ -120,7 +120,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
@ -19,4 +19,4 @@
+all: $(findstring tc,$(BUILD_VARIANT)) $(TCSO)
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
$(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@

View File

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

View File

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

View File

@ -1,38 +0,0 @@
From 69e3b2fadcd32683db2942f31fe41f0fbb2185f8 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Sat, 27 Jan 2024 13:58:14 -0800
Subject: [PATCH] bpf: fix warning from basename()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function basename() expects a mutable character string,
which now causes a warning:
bpf_legacy.c: In function bpf_load_common:
bpf_legacy.c:975:38: warning: passing argument 1 of __xpg_basename discards const qualifier from pointer target type [-Wdiscarded-qualifiers]
975 | basename(cfg->object), cfg->mode == EBPF_PINNED ?
| ~~~^~~~~~~~
In file included from bpf_legacy.c:21:
/usr/include/libgen.h:34:36: note: expected char * but argument is of type const char *
34 | extern char *__xpg_basename (char *__path) __THROW;
Fixes: f20ff2f19552 ("bpf: keep parsed program mode in struct bpf_cfg_in")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/bpf_legacy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/lib/bpf_legacy.c
+++ b/lib/bpf_legacy.c
@@ -971,8 +971,8 @@ int bpf_load_common(struct bpf_cfg_in *c
ops->cbpf_cb(nl, cfg->opcodes, cfg->n_opcodes);
if (cfg->mode == EBPF_OBJECT || cfg->mode == EBPF_PINNED) {
snprintf(annotation, sizeof(annotation), "%s:[%s]",
- basename(cfg->object), cfg->mode == EBPF_PINNED ?
- "*fsobj" : cfg->section);
+ basename(strdupa(cfg->object)),
+ cfg->mode == EBPF_PINNED ? "*fsobj" : cfg->section);
ops->ebpf_cb(nl, cfg->prog_fd, annotation);
}

View File

@ -1,23 +0,0 @@
From 64ed1886e719f40acb554ac895305acb43f27bea Mon Sep 17 00:00:00 2001
From: Pedro Tammela <pctammela@mojatatu.com>
Date: Mon, 22 Jan 2024 18:05:46 -0300
Subject: [PATCH] bpf: include libgen.h for basename
In musl basename() is only available via libgen.h
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/bpf_legacy.c | 1 +
1 file changed, 1 insertion(+)
--- a/lib/bpf_legacy.c
+++ b/lib/bpf_legacy.c
@@ -18,6 +18,7 @@
#include <stdarg.h>
#include <limits.h>
#include <assert.h>
+#include <libgen.h>
#ifdef HAVE_ELF
#include <libelf.h>