mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
0ffc498ddd
The latest iproute2 version brings various improvements and fixes:
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/log/?qt=range&q=v5.10.0..v5.11.0
In particular, ip and tc now use libbpf as the standard way to load BPF
programs, rather than the old, limited custom loader. This allows more
consistent and featureful BPF program handling e.g. support for global
initialized variables.
Also fix a longstanding problem with iproute2 builds where unneeded DSO
dependencies are added to most utilities, bloating their installation
footprint. From research and testing, explicitly using a "--as-needed"
linker flag avoids the issue. Update accordingly and drop extra package
dependencies from Makefile.
Additional build and packaging updates include:
- install missing development header to iproute2/bpf_elf.h
- propagate OpenWrt verbose flag during build
- update and refresh patches
Compile and run tested: QEMU/malta-mips32be on kernels 5.4 & 5.10.
All iproute2 packages were built and installed to the test image. Some
regression testing using ip-full and tc was successfully performed to
exercise several kmods, tc modules, and simple BPF programs.
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
(cherry picked from commit b048a305a3
)
109 lines
3.3 KiB
Diff
109 lines
3.3 KiB
Diff
--- 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,10 +64,16 @@ static void usage(void)
|
|
fprintf(stderr,
|
|
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
|
" ip [ -force ] -batch filename\n"
|
|
+#ifndef IPROUTE2_TINY
|
|
"where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |\n"
|
|
" tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n"
|
|
" netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |\n"
|
|
" vrf | sr | nexthop | mptcp }\n"
|
|
+#else
|
|
+ "where OBJECT := { link | address | route | rule | neigh | tunnel | maddress |\n"
|
|
+ " mroute | mrule | monitor | netns | macsec | token | ila |\n"
|
|
+ " vrf | sr }\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"
|
|
@@ -90,36 +96,50 @@ 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 },
|
|
+#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
|