@@ -576,8 +576,15 @@ func configProviderNic(nicName, brName string) (int, error) {
576
576
continue
577
577
}
578
578
579
+ if ! strings .HasPrefix (addr .Label , nicName ) {
580
+ if strings .HasPrefix (addr .Label , brName ) {
581
+ addr .Label = nicName + addr .Label [len (brName ):]
582
+ } else {
583
+ addr .Label = nicName
584
+ }
585
+ }
579
586
if err = netlink .AddrDel (nic , & addr ); err != nil {
580
- errMsg := fmt .Errorf ("failed to delete address %s on nic %s: %v" , addr .String (), nicName , err )
587
+ errMsg := fmt .Errorf ("failed to delete address %q on nic %s: %v" , addr .String (), nicName , err )
581
588
if errors .Is (err , syscall .EADDRNOTAVAIL ) {
582
589
// the IP address does not exist now
583
590
klog .Warning (errMsg )
@@ -587,10 +594,10 @@ func configProviderNic(nicName, brName string) (int, error) {
587
594
}
588
595
589
596
if addr .Label != "" {
590
- addr .Label = brName + strings . TrimPrefix ( addr .Label , nicName )
597
+ addr .Label = brName + addr .Label [ len ( nicName ):]
591
598
}
592
599
if err = netlink .AddrReplace (bridge , & addr ); err != nil {
593
- return 0 , fmt .Errorf ("failed to replace address %s on OVS bridge %s: %v" , addr .String (), brName , err )
600
+ return 0 , fmt .Errorf ("failed to replace address %q on OVS bridge %s: %v" , addr .String (), brName , err )
594
601
}
595
602
}
596
603
0 commit comments