fix: wrong parameters
This commit is contained in:
parent
b307bcb4a9
commit
bdfa16ca6f
1 changed files with 7 additions and 6 deletions
|
@ -17,23 +17,24 @@ func ConfigInterfaceAddress(dev device.Device, addr netip.Prefix, forceMTU int,
|
|||
var (
|
||||
interfaceName = dev.Name()
|
||||
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
|
||||
}
|
||||
|
||||
if _, err = cmd.ExecCmd(fmt.Sprintf("ip link set %s up", interfaceName)); err != nil {
|
||||
if _, err := cmd.ExecCmd(fmt.Sprintf("ip link set %s up", interfaceName)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
execRouterCmd("add", addr.Masked().String(), interfaceName, ip.String(), "main")
|
||||
if err := execRouterCmd("add", addr.Masked().String(), interfaceName, ip.String(), "main"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if autoRoute {
|
||||
err = configInterfaceRouting(interfaceName, addr, autoDetectInterface)
|
||||
_ = configInterfaceRouting(interfaceName, addr, autoDetectInterface)
|
||||
}
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
func configInterfaceRouting(interfaceName string, addr netip.Prefix, autoDetectInterface bool) error {
|
||||
|
|
Loading…
Reference in a new issue