Skip to contentSkip to conversation

iproute: Add support for extended ack to rtnl_talk

RFC In review Stephen Hemminger 9 participants 27 messages May 3, 2017 – Aug 7, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 iproute: Add support for extended ack to rtnl_talk

Add support for extended ack error reporting via libmnl. This is a better alternative to use existing library and not copy/paste code from the kernel. Also make arguments const where possible.

Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel.

Adding a new function allows commands to be moved over to the extended error reporting over time.

For feedback, compile tested only.

---
 include/libnetlink.h |   6 +++
 lib/Makefile         |   7 ++++
 lib/libnetlink.c     | 110 +++++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 116 insertions(+), 7 deletions(-)
include/libnetlink.h +6 -0
index c43ab0a2d9d9..32d5177cd1ab 100644
@@ -66,6 +66,9 @@ typedef int (*rtnl_listen_filter_t)(const struct sockaddr_nl *,
 				    struct rtnl_ctrl_data *,
 				    struct nlmsghdr *n, void *);
 
+typedef int (*nl_ext_ack_fn_t)(const char *errmsg, uint32_t off,
+			       const struct nlmsghdr *inner_nlh);
+
 struct rtnl_dump_filter_arg {
 	rtnl_filter_t filter;
 	void *arg1;
@@ -82,6 +85,9 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth,
 int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
 	      struct nlmsghdr *answer, size_t len)
 	__attribute__((warn_unused_result));
+int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n,
+	      struct nlmsghdr *answer, size_t len, nl_ext_ack_fn_t errfn)
+	__attribute__((warn_unused_result));
 int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n,
 				   struct nlmsghdr *answer, size_t len)
 	__attribute__((warn_unused_result));
lib/Makefile +7 -0
index 1d24ca24b9a3..f81888cca974 100644
@@ -4,6 +4,13 @@ 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 \
lib/libnetlink.c +103 -7

153 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw
Quoted 9 lines · Stephen Hemminger

Add support for extended ack error reporting via libmnl. This is a better alternative to use existing library and not copy/paste code from the kernel. Also make arguments const where possible.

Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel.

Quoted 4 lines

Adding a new function allows commands to be moved over to the extended error reporting over time.

For feedback, compile tested only.

Just out of curiosity, what is the plan regarding converting iproute2 over to libmnl (ip, tc, ss, ...)? In 2015, tipc tool was the first user merged that requires libmnl, the only other user today in the tree is devlink, which even seems to define its own libmnl library helpers. What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

I don't really like that we make extended ack reporting now dependent on libmnl, which further diverts from iproute's native nl library vs requiring to install another nl library, making the current status quo even worse ... :/

Thanks,
Daniel

#2 lore raw
Quoted 3 lines · Daniel Borkmann

What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

+1

maintainer
#3 lore raw

From: David Ahern <[email protected]>
Date: Thu, 4 May 2017 08:27:35 -0600

Quoted 6 lines · Daniel Borkmann
Quoted 3 lines

What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

+1

Agreed, all else being equal iproute2 should be as self contained as possible since it is such a fundamental tool.

#4 lore raw
Quoted 4 lines · David Miller

From: David Ahern <[email protected]>
Date: Thu, 4 May 2017 08:27:35 -0600

Quoted 1 line · Daniel Borkmann
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

+1

Agreed, all else being equal iproute2 should be as self contained as possible since it is such a fundamental tool.

True, but:->
iproute2 _already_ depends on libmnl;-> (latest user being devlink).

cheers,
jamal

#5 lore raw
In reply to David Miller
Quoted 4 lines · On Thu, 04 May 2017 10:41:03 -0400 (EDT) David Miller <[email protected]>…

From: David Ahern <[email protected]>
Date: Thu, 4 May 2017 08:27:35 -0600

Quoted 1 line · Daniel Borkmann
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

+1

Agreed, all else being equal iproute2 should be as self contained as possible since it is such a fundamental tool.

Sorry, the old netlink code is more difficult to understand than libmnl. Having dependency on a library is not a problem. There already is an alternative implementation of ip commands in busybox for those people trying to work in small environments.

#6 lore raw

Hi,

Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Thu, 04 May 2017 10:41:03 -0400 (EDT) David Miller <[email protected]>…

From: David Ahern <[email protected]>
Date: Thu, 4 May 2017 08:27:35 -0600

Quoted 6 lines · Daniel Borkmann
Quoted 3 lines

What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

+1

Quoted 7 lines
Quoted 2 lines

Agreed, all else being equal iproute2 should be as self contained as possible since it is such a fundamental tool.

Sorry, the old netlink code is more difficult to understand than libmnl. Having dependency on a library is not a problem. There already is an alternative implementation of ip commands in busybox for those people trying to work in small environments.

I second that. If you can't afford the extra ~24KB of libmnl on your system, you much rather can't afford the 20 times bigger ip binary, either.

Regarding conversion to libmnl, which I investigated and started working on once: My gut feeling back then was that it's not quite worth the effor since iproute2 requires an intermediate layer of functions anyway. Another detail which I didn't like that much was libmnl's idiom of creating netlink messages on base of just a plain buffer and using mnl_nlmsg_put_header() et al. to populate it with data. I'm probably a bit biased since I did the conversion to c99-style initializers for the various struct req data types, but I didn't like the added run-time overhead to achieve just the same.

So in summary, given that very little change happens to iproute2's internal libnetlink, I don't see much urge to make it use libmnl as backend. In my opinion it just adds another potential source of errors.

Eventually this should be a maintainer level decision, though. :)

Cheers, Phil

#7 lore raw
Quoted 5 lines · Phil Sutter

So in summary, given that very little change happens to iproute2's internal libnetlink, I don't see much urge to make it use libmnl as backend. In my opinion it just adds another potential source of errors.

Eventually this should be a maintainer level decision, though. :)

What is the decision on this?

#8 lore raw
Quoted 8 lines · On Sat, 13 May 2017 19:29:57 -0600 David Ahern <[email protected]> wrote:
Quoted 5 lines · Phil Sutter

So in summary, given that very little change happens to iproute2's internal libnetlink, I don't see much urge to make it use libmnl as backend. In my opinion it just adds another potential source of errors.

Eventually this should be a maintainer level decision, though. :)

What is the decision on this?

I am waiting for a longer before committing anything. This was to allow for a wider range of distribution maintainer feedback.

The most likely outcome is that for 4.12 is to use libmnl for extended ack. And continue to support building without mnl with loss of functionality.

As far as conversion of all of iproute2 to libmnl. I have better things to do... But for new functionality like extended ack, devlink, tipc, using libmnl is easy, safe and it works well. I will continue to not accept new code that depends on the other library (libnl). That has come up a couple of times.

#9 lore raw
Quoted 15 lines · Stephen Hemminger
Quoted 8 lines · On Sat, 13 May 2017 19:29:57 -0600 David Ahern <[email protected]> wrote:
Quoted 5 lines · Phil Sutter

So in summary, given that very little change happens to iproute2's internal libnetlink, I don't see much urge to make it use libmnl as backend. In my opinion it just adds another potential source of errors.

Eventually this should be a maintainer level decision, though. :)

What is the decision on this?

I am waiting for a longer before committing anything. This was to allow for a wider range of distribution maintainer feedback.

Quoted 8 lines

The most likely outcome is that for 4.12 is to use libmnl for extended ack. And continue to support building without mnl with loss of functionality.

As far as conversion of all of iproute2 to libmnl. I have better things to do... But for new functionality like extended ack, devlink, tipc, using libmnl is easy, safe and it works well. I will continue to not accept new code that depends on the other library (libnl). That has come up a couple of times.

So effectively this means libmnl has to be used for new stuff, noone has time to do the work to convert the existing tooling over (which by itself might be a challenge in testing everything to make sure there are no regressions) given there's not much activity around lib/libnetlink.c anyway, and existing users not using libmnl today won't see/notice new improvements on netlink side when they do an upgrade. So we'll be stuck with that dual library mess pretty much for a very long time. :(

If there's such high desire to use libmnl (?), can't there be a one time effort wrapping the core netlink code over, making a hard cut for everyone where from one release to another the dependency becomes really mandatory rather than optional? That's more work initially, but still seems a lot better than growing a wild mix of both over time where users see different behavior of the tools depending on their setup. (This could perhaps also make actual conversion much harder later on.)

Can't you add that lib conversion as a Google summer of code project, so that someone is actively taking care of that initial work?

#10 lore raw
Quoted 34 lines · On Thu, 18 May 2017 12:02:07 +0200 Daniel Borkmann <[email protected]> wrote:
Quoted 15 lines · Stephen Hemminger
Quoted 8 lines · On Sat, 13 May 2017 19:29:57 -0600 David Ahern <[email protected]> wrote:
Quoted 5 lines · Phil Sutter

So in summary, given that very little change happens to iproute2's internal libnetlink, I don't see much urge to make it use libmnl as backend. In my opinion it just adds another potential source of errors.

Eventually this should be a maintainer level decision, though. :)

What is the decision on this?

I am waiting for a longer before committing anything. This was to allow for a wider range of distribution maintainer feedback.

Quoted 8 lines

The most likely outcome is that for 4.12 is to use libmnl for extended ack. And continue to support building without mnl with loss of functionality.

As far as conversion of all of iproute2 to libmnl. I have better things to do... But for new functionality like extended ack, devlink, tipc, using libmnl is easy, safe and it works well. I will continue to not accept new code that depends on the other library (libnl). That has come up a couple of times.

So effectively this means libmnl has to be used for new stuff, noone has time to do the work to convert the existing tooling over (which by itself might be a challenge in testing everything to make sure there are no regressions) given there's not much activity around lib/libnetlink.c anyway, and existing users not using libmnl today won't see/notice new improvements on netlink side when they do an upgrade. So we'll be stuck with that dual library mess pretty much for a very long time. :(

Quoted 8 lines

If there's such high desire to use libmnl (?), can't there be a one time effort wrapping the core netlink code over, making a hard cut for everyone where from one release to another the dependency becomes really mandatory rather than optional? That's more work initially, but still seems a lot better than growing a wild mix of both over time where users see different behavior of the tools depending on their setup. (This could perhaps also make actual conversion much harder later on.)

If nothing else it would be simple experiment to do libnetlink to libmnl wrappers in libnetlink.h

Quoted 2 lines

Can't you add that lib conversion as a Google summer of code project, so that someone is actively taking care of that initial work?

Agreed

#11 lore raw
In reply to Daniel Borkmann
Quoted 8 lines · Daniel Borkmann

So effectively this means libmnl has to be used for new stuff, noone has time to do the work to convert the existing tooling over (which by itself might be a challenge in testing everything to make sure there are no regressions) given there's not much activity around lib/libnetlink.c anyway, and existing users not using libmnl today won't see/notice new improvements on netlink side when they do an upgrade. So we'll be stuck with that dual library mess pretty much for a very long time. :(

lib/libnetlink.c with all of its duplicate functions weighs in at just 947 LOC -- a mere 12% of the code in lib/. From a total SLOC of iproute2 it is a negligible part of the code base.

Given that, there is very little gain -- but a lot of risk in regressions -- in converting such a small, low level code base to libmnl just for the sake of using a library - something Phil noted in his cursory attempt at converting ip to libmnl. ie., The level effort required vs the benefit is just not worth it.

There are so many other parts of the ip code base that need work with a much higher return on the time investment.

#12 lore raw
Quoted 14 lines · David Ahern
Quoted 8 lines · Daniel Borkmann

So effectively this means libmnl has to be used for new stuff, noone has time to do the work to convert the existing tooling over (which by itself might be a challenge in testing everything to make sure there are no regressions) given there's not much activity around lib/libnetlink.c anyway, and existing users not using libmnl today won't see/notice new improvements on netlink side when they do an upgrade. So we'll be stuck with that dual library mess pretty much for a very long time. :(

lib/libnetlink.c with all of its duplicate functions weighs in at just 947 LOC -- a mere 12% of the code in lib/. From a total SLOC of iproute2 it is a negligible part of the code base.

Quoted 9 lines

Given that, there is very little gain -- but a lot of risk in regressions -- in converting such a small, low level code base to libmnl just for the sake of using a library - something Phil noted in his cursory attempt at converting ip to libmnl. ie., The level effort required vs the benefit is just not worth it.

There are so many other parts of the ip code base that need work with a much higher return on the time investment.

Stephen: It has been 3 months since the first extack patches were posted and still nothing in iproute2, all of it hung up on your decision to require libmnl. Do you plan to finish the libmnl support any time soon and send out patches?

#13 lore raw
Quoted 21 lines · David Ahern
Quoted 20 lines · David Ahern
Quoted 8 lines · Daniel Borkmann

So effectively this means libmnl has to be used for new stuff, noone has time to do the work to convert the existing tooling over (which by itself might be a challenge in testing everything to make sure there are no regressions) given there's not much activity around lib/libnetlink.c anyway, and existing users not using libmnl today won't see/notice new improvements on netlink side when they do an upgrade. So we'll be stuck with that dual library mess pretty much for a very long time. :(

lib/libnetlink.c with all of its duplicate functions weighs in at just 947 LOC -- a mere 12% of the code in lib/. From a total SLOC of iproute2 it is a negligible part of the code base.

Given that, there is very little gain -- but a lot of risk in regressions -- in converting such a small, low level code base to libmnl just for the sake of using a library - something Phil noted in his cursory attempt at converting ip to libmnl. ie., The level effort required vs the benefit is just not worth it.

Quoted 8 lines
Quoted 3 lines

There are so many other parts of the ip code base that need work with a much higher return on the time investment.

Stephen: It has been 3 months since the first extack patches were posted and still nothing in iproute2, all of it hung up on your decision to require libmnl. Do you plan to finish the libmnl support any time soon and send out patches?

FWIIW I would also like to see some way to get this enhancement accepted.

#14 lore raw
Quoted 26 lines · On Fri, 4 Aug 2017 13:31:48 +0200 Simon Horman <[email protected]>…
Quoted 25 lines · David Ahern
Quoted 23 lines · David Ahern
Quoted 8 lines · Daniel Borkmann

So effectively this means libmnl has to be used for new stuff, noone has time to do the work to convert the existing tooling over (which by itself might be a challenge in testing everything to make sure there are no regressions) given there's not much activity around lib/libnetlink.c anyway, and existing users not using libmnl today won't see/notice new improvements on netlink side when they do an upgrade. So we'll be stuck with that dual library mess pretty much for a very long time. :(

lib/libnetlink.c with all of its duplicate functions weighs in at just 947 LOC -- a mere 12% of the code in lib/. From a total SLOC of iproute2 it is a negligible part of the code base.

Given that, there is very little gain -- but a lot of risk in regressions -- in converting such a small, low level code base to libmnl just for the sake of using a library - something Phil noted in his cursory attempt at converting ip to libmnl. ie., The level effort required vs the benefit is just not worth it.

There are so many other parts of the ip code base that need work with a much higher return on the time investment.

Quoted 6 lines
Quoted 4 lines

Stephen: It has been 3 months since the first extack patches were posted and still nothing in iproute2, all of it hung up on your decision to require libmnl. Do you plan to finish the libmnl support any time soon and send out patches?

FWIIW I would also like to see some way to get this enhancement accepted.

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.

#15 lore raw
Quoted 2 lines · Stephen Hemminger

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 protected]>
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.

#16 lore raw
Quoted 7 lines · On Mon, 7 Aug 2017 10:48:23 -0600 David Ahern <[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger

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

Quoted 8 lines
Author: Stephen Hemminger <[email protected]>
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.

Patches welcome.

Quoted 14 lines

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:

(quoted diff) +3 -0
+#else
+/* No extended error ack without libmnl */
+static int nl_dump_ext_err(const struct nlmsghdr *nlh, nl_ext_ack_fn_t

errfn)

(quoted diff) +4 -0
+{
+       return 0;
+}
+#endif
Quoted 1 line

and you will see that HAVE_MNL is never defined.

Ok, that I will fix.

#17 lore raw
Quoted 4 lines · Stephen Hemminger
Quoted 2 lines

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

Patches welcome.

What exists does not even compile. Patches will be sent once you fix that.

maintainer
#18 lore raw

From: David Ahern <[email protected]>
Date: Mon, 7 Aug 2017 12:09:31 -0600

Quoted 7 lines · Stephen Hemminger
Quoted 4 lines
Quoted 2 lines

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

Patches welcome.

What exists does not even compile. Patches will be sent once you fix that.

Yeah seriously Stephen, you created this huge mess so the onus is really on you to fix it up.

#19 lore raw
Quoted 7 lines · On Mon, 07 Aug 2017 11:45:17 -0700 (PDT) David Miller <[email protected]>…

From: David Ahern <[email protected]>
Date: Mon, 7 Aug 2017 12:09:31 -0600

Quoted 4 lines · Stephen Hemminger
Quoted 3 lines
Quoted 2 lines

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Patches welcome.

What exists does not even compile. Patches will be sent once you fix that.

Yeah seriously Stephen, you created this huge mess so the onus is really on you to fix it up.

It is fixed now.
Dave, I asked for test cases, and received none.

maintainer
#20 lore raw

From: Stephen Hemminger <[email protected]>
Date: Mon, 7 Aug 2017 12:12:35 -0700

Quoted 1 line

Dave, I asked for test cases, and received none.

You don't need a test case to type make and make sure the build succeeds.

#21 lore raw
Quoted 6 lines · On Mon, 07 Aug 2017 13:26:03 -0700 (PDT) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Mon, 7 Aug 2017 12:12:35 -0700

Quoted 1 line

Dave, I asked for test cases, and received none.

You don't need a test case to type make and make sure the build succeeds.

It did succeed for libmnl but was not doing anything.

#22 lore raw
In reply to Daniel Borkmann
Quoted 15 lines · Daniel Borkmann
Quoted 9 lines · Stephen Hemminger

Add support for extended ack error reporting via libmnl. This is a better alternative to use existing library and not copy/paste code from the kernel. Also make arguments const where possible.

Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel.

Quoted 4 lines

Adding a new function allows commands to be moved over to the extended error reporting over time.

For feedback, compile tested only.

Quoted 7 lines

Just out of curiosity, what is the plan regarding converting iproute2 over to libmnl (ip, tc, ss, ...)? In 2015, tipc tool was the first user merged that requires libmnl, the only other user today in the tree is devlink, which even seems to define its own libmnl library helpers. What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

And I would like to get direction for the RDMA tool [1] which I'm working on it now.

The overall decision was to use netlink and put it under iproute2 umbrella. Currently, I have working RFC which is based on legacy sysfs interface to ensure that we are converging on user-experience even before moving to actual netlink defines.

An I would like to continue to work on netlink interface, but which lib interface should I need to base rdmatool's netlink code?

[1] https://www.mail-archive.com/[email protected]/msg148523.html

Quoted 8 lines

I don't really like that we make extended ack reporting now dependent on libmnl, which further diverts from iproute's native nl library vs requiring to install another nl library, making the current status quo even worse ... :/

Thanks,
Daniel

#23 lore raw
Quoted 32 lines · On Thu, 4 May 2017 17:37:38 +0300 Leon Romanovsky <[email protected]> wrote:
Quoted 15 lines · Daniel Borkmann
Quoted 9 lines · Stephen Hemminger

Add support for extended ack error reporting via libmnl. This is a better alternative to use existing library and not copy/paste code from the kernel. Also make arguments const where possible.

Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel.

Quoted 4 lines

Adding a new function allows commands to be moved over to the extended error reporting over time.

For feedback, compile tested only.

Quoted 7 lines

Just out of curiosity, what is the plan regarding converting iproute2 over to libmnl (ip, tc, ss, ...)? In 2015, tipc tool was the first user merged that requires libmnl, the only other user today in the tree is devlink, which even seems to define its own libmnl library helpers. What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

And I would like to get direction for the RDMA tool [1] which I'm working on it now.

The overall decision was to use netlink and put it under iproute2 umbrella. Currently, I have working RFC which is based on legacy sysfs interface to ensure that we are converging on user-experience even before moving to actual netlink defines.

Quoted 13 lines

An I would like to continue to work on netlink interface, but which lib interface should I need to base rdmatool's netlink code?

[1] https://www.mail-archive.com/[email protected]/msg148523.html

Quoted 8 lines

I don't really like that we make extended ack reporting now dependent on libmnl, which further diverts from iproute's native nl library vs requiring to install another nl library, making the current status quo even worse ... :/

Thanks,
Daniel

I would prefer new code use libmnl, but using libnetlink would also be ok. Any later conversion to libmnl would be mostly automated anyway.

The real objection was copy/pasting in the kernel netlink parser. That was unnecessary bloat.

#24 lore raw
Quoted 46 lines · Stephen Hemminger
Quoted 43 lines · On Thu, 4 May 2017 17:37:38 +0300 Leon Romanovsky <[email protected]> wrote:
Quoted 15 lines · Daniel Borkmann
Quoted 9 lines · Stephen Hemminger

Add support for extended ack error reporting via libmnl. This is a better alternative to use existing library and not copy/paste code from the kernel. Also make arguments const where possible.

Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel.

Quoted 4 lines

Adding a new function allows commands to be moved over to the extended error reporting over time.

For feedback, compile tested only.

Quoted 7 lines

Just out of curiosity, what is the plan regarding converting iproute2 over to libmnl (ip, tc, ss, ...)? In 2015, tipc tool was the first user merged that requires libmnl, the only other user today in the tree is devlink, which even seems to define its own libmnl library helpers. What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

And I would like to get direction for the RDMA tool [1] which I'm working on it now.

The overall decision was to use netlink and put it under iproute2 umbrella. Currently, I have working RFC which is based on legacy sysfs interface to ensure that we are converging on user-experience even before moving to actual netlink defines.

An I would like to continue to work on netlink interface, but which lib interface should I need to base rdmatool's netlink code?

[1] https://www.mail-archive.com/[email protected]/msg148523.html

Quoted 6 lines

I don't really like that we make extended ack reporting now dependent on libmnl, which further diverts from iproute's native nl library vs requiring to install another nl library, making the current status quo even worse ... :/

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Thanks,
Daniel

I would prefer new code use libmnl, but using libnetlink would also be ok. Any later conversion to libmnl would be mostly automated anyway.

Thanks, I'm copy/pasting devlink variation of libmnl :)

Quoted 3 lines

The real objection was copy/pasting in the kernel netlink parser. That was unnecessary bloat.

#25 lore raw
Quoted 47 lines · Thu, May 04, 2017 at 07:55:56PM CEST, [email protected] wrote:
Quoted 46 lines · Stephen Hemminger
Quoted 43 lines · On Thu, 4 May 2017 17:37:38 +0300 Leon Romanovsky <[email protected]> wrote:
Quoted 15 lines · Daniel Borkmann
Quoted 9 lines · Stephen Hemminger

Add support for extended ack error reporting via libmnl. This is a better alternative to use existing library and not copy/paste code from the kernel. Also make arguments const where possible.

Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel.

Quoted 4 lines

Adding a new function allows commands to be moved over to the extended error reporting over time.

For feedback, compile tested only.

Quoted 7 lines

Just out of curiosity, what is the plan regarding converting iproute2 over to libmnl (ip, tc, ss, ...)? In 2015, tipc tool was the first user merged that requires libmnl, the only other user today in the tree is devlink, which even seems to define its own libmnl library helpers. What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

And I would like to get direction for the RDMA tool [1] which I'm working on it now.

The overall decision was to use netlink and put it under iproute2 umbrella. Currently, I have working RFC which is based on legacy sysfs interface to ensure that we are converging on user-experience even before moving to actual netlink defines.

An I would like to continue to work on netlink interface, but which lib interface should I need to base rdmatool's netlink code?

[1] https://www.mail-archive.com/[email protected]/msg148523.html

Quoted 6 lines

I don't really like that we make extended ack reporting now dependent on libmnl, which further diverts from iproute's native nl library vs requiring to install another nl library, making the current status quo even worse ... :/

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Thanks,
Daniel

I would prefer new code use libmnl, but using libnetlink would also be ok. Any later conversion to libmnl would be mostly automated anyway.

Thanks, I'm copy/pasting devlink variation of libmnl :)

I needed couple of small helpers for generic netlink support. I believe they could be pushed to upstream libmnl so we can avoid having them in iproute2

Quoted 6 lines
Quoted 4 lines

The real objection was copy/pasting in the kernel netlink parser. That was unnecessary bloat.

#26 lore raw
In reply to Daniel Borkmann
Quoted 23 lines · On Thu, 04 May 2017 11:36:36 +0200 Daniel Borkmann <[email protected]> wrote:
Quoted 9 lines · Stephen Hemminger

Add support for extended ack error reporting via libmnl. This is a better alternative to use existing library and not copy/paste code from the kernel. Also make arguments const where possible.

Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel.

Quoted 4 lines

Adding a new function allows commands to be moved over to the extended error reporting over time.

For feedback, compile tested only.

Just out of curiosity, what is the plan regarding converting iproute2 over to libmnl (ip, tc, ss, ...)? In 2015, tipc tool was the first user merged that requires libmnl, the only other user today in the tree is devlink, which even seems to define its own libmnl library helpers. What is the clear benefit/rationale of outsourcing this to libmnl? I always was the impression we should strive for as little dependencies as possible?

Quoted 7 lines

I don't really like that we make extended ack reporting now dependent on libmnl, which further diverts from iproute's native nl library vs requiring to install another nl library, making the current status quo even worse ... :/

Thanks,
Daniel

No rush for migration. just slow migration as time permits. This would be good kernel janitor type project.