mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-12-24 11:51:13 +08:00
ignore linux add routes occurs error: File exists
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package gost
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"syscall"
|
||||
|
||||
"github.com/docker/libcontainer/netlink"
|
||||
"github.com/go-log/log"
|
||||
@@ -149,7 +151,7 @@ func addTunRoutes(ifName string, routes ...IPRoute) error {
|
||||
}
|
||||
cmd := fmt.Sprintf("ip route add %s dev %s", route.Dest.String(), ifName)
|
||||
log.Logf("[tun] %s", cmd)
|
||||
if err := netlink.AddRoute(route.Dest.String(), "", "", ifName); err != nil {
|
||||
if err := netlink.AddRoute(route.Dest.String(), "", "", ifName); err != nil && !errors.Is(err, syscall.EEXIST) {
|
||||
return fmt.Errorf("%s: %v", cmd, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user