fix: default router with fakeIP when tun enable
This commit is contained in:
parent
8f94409808
commit
e9bd2d8d68
1 changed files with 3 additions and 4 deletions
|
@ -17,9 +17,10 @@ func ConfigInterfaceAddress(dev device.Device, addr netip.Prefix, forceMTU int,
|
||||||
var (
|
var (
|
||||||
interfaceName = dev.Name()
|
interfaceName = dev.Name()
|
||||||
ip = addr.Masked().Addr().Next()
|
ip = addr.Masked().Addr().Next()
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
if _, err := cmd.ExecCmd(fmt.Sprintf("ip addr add %s dev %s", ip.String(), interfaceName)); err != nil {
|
if _, err = cmd.ExecCmd(fmt.Sprintf("ip addr add %s dev %s", ip.String(), interfaceName)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,9 +28,7 @@ func ConfigInterfaceAddress(dev device.Device, addr netip.Prefix, forceMTU int,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = execRouterCmd("add", addr, interfaceName, "198.18.0.1", "main"); err != nil {
|
execRouterCmd("add", addr.String(), interfaceName, ip.String(), "main")
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if autoRoute {
|
if autoRoute {
|
||||||
err = configInterfaceRouting(interfaceName, addr, autoDetectInterface)
|
err = configInterfaceRouting(interfaceName, addr, autoDetectInterface)
|
||||||
|
|
Loading…
Reference in a new issue