Skip to content

Commit 2226f05

Browse files
committed
do not fail to add routes that already exist
Change-Id: I948f861a1465bbb0a9b3fee903934388b78584d5
1 parent 5b1390b commit 2226f05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/driver/netnamespace.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"net"
2323
"slices"
24+
"syscall"
2425

2526
"github.com/google/dranet/pkg/apis"
2627

@@ -79,7 +80,7 @@ func applyRoutingConfig(containerNsPAth string, ifName string, routeConfig []api
7980
if route.Source != "" {
8081
r.Src = net.ParseIP(route.Source)
8182
}
82-
if err := nhNs.RouteAdd(&r); err != nil {
83+
if err := nhNs.RouteAdd(&r); err != nil && !errors.Is(err, syscall.EEXIST) {
8384
errorList = append(errorList, fmt.Errorf("fail to add route %s for interface %s on namespace %s: %w", r.String(), ifName, containerNsPAth, err))
8485
}
8586

0 commit comments

Comments
 (0)