diff --git a/keepalived/vrrp/vrrp_data.c b/keepalived/vrrp/vrrp_data.c index a697e3a6e..117ec8fd5 100644 --- a/keepalived/vrrp/vrrp_data.c +++ b/keepalived/vrrp/vrrp_data.c @@ -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", diff --git a/keepalived/vrrp/vrrp_parser.c b/keepalived/vrrp/vrrp_parser.c index 4e350e702..a43edc7df 100644 --- a/keepalived/vrrp/vrrp_parser.c +++ b/keepalived/vrrp/vrrp_parser.c @@ -514,7 +514,7 @@ vrrp_vmac_handler(const vector_t *strvec) __set_bit(VRRP_VMAC_BIT, ¤t_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, ¤t_vrrp->flags)) { @@ -563,11 +563,6 @@ 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")) { @@ -575,6 +570,11 @@ vrrp_vmac_handler(const vector_t *strvec) 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;