diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-08-03 17:19:49 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-08-04 01:28:19 +0200 |
commit | 9d4ab98d538f88cba871fed98665aa5a04f37da2 (patch) | |
tree | 3d200dade5e12b4c6d51c45b2d87e300e249653d /netlink.h | |
parent | 282581ba8433b5d0be928b10b724fbe277d8a4c6 (diff) | |
download | passt-9d4ab98d538f88cba871fed98665aa5a04f37da2.tar passt-9d4ab98d538f88cba871fed98665aa5a04f37da2.tar.gz passt-9d4ab98d538f88cba871fed98665aa5a04f37da2.tar.bz2 passt-9d4ab98d538f88cba871fed98665aa5a04f37da2.tar.lz passt-9d4ab98d538f88cba871fed98665aa5a04f37da2.tar.xz passt-9d4ab98d538f88cba871fed98665aa5a04f37da2.tar.zst passt-9d4ab98d538f88cba871fed98665aa5a04f37da2.zip |
netlink: Add nl_do() helper for simple operations with error checking
So far we never checked for errors reported on netlink operations via
NLMSG_ERROR messages. This has led to several subtle and tricky to debug
situations which would have been obvious if we knew that certain netlink
operations had failed.
Introduce a nl_do() helper that performs netlink "do" operations (that is
making a single change without retreiving complex information) with much
more thorough error checking. As well as returning an error code if we
get an NLMSG_ERROR message, we also check for unexpected behaviour in
several places. That way if we've made a mistake in our assumptions about
how netlink works it should result in a clear error rather than some subtle
misbehaviour.
We update those calls to nl_req() that can use the new wrapper to do so.
We will extend those to better handle errors in future. We don't touch
non-"do" operations for now, those are a bit trickier.
Link: https://bugs.passt.top/show_bug.cgi?id=60
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'netlink.h')
0 files changed, 0 insertions, 0 deletions