Skip to content

Commit

Permalink
vrrp: Use addattr32() for setting link group
Browse files Browse the repository at this point in the history
The group variable is a uint32_t so addattr32() is better than
addattr_l().

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
  • Loading branch information
pqarmitage committed Mar 1, 2024
1 parent 345f633 commit 4883311
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions keepalived/vrrp/vrrp_vmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ netlink_link_up(vrrp_t *vrrp)
static void
netlink_link_group(interface_t *base_ifp)
{
uint32_t group = base_ifp->group;
struct {
struct nlmsghdr n;
struct ifinfomsg ifi;
Expand All @@ -246,7 +245,7 @@ netlink_link_group(interface_t *base_ifp)
req.ifi.ifi_family = AF_UNSPEC;
req.ifi.ifi_index = (int)IF_INDEX(base_ifp);

addattr_l(&req.n, sizeof(req), IFLA_GROUP, &group, sizeof(group));
addattr32(&req.n, sizeof(req), IFLA_GROUP, base_ifp->group);
netlink_talk(&nl_cmd, &req.n);
}

Expand Down Expand Up @@ -277,7 +276,6 @@ netlink_link_add_vmac(vrrp_t *vrrp, const interface_t *old_interface)
struct rtattr *linkinfo;
struct rtattr *data;
interface_t *ifp;
uint32_t group;
bool create_interface = true;
struct {
struct nlmsghdr n;
Expand Down Expand Up @@ -393,8 +391,7 @@ netlink_link_add_vmac(vrrp_t *vrrp, const interface_t *old_interface)
* (iptables devgroup or nftables iifgroup, oifgroup) to continue
* working regardless of the use_vmac setting.
*/
group = vrrp->configured_ifp->base_ifp->group;
addattr_l(&req.n, sizeof(req), IFLA_GROUP, &group, sizeof(group));
addattr32(&req.n, sizeof(req), IFLA_GROUP, vrrp->configured_ifp->base_ifp->group);
addattr_l(&req.n, sizeof(req), IFLA_ADDRESS, if_ll_addr, ETH_ALEN);

#ifdef _HAVE_VRF_
Expand Down

0 comments on commit 4883311

Please sign in to comment.