]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
lib: fix extended ack with and without libmnl
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 7 Aug 2017 18:43:21 +0000 (11:43 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 7 Aug 2017 19:01:49 +0000 (12:01 -0700)
The code was always building without libmnl support, so it was
doing nothing.

Fixes: b6432e68ac2f ("iproute: Add support for extended ack to rtnl_talk")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Makefile
lib/Makefile
lib/libnetlink.c
misc/Makefile

index 18de7dcb315b163f9a27ccbe0741818a1d5e70a6..a4b0dea58fd81709534c2fb33fc687a0ffea54ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -58,8 +58,13 @@ LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
 LDLIBS += $(LIBNETLINK)
 
 ifeq ($(HAVE_ELF),y)
-CFLAGS += -DHAVE_ELF
-LDLIBS += -lelf
+       CFLAGS += -DHAVE_ELF
+       LDLIBS += -lelf
+endif
+
+ifeq ($(HAVE_MNL),y)
+       CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags)
+       LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs)
 endif
 
 all: Config
index f81888cca974f1cd28890d15e51409f5dfe433d1..1d24ca24b9a39fcd5705273f6cf72e482a23796d 100644 (file)
@@ -4,13 +4,6 @@ ifeq ($(IP_CONFIG_SETNS),y)
        CFLAGS += -DHAVE_SETNS
 endif
 
-ifeq ($(HAVE_MNL),y)
-       CFLAGS += $(shell $(PKG_CONFIG) libmnl --cflags)
-       LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs)
-else
-@warn "libmnl required for error support"
-endif
-
 CFLAGS += -fPIC
 
 UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \
index 41353b7dbb3152298b94c6a6968f3a54a1202c0d..145de2cb0ccfe3dc7d93ba4ff4e9a9d40e77c5e7 100644 (file)
@@ -102,6 +102,8 @@ static int nl_dump_ext_err(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn)
        return errfn(errmsg, off, err_nlh);
 }
 #else
+#warning "libmnl required for error support"
+
 /* No extended error ack without libmnl */
 static int nl_dump_ext_err(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn)
 {
index 72807678054b6e6ab2b353a9507972b6a66f3b54..814a72fcb0745e07c9644216cf988504e0ce6814 100644 (file)
@@ -24,16 +24,16 @@ ss: $(SSOBJ)
        $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
 
 nstat: nstat.c
-       $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o nstat nstat.c $(LIBNETLINK) -lm
+       $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o nstat nstat.c $(LDLIBS) -lm
 
 ifstat: ifstat.c
-       $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o ifstat ifstat.c $(LIBNETLINK) -lm
+       $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o ifstat ifstat.c $(LDLIBS) -lm
 
 rtacct: rtacct.c
-       $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o rtacct rtacct.c $(LIBNETLINK) -lm
+       $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o rtacct rtacct.c $(LDLIBS) -lm
 
 arpd: arpd.c
-       $(QUIET_CC)$(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(LDFLAGS) -o arpd arpd.c $(LIBNETLINK) -ldb -lpthread
+       $(QUIET_CC)$(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(LDFLAGS) -o arpd arpd.c $(LDLIBS) -ldb -lpthread
 
 ssfilter.c: ssfilter.y
        $(QUIET_YACC)bison ssfilter.y -o ssfilter.c