Subject: Re: [RFC] iproute: Add support for extended ack to rtnl_talk

From: David Ahern <[email-masked]>
Date: Mon, 7 Aug 2017 10:48:23 -0600

On 8/4/17 10:47 AM, Stephen Hemminger wrote:
> I will put in the libmnl version. If it doesn't work because no one sent
> me test cases, then fine. send a patch for that.

This commit:

commit b6432e68ac2f1f6b4ea50aa0d6d47e72c445c71c
Author: Stephen Hemminger <[email-masked]>
Date:   Fri Aug 4 09:52:15 2017 -0700

    iproute: Add support for extended ack to rtnl_talk

Does not work. Seems like you pushed the RFC commit which was known to
be incomplete.

First, the Config is HAVE_MNL not HAVE_LIBMNL which is in lib/libnetlink.c.

Second, changing that to HAVE_MNL does not work -- something is not
getting passed in correctly. Just remove the semicolon on the else path:

+#else
+/* No extended error ack without libmnl */
+static int nl_dump_ext_err(const struct nlmsghdr *nlh, nl_ext_ack_fn_t
errfn)
+{
+       return 0;
+}
+#endif

and you will see that HAVE_MNL is never defined.

Third, force that path to build and you get:

ip
    LINK     ip
../lib/libnetlink.a(libnetlink.o): In function `err_attr_cb':
libnetlink.c:(.text+0x10): undefined reference to `mnl_attr_type_valid'
libnetlink.c:(.text+0x1c): undefined reference to `mnl_attr_get_type'
libnetlink.c:(.text+0x34): undefined reference to `mnl_attr_validate'
../lib/libnetlink.a(libnetlink.o): In function `__rtnl_talk':
libnetlink.c:(.text+0x408): undefined reference to `mnl_nlmsg_get_payload'
libnetlink.c:(.text+0x42c): undefined reference to
`mnl_nlmsg_get_payload_len'
libnetlink.c:(.text+0x445): undefined reference to `mnl_attr_parse'
libnetlink.c:(.text+0x454): undefined reference to `mnl_attr_get_str'
libnetlink.c:(.text+0x46a): undefined reference to `mnl_attr_get_u32'
collect2: error: ld returned 1 exit status
Makefile:29: recipe for target 'ip' failed
make[1]: *** [ip] Error 1
Makefile:66: recipe for target 'all' failed
make: *** [all] Error 2

as I mentioned in a past response the libmnl dependency can not be
placed on libutil.a -- because it is an archive. That means each and
every command that uses libutil.a needs to inherit the libmnl dependency.