netlink: Use const rtnh pointer

6c7623d07 ("netlink: Add support to fetch default gateway from multipath
routes") inadvertently introduced a new cppcheck warning for a variable
which could be a const pointer but isn't.  This occurs with
cppcheck-2.13.0-1.fc39.x86_64 in Fedora 39 at least.

Fixes: 6c7623d07b ("netlink: Add support to fetch default gateway from multipath routes")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2024-02-12 15:05:28 +11:00 committed by Stefano Brivio
parent 7ee4e17267
commit 9f57983886

View file

@ -274,7 +274,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
if (rta->rta_type == RTA_OIF) { if (rta->rta_type == RTA_OIF) {
ifi = *(unsigned int *)RTA_DATA(rta); ifi = *(unsigned int *)RTA_DATA(rta);
} else if (rta->rta_type == RTA_MULTIPATH) { } else if (rta->rta_type == RTA_MULTIPATH) {
struct rtnexthop *rtnh; const struct rtnexthop *rtnh;
rtnh = (struct rtnexthop *)RTA_DATA(rta); rtnh = (struct rtnexthop *)RTA_DATA(rta);
ifi = rtnh->rtnh_ifindex; ifi = rtnh->rtnh_ifindex;