aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/iproute2
diff options
context:
space:
mode:
authorTony Ambardar <itugrok@yahoo.com>2018-12-15 18:26:48 -0800
committerHans Dedecker <dedeckeh@gmail.com>2019-03-14 22:54:50 +0100
commitf61359e16ef911a8fc01e7028942d9cad0bd8a96 (patch)
tree5b057ce88b83adeaf85823598f99877798d2bc5b /package/network/utils/iproute2
parent127d38f219962e070483cfeeb9df4811a9df076e (diff)
downloadupstream-f61359e16ef911a8fc01e7028942d9cad0bd8a96.tar.gz
upstream-f61359e16ef911a8fc01e7028942d9cad0bd8a96.tar.bz2
upstream-f61359e16ef911a8fc01e7028942d9cad0bd8a96.zip
iproute2: support eBFP/XDP object file loading, simplify linking libelf
Add build and runtime dependencies on libelf, allowing tc and ip-full to load BPF and XDP object files respectively. Define package 'tc' as a singleton package variant, which can be used to enable additional functionality limited only to tc. Also set ip-tiny as the default 'ip' variant. Preserve optionality of libelf by having configuration script follow the HAVE_ELF environment variable, used similarly to the HAVE_MNL variable. Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Diffstat (limited to 'package/network/utils/iproute2')
-rw-r--r--package/network/utils/iproute2/Makefile26
-rw-r--r--package/network/utils/iproute2/patches/145-keep_libelf_optional.patch11
-rw-r--r--package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch60
3 files changed, 30 insertions, 67 deletions
diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile
index e7fa6e479d..59b25404b9 100644
--- a/package/network/utils/iproute2/Makefile
+++ b/package/network/utils/iproute2/Makefile
@@ -37,6 +37,7 @@ define Package/ip-tiny
$(call Package/iproute2/Default)
TITLE:=Routing control utility (Minimal)
VARIANT:=tiny
+ DEFAULT_VARIANT:=1
PROVIDES:=ip
ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
@@ -48,55 +49,65 @@ $(call Package/iproute2/Default)
VARIANT:=full
PROVIDES:=ip
ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
- DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+ DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
endef
define Package/tc
$(call Package/iproute2/Default)
TITLE:=Traffic control utility
+ VARIANT:=tc
+ PROVIDES:=tc
DEPENDS:=+kmod-sched-core +libxtables +libelf +(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
+ DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
endef
define Package/ip-bridge
$(call Package/iproute2/Default)
TITLE:=Bridge configuration utility from iproute2
- DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+ DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
endef
define Package/ss
$(call Package/iproute2/Default)
TITLE:=Socket statistics utility
- DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+ DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
endef
define Package/nstat
$(call Package/iproute2/Default)
TITLE:=Network statistics utility
- DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+ DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
endef
define Package/devlink
$(call Package/iproute2/Default)
TITLE:=Network devlink utility
- DEPENDS:=+libmnl
+ DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
endef
define Package/rdma
$(call Package/iproute2/Default)
TITLE:=Network rdma utility
- DEPENDS:=+libmnl
+ DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf
endef
ifeq ($(BUILD_VARIANT),tiny)
IP_CONFIG_TINY:=y
endif
+ifeq ($(BUILD_VARIANT),full)
+ HAVE_ELF:=y
+endif
+
+ifeq ($(BUILD_VARIANT),tc)
+ HAVE_ELF:=y
+endif
+
ifdef CONFIG_PACKAGE_devlink
HAVE_MNL:=y
endif
@@ -118,6 +129,7 @@ MAKE_FLAGS += \
KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
SHARED_LIBS="" \
IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
+ HAVE_ELF=$(HAVE_ELF) \
HAVE_MNL=$(HAVE_MNL) \
IPT_LIB_DIR=/usr/lib/iptables \
XT_LIB_DIR=/usr/lib/iptables \
diff --git a/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch
new file mode 100644
index 0000000000..2e3ad18809
--- /dev/null
+++ b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -228,7 +228,7 @@ EOF
+
+ check_elf()
+ {
+- if ${PKG_CONFIG} libelf --exists; then
++ if [ "${HAVE_ELF}" = "y" ] && ${PKG_CONFIG} libelf --exists; then
+ echo "HAVE_ELF:=y" >>$CONFIG
+ echo "yes"
+
diff --git a/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch b/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch
deleted file mode 100644
index 31aacffba8..0000000000
--- a/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch
+++ /dev/null
@@ -1,60 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -231,8 +231,9 @@ check_elf()
- echo "HAVE_ELF:=y" >>$CONFIG
- echo "yes"
-
-- echo 'CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
-- echo 'LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
-+ echo 'CFLAGS += -DHAVE_ELF' >> $CONFIG
-+ echo 'ELF_CFLAGS += ' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
-+ echo 'ELF_LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
- else
- echo "no"
- fi
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -11,9 +11,17 @@ UTILOBJ = utils.o rt_names.o ll_map.o ll
- inet_proto.o namespace.o json_writer.o json_print.o \
- names.o color.o bpf.o exec.o fs.o
-
-+ELFOBJ=$(patsubst %.o,%.elf.o,$(UTILOBJ))
-+
- NLOBJ=libgenl.o libnetlink.o
-
--all: libnetlink.a libutil.a
-+all: libnetlink.a libutil.a libutil-elf.a
-+
-+%.o: %.c
-+ $(QUIET_CC)$(CC) $(CFLAGS) -UHAVE_ELF $(EXTRA_CFLAGS) -c -o $@ $<
-+
-+%.elf.o: %.c
-+ $(QUIET_CC)$(CC) $(CFLAGS) $(ELF_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
-
- libnetlink.a: $(NLOBJ)
- $(QUIET_AR)$(AR) rcs $@ $^
-@@ -21,7 +29,10 @@ libnetlink.a: $(NLOBJ)
- libutil.a: $(UTILOBJ) $(ADDLIB)
- $(QUIET_AR)$(AR) rcs $@ $^
-
-+libutil-elf.a: $(ELFOBJ) $(ADDLIB)
-+ $(QUIET_AR)$(AR) rcs $@ $^
-+
- install:
-
- clean:
-- rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a
-+ rm -f $(NLOBJ) $(UTILOBJ) $(ELFOBJ) $(ADDLIB) libnetlink.a libutil.a libutil-elf.a
---- a/tc/Makefile
-+++ b/tc/Makefile
-@@ -133,8 +133,8 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
-
- all: tc $(TCSO)
-
--tc: $(TCOBJ) $(LIBNETLINK) libtc.a
-- $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
-+tc: $(TCOBJ) $(subst libutil.a,libutil-elf.a,$(LIBNETLINK)) libtc.a
-+ $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) $(ELF_LDLIBS) -o $@
-
- libtc.a: $(TCLIB)
- $(QUIET_AR)$(AR) rcs $@ $^