jpirko / libteam

team netdevice library
GNU Lesser General Public License v2.1
225 stars 57 forks source link

nsna_ping link watcher does not honor priority #66

Open thejesh-ap opened 2 years ago

thejesh-ap commented 2 years ago

Started a team instance with below configuration

{
        "device":       "ma0",
        "runner":       {"name": "activebackup"},
        "link_watch":  {
                "name": "nsna_ping",
                "interval" : 3000,
                "missed_max" : 3,
                "target_host" : "fd7a:629f:52a4:b0ab::1"
        },
        "notify_peers": {
                "count" : 3,
                "interval" : 1000
        },
        "ports":        {
                "mac_ma1_1": {
                        "prio": 100
                },
                "mac_ma1_2": {
                        "prio": 98
                },
                "internal1_1.100": {
                        "prio": 97
                }
        }
}

Initially it correctly chose 'mac_ma1_1' as the active

$ sudo teamdctl ma0 state
setup:
  runner: activebackup
ports:
  internal1_1.100
    link watches:
      link summary: down
      instance[link_watch_0]:
        name: nsna_ping
        link: down
        down count: 1
  mac_ma1_1
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: nsna_ping
        link: up
        down count: 0
  mac_ma1_2
    link watches:
      link summary: down
      instance[link_watch_0]:
        name: nsna_ping
        link: down
        down count: 1
runner:
  active port: mac_ma1_1

Then set the 'mac_ma1_1' to down

$ sudo ip link set mac_ma1_1 down

It chose next priority link mac_ma1_2 correctly

$ sudo teamdctl ma0 state
setup:
  runner: activebackup
ports:
  internal1_1.100
    link watches:
      link summary: down
      instance[link_watch_0]:
        name: nsna_ping
        link: down
        down count: 2
  mac_ma1_1
    link watches:
      link summary: down
      instance[link_watch_0]:
        name: nsna_ping
        link: down
        down count: 1
  mac_ma1_2
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: nsna_ping
        link: up
        down count: 1
runner:
  active port: mac_ma1_2

After that reenable higher priority link

$ sudo ip link set mac_ma1_1 up

It does not change to higher priority port. It keeps using the current lower priority port

The same steps performed on arp_ping link watcher does use the higher priority port.