aboutgitcodebugslistschat
path: root/netlink.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-08-03 17:19:45 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-08-04 01:28:00 +0200
commitdee75941801afdc4271a36051ebb03f6c62344e3 (patch)
treebf01b1ed616fc72a87787408a144c568319eca75 /netlink.h
parent576df71e8b6785d3e5d7439e6112d72c474424cc (diff)
downloadpasst-dee75941801afdc4271a36051ebb03f6c62344e3.tar
passt-dee75941801afdc4271a36051ebb03f6c62344e3.tar.gz
passt-dee75941801afdc4271a36051ebb03f6c62344e3.tar.bz2
passt-dee75941801afdc4271a36051ebb03f6c62344e3.tar.lz
passt-dee75941801afdc4271a36051ebb03f6c62344e3.tar.xz
passt-dee75941801afdc4271a36051ebb03f6c62344e3.tar.zst
passt-dee75941801afdc4271a36051ebb03f6c62344e3.zip
netlink: Make nl_*_dup() use a separate datagram for each request
nl_req() is designed to handle a single netlink request message: it only receives a single reply datagram for the request, and only waits for a single NLMSG_DONE or NLMSG_ERROR message at the beginning to clear out things from previous requests. However, in both nl_addr_dup() and nl_route_dup() we can send multiple request messages as a single datagram, with a single nl_req() call. This can easily mean that the replies nl_req() collects get out of sync with requests. We only get away with this because after we call these functions we don't make any netlink calls where we need to parse the replies. This is fragile, so alter nl_*_dup() to make an nl_req() call for each address it is adding in the target namespace. For nl_route_dup() this fixes an additional minor problem: because routes can have dependencies, some of the route add requests might fail on the first attempt, so we need to repeat the requests a number of times. When we did that, we weren't updating the sequence number on each new attempt. This works, but not updating the sequence number for each new request isn't ideal. Now that we're making the requests one at a time, it's easier to make sure we update the sequence number each time. Link: https://bugs.passt.top/show_bug.cgi?id=67 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