Skip to content

Creating link or setting interface up with unicast_src before address assigned to i/f doesn't work #1847

@pqarmitage

Description

@pqarmitage

Describe the bug

  1. Setting an interface up without the unicast_src configured on the interface means that keepalived cannot bind to the unicast_src and so doesn't receive adverts from other nodes; however the VRRP instance is not put into fault state, and so it transitions to master, even if there is a higher priority master. Subsequently adding the unicast_src IP makes it work again.

  2. Deleting an interface and subsequently recreating it causes a bind error which is not detected. The VRRP instance then does not work again

  3. Deleting the unicast_src ip address does not cause the VRRP instance to go to fault state

To Reproduce

1. ip link set eth0.460 down
    ip link addr del 192.168.54.4/24 dev eth0.460
    ip link set eth0.460 up

    Instance transitions to MASTER state because it cannot receive adverts.

    ip addr add 192.168.54.4/24 brd + dev eth0.460

    Instance now starts receiving adverts and so transitions to backup.

2. ip link del eth0.460
    ip link add eth0.460 link eth0 type vlan id 60

3. ip addr del 192.168.54.4/24 dev eth0.460

Expected behavior
The VRRP instance stays in fault state if the unicast_src is not configured.

It doesn't attempt to bind to the unicast_src address until it is configured.

Keepalived version

Keepalived v2.2.1 (01/31,2021), git commit v2.2.1-24-g4d3e5c79+

Copyright(C) 2001-2021 Alexandre Cassen, <acassen@gmail.com>

Built with kernel headers for Linux 5.8.18
Running on Linux 5.8.18-100.fc31.x86_64 #1 SMP Mon Nov 2 20:32:55 UTC 2020
Distro: Fedora 31 (Workstation Edition)

configure options: --enable-bfd --enable-snmp --enable-snmp-rfc --enable-dbus --enable-sha1 --enable-regex --enable-json --enable-debug --disable-eintr-debug --with-fixed-if-type=veth

Config options:  LIBIPSET_DYNAMIC NFTABLES SYSTEMD LVS REGEX REGEX_DEBUG VRRP VRRP_AUTH JSON BFD OLD_CHKSUM_COMPAT FIB_ROUTING SNMP_V3_FOR_V2 SNMP_VRRP SNMP_CHECKER SNMP_RFCV2 SNMP_RFCV3 DBUS TIMER_CHECK NETLINK_TIMERS SMTP_ALERT_DEBUG EPOLL_DEBUG EPOLL_THREAD_DUMP TSM_DEBUG VRRP_FD_DEBUG NETWORK_TIMESTAMP ASSERT FIXED_IF_TYPE=veth FILE_LOGGING LOG_FILE_APPEND RECVMSG_DEBUG SCRIPT_DEBUG TRACK_PROCESS_DEBUG PARSER_DEBUG CHECKSUM_DEBUG CHECKER_DEBUG SMTP_CONNECT_DEBUG DUMP_KEYWORDS

System options:  PIPE2 SIGNALFD INOTIFY_INIT1 VSYSLOG EPOLL_CREATE1 MEMFD_CREATE IPV4_DEVCONF IPV6_ADVANCED_API LIBNL3 RTA_ENCAP RTA_EXPIRES RTA_NEWDST RTA_PREF FRA_SUPPRESS_PREFIXLEN FRA_SUPPRESS_IFGROUP FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTEXT_FILTER_SKIP_STATS FRA_L3MDEV FRA_UID_RANGE RTAX_FASTOPEN_NO_COOKIE RTA_VIA FRA_OIFNAME FRA_PROTOCOL FRA_IP_PROTO FRA_SPORT_RANGE FRA_DPORT_RANGE RTA_TTL_PROPAGATE IFA_FLAGS IP_MULTICAST_ALL LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA IPTABLES NET_LINUX_IF_H_COLLISION LIBIPVS_NETLINK IPVS_DEST_ATTR_ADDR_FAMILY IPVS_SYNCD_ATTRIBUTES IPVS_64BIT_STATS IPVS_TUN_TYPE IPVS_TUN_CSUM IPVS_TUN_GRE VRRP_VMAC VRRP_IPVLAN IFLA_LINK_NETNSID CN_PROC SOCK_NONBLOCK SOCK_CLOEXEC O_PATH GLOB_BRACE GLOB_ALTDIRFUNC INET6_ADDR_GEN_MODE VRF SO_MARK SCHED_RESET_ON_FORK

Distro (please complete the following information):

  • Name: Fedora
  • Version 31
  • Architecture x86_64

The problem occurs regardless of distro, version or architecture

Details of any containerisation or hosted service (e.g. AWS)
None, but it wouldn't make any difference.

Configuration file:

global_defs {
    dynamic_interfaces
}
vrrp_script check_database {
    script "my_script"
    interval 1
    timeout  30
}
vrrp_instance VI_1 {
    debug 2
    interface eth0.460
    state BACKUP
    nopreempt
    virtual_router_id 51 
    priority 101
    unicast_src_ip 192.168.54.4
    unicast_peer {
        192.168.54.5
    }
    track_script {
        check_database
    }
}

Notify and track scripts
n/a

System Log entries
1.

Tue Feb 11:57:19.613874626 2021: Netlink reports eth0.460 down
Tue Feb 11:57:19.613911223 2021: (VI_1) Entering FAULT STATE
Tue Feb 11:57:19.613997965 2021: Deassigned address fe80::c89d:83ff:feca:e385 from interface eth0.460
Tue Feb 11:57:42.154812944 2021: Deassigned address 192.168.54.4 from interface eth0.460
Tue Feb 11:57:50.028390741 2021: Netlink reports eth0.460 up
Tue Feb 11:57:50.028419655 2021: (VI_1) Entering BACKUP STATE
Tue Feb 11:57:50.028439770 2021: VI_1: sending gratuitous ARP for 192.168.54.4
Tue Feb 11:57:50.028450595 2021: Sending gratuitous ARP on eth0.460 for 192.168.54.4
Tue Feb 11:57:51.575892505 2021: Assigned address fe80::c89d:83ff:feca:e385 for interface eth0.460
Tue Feb 11:57:53.638023708 2021: (VI_1) Receive advertisement timeout
Tue Feb 11:57:53.638189231 2021: (VI_1) Entering MASTER STATE
Tue Feb 11:58:07.452797775 2021: Assigned address 192.168.54.4 for interface eth0.460
Tue Feb 11:58:07.641303815 2021: (VI_1) Master received advert from 192.168.54.5 with higher priority 101, ours 100
Tue Feb 11:58:07.641330914 2021: (VI_1) Entering BACKUP STATE

Other node starts logging:
Tue Feb 11:57:53.638253974 2021: (VI_1) Received advert from 192.168.54.4 with lower priority 100, ours 101, forcing new election

Tue Feb 11:18:04.111185627 2021: bind unicast_src 192.168.54.4 failed 99 - Cannot assign requested address
Tue Feb 11:18:04.111228370 2021: scheduler: Error 9 performing control on EPOLL instance for fd -1 (Bad file descriptor)
Tue Feb 11:18:04.111244154 2021: scheduler: Cant register read event for fd [-1](Bad file descriptor)
Tue Feb 11:52:51.643648229 2021: Deassigned address 192.168.54.4 from interface eth0.460
Tue Feb 11:52:54.807786165 2021: (VI_1) Receive advertisement timeout
Tue Feb 11:52:54.807983467 2021: (VI_1) Entering MASTER STATE

and MASTER start logging

Tue Feb 11:52:55.808278744 2021: (VI_1) Received advert from 192.168.54.4 with lower priority 100, ours 101, forcing new election

Did keepalived coredump?
No coredump

Additional context
For point 1., the following works without an error:

ip link del eth0.460
ip link add eth0.460a link eth0 type vlan id 60
ip addr add 192.168.54.4/24 brd + dev eth0.460a
ip link set eth0.460a name eth0.460
ip link set eth0.460 up

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions