Skip to content

Commit 5fd7ed2

Browse files
authored
Merge pull request #49342 from robmry/debug_flaky_unsol_na
Debug flaky unsolicited Neighbour Advertisements
2 parents ac23ddd + aa3a23d commit 5fd7ed2

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

integration/networking/bridge_linux_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,9 @@ func TestAdvertiseAddresses(t *testing.T) {
15361536

15371537
icmps := stopICMP6Listen()
15381538
checkPkts("ICMP6", icmps, netip.MustParseAddr(ctr2Addr6), network.UnpackUnsolNA)
1539+
if t.Failed() {
1540+
d.TailLogsT(t, 100)
1541+
}
15391542
})
15401543
}
15411544
}

libnetwork/osl/interface_linux.go

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,37 @@ func (n *Namespace) advertiseAddrs(ctx context.Context, ifIndex int, i *Interfac
499499
}
500500
}
501501
if naSender != nil {
502-
if err := naSender.Send(); err != nil {
503-
log.G(ctx).WithError(err).Warn("Failed to send unsolicited NA")
504-
errs = append(errs, err)
502+
// FIXME(robmry) - retry if this fails, but still return the error.
503+
// In CI, the send has failed a couple of times with "write ip ::1->ff02::1: sendmsg: network is unreachable".
504+
// Can't repro locally, so - try find out whether a retry helps and it's something racing, or it's a
505+
// persistent problem.
506+
for c := range 3 {
507+
if c > 0 {
508+
time.Sleep(50 * time.Millisecond)
509+
}
510+
511+
routes, rgErr := nlh.RouteGetWithOptions(net.IPv6linklocalallnodes, &netlink.RouteGetOptions{
512+
IifIndex: ifIndex,
513+
SrcAddr: net.IPv6loopback,
514+
})
515+
var routeStr string
516+
if rgErr != nil {
517+
routeStr = fmt.Sprintf("RouteGet->'%s'", rgErr.Error())
518+
} else if len(routes) != 1 {
519+
routeStr = fmt.Sprintf("RouteGet->%d routes", len(routes))
520+
} else {
521+
routeStr = fmt.Sprintf("RouteGet->'%s'", routes[0].String())
522+
}
523+
524+
if err := naSender.Send(); err != nil {
525+
log.G(ctx).WithError(err).Warn("Failed to send unsolicited NA")
526+
errs = append(errs, fmt.Errorf("%s: %w", routeStr, err))
527+
continue
528+
}
529+
if c > 0 {
530+
errs = append(errs, fmt.Errorf("success"))
531+
}
532+
break
505533
}
506534
}
507535
return errors.Join(errs...)

0 commit comments

Comments
 (0)