Skip to content

Commit

Permalink
Fix port auto neg handling to avoid unappliable diff
Browse files Browse the repository at this point in the history
Fixes #658

Signed-off-by: Sergei Lukianov <me@slukjanov.name>
  • Loading branch information
Frostman committed Jan 28, 2025
1 parent 2eb2203 commit 10401ed
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pkg/agent/dozer/bcm/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ func planControlLink(agent *agentapi.Agent, spec *dozer.Spec) error {
prefixLen, _ := ipNet.Mask.Size()

spec.Interfaces[controlIface] = &dozer.SpecInterface{
Description: pointer.To("Management link"),
Enabled: pointer.To(true),
// Speed: getPortSpeed(agent, controlIface), // TODO do we need to set it for management port?
Description: pointer.To("Management link"),
Enabled: pointer.To(true),
AutoNegotiate: pointer.To(true),
Subinterfaces: map[uint32]*dozer.SpecSubinterface{
0: {
IPs: map[string]*dozer.SpecInterfaceIP{
Expand Down Expand Up @@ -2430,21 +2430,15 @@ func planPortAutoNegs(agent *agentapi.Agent, spec *dozer.Spec) error {
}

for name, iface := range spec.Interfaces {
if !isHedgehogPortName(name) || !autoNegAllowed[name] {
if !isHedgehogPortName(name) || strings.HasPrefix(name, wiringapi.ManagementPortPrefix) {
continue
}

val := pointer.To(autoNegDefault[name])

if strings.HasPrefix(name, "M") {
val = pointer.To(true)
}

iface.AutoNegotiate = val
iface.AutoNegotiate = pointer.To(autoNegDefault[name])
}

for name, autoNeg := range agent.Spec.Switch.PortAutoNegs {
if !isHedgehogPortName(name) || strings.HasPrefix(name, "M") || !autoNegAllowed[name] {
if !isHedgehogPortName(name) || strings.HasPrefix(name, wiringapi.ManagementPortPrefix) || !autoNegAllowed[name] {
continue
}

Expand Down

0 comments on commit 10401ed

Please sign in to comment.