Skip to content

Commit

Permalink
ValidateMTU: check only the interface that holds the node ip
Browse files Browse the repository at this point in the history
The only interface that needs to be checked is the one tied to the node
ip. This prevents tainting the node when another interface is added with
a lower MTU.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
  • Loading branch information
fedepaol committed Apr 26, 2021
1 parent c02c628 commit 9540335
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/network/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,19 @@ func (node *OsdnNode) validateMTU() error {
return fmt.Errorf("could not retrieve link id %d while validating MTU", route.LinkIndex)
}

// we want to check the mtu only for the interface assigned to the node's primary ip
found := false
addresses, err := netlink.AddrList(link, netlink.FAMILY_V4)
for _, address := range addresses {
if node.localIP == address.IP.String() {
found = true
break
}
}
if !found {
continue
}

newmtu := link.Attrs().MTU
if newmtu > 0 && newmtu < mtu {
mtu = newmtu
Expand Down

0 comments on commit 9540335

Please sign in to comment.