mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-08 06:29:08 +02:00
validate-mtu, nexthop and tun address config
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultMTU = 1280
|
||||
DefaultMTU = 1420
|
||||
DefaultWgPort = 51820
|
||||
)
|
||||
|
||||
|
||||
+4
-1
@@ -4,6 +4,7 @@
|
||||
package iface
|
||||
|
||||
import (
|
||||
"net/netip"
|
||||
"os/exec"
|
||||
|
||||
"github.com/pion/transport/v3"
|
||||
@@ -119,7 +120,9 @@ func (t *tunDevice) Wrapper() *DeviceWrapper {
|
||||
|
||||
// assignAddr Adds IP address to the tunnel interface and network route based on the range provided
|
||||
func (t *tunDevice) assignAddr() error {
|
||||
cmd := exec.Command("ifconfig", t.name, "inet", t.address.IP.String(), t.address.IP.String())
|
||||
np := netip.MustParseAddr(t.address.IP.String())
|
||||
|
||||
cmd := exec.Command("ifconfig", t.name, "inet", t.address.IP.String(), np.Prev().String())
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
log.Infof(`adding address command "%v" failed with output %s and error: `, cmd.String(), out)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user