fix: TUN file exists

This commit is contained in:
adlyq 2022-05-31 09:59:25 +08:00
parent 4092a7c84b
commit fa2e6be05d
2 changed files with 3 additions and 3 deletions

View file

@ -44,7 +44,7 @@ func ConfigInterfaceAddress(dev device.Device, addr netip.Prefix, forceMTU int,
return err return err
} }
if err = netlink.AddrAdd(metaLink, naddr); err != nil { if err = netlink.AddrAdd(metaLink, naddr); err != nil && err.Error() != "file exists" {
return err return err
} }

View file

@ -51,7 +51,7 @@ func ConfigInterfaceAddress(dev device.Device, addr netip.Prefix, forceMTU int,
return err return err
} }
if err = netlink.AddrAdd(metaLink, naddr); err != nil { if err = netlink.AddrAdd(metaLink, naddr); err != nil && err.Error() != "file exists" {
return err return err
} }
@ -65,7 +65,7 @@ func ConfigInterfaceAddress(dev device.Device, addr netip.Prefix, forceMTU int,
Protocol: 2, Protocol: 2,
Src: ip.AsSlice(), Src: ip.AsSlice(),
Table: 254, Table: 254,
}); err != nil { }); err != nil && err.Error() != "file exists" {
return err return err
} }