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