diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-04-23 22:10:21 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-05-02 16:12:45 +0200 |
commit | 76e32022c4085952eea119fa69976c8bccf2710c (patch) | |
tree | 15c6a4ae82d57735d3635fc47344354f04e2b3cb /checksum.h | |
parent | d03c4e20202b9546b2b233a2ff98cb3b3395b8d9 (diff) | |
download | passt-76e32022c4085952eea119fa69976c8bccf2710c.tar passt-76e32022c4085952eea119fa69976c8bccf2710c.tar.gz passt-76e32022c4085952eea119fa69976c8bccf2710c.tar.bz2 passt-76e32022c4085952eea119fa69976c8bccf2710c.tar.lz passt-76e32022c4085952eea119fa69976c8bccf2710c.tar.xz passt-76e32022c4085952eea119fa69976c8bccf2710c.tar.zst passt-76e32022c4085952eea119fa69976c8bccf2710c.zip |
netlink: Fix iterations over nexthop objects
Somewhat confusingly, RTNH_NEXT(), as defined by <linux/rtnetlink.h>,
doesn't take an attribute length parameter like RTA_NEXT() does, and
I just modelled loops over nexthops after RTA loops, forgetting to
decrease the remaining length we pass to RTNH_OK().
In practice, this didn't cause issue in any of the combinations I
checked, at least without the next patch.
We seem to be the only user of RTNH_OK(): even iproute2 has an
open-coded version of it in print_rta_multipath() (ip/iproute.c).
Introduce RTNH_NEXT_AND_DEC(), similar to RTA_NEXT(), and use it.
Fixes: 6c7623d07bbd ("netlink: Add support to fetch default gateway from multipath routes")
Fixes: f4e38b5cd232 ("netlink: Adjust interface index inside copied nexthop objects too")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'checksum.h')
0 files changed, 0 insertions, 0 deletions