delete then add addresses again

This commit is contained in:
Siyuan 2025-10-10 14:56:31 +00:00
parent 1ad44ed461
commit 9cd29a3b1b
1 changed files with 8 additions and 2 deletions

View File

@ -211,8 +211,7 @@ func (nm *NetlinkManager) EnsureInterfaceUpWithTimeout(ctx context.Context, ifac
case <-linkUpTimeout:
attempt++
l.Error().
Int("attempt", attempt).
Msg("interface is still down after timeout")
Int("attempt", attempt).Msg("interface is still down after timeout")
if err != nil {
return nil, err
}
@ -521,6 +520,13 @@ func (nm *NetlinkManager) ReconcileLink(link *Link, expected []types.IPAddress,
}
}
for _, addr := range toAdd {
netlinkAddr := addr.NetlinkAddr()
if err := nm.AddrAdd(link, &netlinkAddr); err != nil {
nm.logger.Warn().Err(err).Str("address", addr.Address.String()).Msg("failed to add address")
}
}
actualToAdd := len(toAdd) - len(toUpdate)
if len(toAdd) > 0 || len(toUpdate) > 0 || len(toRemove) > 0 {
nm.logger.Info().