Skip to content

Commit

Permalink
vrrp: Fix specifying netlink_notify_msg for VMAC when name set
Browse files Browse the repository at this point in the history
Trying to specify a VMAC name as well as netlink_notify_msg did
not work for use_vmac.

Signed-off-by: Quentin Armitage <[email protected]>
  • Loading branch information
pqarmitage committed Mar 1, 2024
1 parent 2f3c193 commit c30a60d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions keepalived/vrrp/vrrp_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,13 @@ dump_vrrp(FILE *fp, const vrrp_t *vrrp)
vrrp->ll_addr[0], vrrp->ll_addr[1], vrrp->ll_addr[2], vrrp->ll_addr[3], vrrp->ll_addr[4], vrrp->ll_addr[5],
__test_bit(VRRP_VMAC_MAC_USE_VRID, &vrrp->flags) ? " (using VRID)" : "");
}

/* The following two flags should only be set on VMACs, but
* we check them for any interface type, just incase ... */
if (__test_bit(VRRP_VMAC_NETLINK_NOTIFY, &vrrp->flags))
conf_write(fp, " Force netlink update for base interface");
conf_write(fp, " Force netlink update for base interface");
if (__test_bit(VRRP_VMAC_ADDR_BIT, &vrrp->flags))
conf_write(fp, " Use VMAC for VIPs on other interfaces");
conf_write(fp, " Use VMAC for VIPs on other interfaces");
#ifdef _HAVE_VRRP_IPVLAN_
else if (__test_bit(VRRP_IPVLAN_BIT, &vrrp->flags))
conf_write(fp, " Use IPVLAN, i/f %s, is_up = %s%s%s, type %s",
Expand Down
12 changes: 6 additions & 6 deletions keepalived/vrrp/vrrp_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ vrrp_vmac_handler(const vector_t *strvec)
__set_bit(VRRP_VMAC_BIT, &current_vrrp->flags);

/* Ifname and MAC address can be specified */
for (i = 1; i < vector_size(strvec) && i <= 2; i++) {
for (i = 1; i < vector_size(strvec); i++) {
if (strchr(strvec_slot(strvec, i), ':')) {
/* It's a MAC address - interface names cannot include a ':' */
if (__test_bit(VRRP_VMAC_MAC_SPECIFIED, &current_vrrp->flags)) {
Expand Down Expand Up @@ -563,18 +563,18 @@ vrrp_vmac_handler(const vector_t *strvec)
} else {
name = strvec_slot(strvec, i);

if (current_vrrp->vmac_ifname[0]) {
report_config_error(CONFIG_GENERAL_ERROR, "VMAC interface name already specified");
continue;
}

/* The string "netlink_notify_msg" needs to be longer than IFNAMSIZ
* so that it cannot be a valid interface name. */
if (!strcmp(name, "netlink_notify_msg")) {
__set_bit(VRRP_VMAC_NETLINK_NOTIFY, &current_vrrp->flags);
continue;
}

if (current_vrrp->vmac_ifname[0]) {
report_config_error(CONFIG_GENERAL_ERROR, "VMAC interface name already specified");
continue;
}

if (!dev_name_valid(name)) {
report_config_error(CONFIG_GENERAL_ERROR, "VMAC interface name '%s' too long or invalid characters - ignoring", name);
continue;
Expand Down

0 comments on commit c30a60d

Please sign in to comment.