Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbi_impl: set speed/duplex before setting link up #451

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

KanjiMonster
Copy link
Contributor

Link speed/duplex changes do not trigger any notifications, only link state changes do. Therefore we need to make sure that speed/duplex is set correctly before setting the link state to up for ports.

When setting the link state first, it leaves a window where a process reacting to the link state event may read out old speed/duplex before we had a change to update them, and the default speed/duplex is 10mbit/half for TAP.

This can for example lead to breakage in LACP, where it uses the link speed to calculate the actor key. If it uses the wrong/old speed, it calculates a different key than the other side, and LACP will then fail to synchronize, breaking the link.

So make sure to set the speed and duplex first on link up, and reverse on link down.

Fixes: b5fe46c ("tap_manager: set port speed on tap interfaces")

@KanjiMonster
Copy link
Contributor Author

This should at least fix the spurious test failures with LACP bonds.

@KanjiMonster KanjiMonster marked this pull request as ready for review September 18, 2024 15:12
@KanjiMonster
Copy link
Contributor Author

Ran the link-aggr-lacp-systemd test for a few hours in a loop, and it didn't fail, while it failed after a while without the changes.

@KanjiMonster KanjiMonster marked this pull request as draft September 19, 2024 07:17
Link speed/duplex changes do not trigger any notifications, only link
state changes do. Therefore we need to make sure that speed/duplex is
set correctly before setting the link state to up for ports.

When setting the link state first, it leaves a window where a process
reacting to the link state event may read out old speed/duplex before we
had a change to update them, and the default speed/duplex is 10mbit/half
for TAP.

This can for example lead to breakage in LACP, where it uses the link
speed to calculate the actor key. If it uses the wrong/old speed, it
calculates a different key than the other side, and LACP will then fail
to synchronize, breaking the link.

So make sure to set the speed and duplex first on link up. On link down,
we do not need to set any speed or duplex values, since their values are
undefined.

Fixes: b5fe46c ("tap_manager: set port speed on tap interfaces")
Signed-off-by: Jonas Gorski <[email protected]>
@KanjiMonster KanjiMonster marked this pull request as ready for review September 19, 2024 07:25
@KanjiMonster
Copy link
Contributor Author

Simplified the change a bit - we don't need to set speed/duplex when there is no link (values are more or less undefined).

@rubensfig rubensfig merged commit 511c29b into main Sep 23, 2024
5 checks passed
@rubensfig rubensfig deleted the jogo_set_speed_while_down branch September 23, 2024 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants