iproute2: update to 5.11.0
authorTony Ambardar <itugrok@yahoo.com>
Sat, 20 Feb 2021 16:56:20 +0000 (08:56 -0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 28 Feb 2021 23:34:23 +0000 (00:34 +0100)
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>
package/network/utils/iproute2/Makefile
package/network/utils/iproute2/patches/100-configure.patch
package/network/utils/iproute2/patches/130-no_netem.patch
package/network/utils/iproute2/patches/140-allow_pfifo_fast.patch
package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch
package/network/utils/iproute2/patches/145-keep_libelf_optional.patch
package/network/utils/iproute2/patches/150-keep_libcap_optional.patch
package/network/utils/iproute2/patches/160-libnetlink-pic.patch
package/network/utils/iproute2/patches/170-ip_tiny.patch
package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch
package/network/utils/iproute2/patches/300-selinux-configurable.patch

index a20916f6caf28be1fdafe44017359bded5b86861..440e33069bccd1ea1bc613b7b8e02caa61e61907 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iproute2
-PKG_VERSION:=5.10.0
+PKG_VERSION:=5.11.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
-PKG_HASH:=a54a34ae309c0406b2d1fb3a46158613ffb83d33fefd5d4a27f0010237ac53e9
+PKG_HASH:=c5e2ea108212b3445051b35953ec267f9f3469e1d5c67ac034ab559849505c54
 PKG_BUILD_PARALLEL:=1
 PKG_BUILD_DEPENDS:=iptables
 PKG_LICENSE:=GPL-2.0
@@ -47,7 +47,7 @@ $(call Package/iproute2/Default)
  VARIANT:=full
  PROVIDES:=ip
  ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
- DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+ DEPENDS:=+libnl-tiny +libbpf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
 endef
 
 define Package/tc
@@ -55,56 +55,59 @@ $(call Package/iproute2/Default)
   TITLE:=Traffic control utility
   VARIANT:=tc
   PROVIDES:=tc
-  DEPENDS:=+kmod-sched-core +libxtables +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+  DEPENDS:=+kmod-sched-core +libxtables +libbpf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
 endef
 
 define Package/genl
 $(call Package/iproute2/Default)
   TITLE:=General netlink utility frontend
-  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
+  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
 endef
 
 define Package/ip-bridge
 $(call Package/iproute2/Default)
   TITLE:=Bridge configuration utility from iproute2
-  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
+  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
 endef
 
 define Package/ss
 $(call Package/iproute2/Default)
   TITLE:=Socket statistics utility
-  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +kmod-netlink-diag
+  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +kmod-netlink-diag
 endef
 
 define Package/nstat
 $(call Package/iproute2/Default)
   TITLE:=Network statistics utility
-  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
+  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
 endef
 
 define Package/devlink
 $(call Package/iproute2/Default)
   TITLE:=Network devlink utility
-  DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
+  DEPENDS:=+libmnl
 endef
 
 define Package/rdma
 $(call Package/iproute2/Default)
   TITLE:=Network rdma utility
-  DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
+  DEPENDS:=+libmnl
 endef
 
 ifeq ($(BUILD_VARIANT),tiny)
   IP_CONFIG_TINY:=y
+  LIBBPF_FORCE:=off
 endif
 
 ifeq ($(BUILD_VARIANT),full)
   HAVE_ELF:=y
+  LIBBPF_FORCE:=on
   HAVE_CAP:=n
 endif
 
 ifeq ($(BUILD_VARIANT),tc)
   HAVE_ELF:=y
+  LIBBPF_FORCE:=on
   SHARED_LIBS:=y
 endif
 
@@ -122,26 +125,29 @@ define Build/Configure
 endef
 
 TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
-TARGET_LDFLAGS += -Wl,--gc-sections
+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" \
        SHARED_LIBS=$(SHARED_LIBS) \
        IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
+       LIBBPF_FORCE=$(LIBBPF_FORCE) \
        HAVE_ELF=$(HAVE_ELF) \
        HAVE_MNL=$(HAVE_MNL) \
        HAVE_CAP=$(HAVE_CAP) \
        IPT_LIB_DIR=/usr/lib/iptables \
        XT_LIB_DIR=/usr/lib/iptables \
-       FPIC="$(FPIC)"
+       FPIC="$(FPIC)" \
+       $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
 
 define Build/Compile
        +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
 endef
 
 define Build/InstallDev
-       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/include/iproute2
+       $(CP) $(PKG_BUILD_DIR)/include/bpf_elf.h $(1)/usr/include/iproute2
        $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
index 0c19b2086a95bce170e56cf199a8c5fa5e86082f..f70b7199b66a4042dff3750f08eb17110065be7e 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -34,7 +34,8 @@ int main(int argc, char **argv) {
+@@ -39,7 +39,8 @@ int main(int argc, char **argv) {
  }
  EOF
  
index aa93366f29689bb75f0bd4bb4f149bcbbfa9661a..7d2fa03945e100a4d9f77d67ea1f57199aab27e6 100644 (file)
@@ -4,8 +4,8 @@
  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 man
-+SUBDIRS=lib ip tc bridge misc genl tipc devlink rdma man
+-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man
++SUBDIRS=lib ip tc bridge misc genl tipc devlink rdma dcb man
  
  LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
  LDLIBS += $(LIBNETLINK)
index bb898a40d6ae6e1314fdd6dd11972f728be55da3..13de48f412872cae661b244e9606c6623e53f5db 100644 (file)
@@ -1,6 +1,6 @@
 --- a/tc/q_fifo.c
 +++ b/tc/q_fifo.c
-@@ -99,5 +99,6 @@ struct qdisc_util pfifo_head_drop_qdisc_
+@@ -95,5 +95,6 @@ struct qdisc_util pfifo_head_drop_qdisc_
  
  struct qdisc_util pfifo_fast_qdisc_util = {
        .id = "pfifo_fast",
index 20cd0766a19c2024564d5f7ed8e2c3663be2028d..a11a2a3fab2025ea416ce81add651abebbd0d166 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -257,7 +257,7 @@ check_selinux()
+@@ -367,7 +367,7 @@ check_selinux()
  
  check_mnl()
  {
index d25c719f8e2a3a98e8a8c4f1e6353a5a00c7a35d..c780022d1ad48b3a829258ddbe9340b5fc193de4 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -230,7 +230,7 @@ EOF
+@@ -235,7 +235,7 @@ EOF
  
  check_elf()
  {
index d15549e3d2a5078e28c68ef9ea6a0b90162b7aa1..8cd4e4ae6aa8e3d35c5bd8f22f65c9dba8ff0e14 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -315,7 +315,7 @@ EOF
+@@ -425,7 +425,7 @@ EOF
  
  check_cap()
  {
index aad87a1e4f42b2ec203abec5dd915cbff78a0260..145ec7a9ea76468560eb88bde5003fc5fc1b322d 100644 (file)
@@ -7,5 +7,5 @@
 -CFLAGS += -fPIC
 +CFLAGS += $(FPIC)
  
- UTILOBJ = utils.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 \
+ 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 \
index c9b28dfe7727859fb4d4ce7d0b8f65761a1139d1..d5e5b36936eb05a1486d25792b9efdb856dc8fa9 100644 (file)
@@ -25,7 +25,7 @@
                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
-@@ -48,10 +48,16 @@ static void usage(void)
+@@ -64,10 +64,16 @@ static void usage(void)
        fprintf(stderr,
                "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
                "       ip [ -force ] -batch filename\n"
@@ -42,7 +42,7 @@
                "       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"
-@@ -74,36 +80,50 @@ static const struct cmd {
+@@ -90,36 +96,50 @@ static const struct cmd {
        int (*func)(int argc, char **argv);
  } cmds[] = {
        { "address",    do_ipaddr },
 +  CFLAGS += -DIPROUTE2_TINY
 +endif
 +
- UTILOBJ = utils.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 \
-       names.o color.o bpf.o exec.o fs.o cg_map.o
+ 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
index 0d3cbe8dfb3c5cdbfd57f4d547b5c682873d1d98..bf335e0800986be269d3cb4b79b07a21ce68b09c 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -301,14 +301,8 @@ EOF
+@@ -411,14 +411,8 @@ EOF
      if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
        echo "no"
      else
index 4cda30f97827a6c693d9eab8ba9c33a276207bcc..33c5279aec9f194c1fbed07008973c852ef489c2 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -244,7 +244,7 @@ check_elf()
+@@ -354,7 +354,7 @@ check_libbpf()
  check_selinux()
  # SELinux is a compile time option in the ss utility
  {