v0.42h: Add static-macs option for bridged vnet setup with mac flapping
This commit is contained in:
parent
6acea0d25b
commit
1006207fc2
@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
gVersion = "0.42g"
|
gVersion = "0.42h"
|
||||||
|
|
||||||
// TODO : Get from $jail_zpool/defaults.json
|
// TODO : Get from $jail_zpool/defaults.json
|
||||||
MIN_DYN_DEVFS_RULESET = 1000
|
MIN_DYN_DEVFS_RULESET = 1000
|
||||||
@ -52,6 +52,7 @@ var (
|
|||||||
gNoJailLineSep bool
|
gNoJailLineSep bool
|
||||||
gNoSnapLineSep bool
|
gNoSnapLineSep bool
|
||||||
gNoDSLineSep bool
|
gNoDSLineSep bool
|
||||||
|
gBridgeStaticMac bool
|
||||||
|
|
||||||
gHostVersion float64
|
gHostVersion float64
|
||||||
|
|
||||||
@ -519,6 +520,8 @@ func initConfig() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gBridgeStaticMac = viper.GetBool("static-macs")
|
||||||
|
|
||||||
if gDebug {
|
if gDebug {
|
||||||
log.SetLevel(log.DebugLevel)
|
log.SetLevel(log.DebugLevel)
|
||||||
log.Debugf("Debug mode enabled\n")
|
log.Debugf("Debug mode enabled\n")
|
||||||
|
@ -1007,6 +1007,15 @@ func setupVnetInterfaceJailSide(jail *Jail, hostepairs []string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error adding member %s to %s: %v: %s\n", nic, bridge, err, out)
|
return fmt.Errorf("Error adding member %s to %s: %v: %s\n", nic, bridge, err, out)
|
||||||
}
|
}
|
||||||
|
// Fix mac flapping and instabilities with bridged vnet network
|
||||||
|
if gBridgeStaticMac {
|
||||||
|
log.Debugf("Set %s as static to %s in %s address cache\n")
|
||||||
|
cmd = fmt.Sprintf("/sbin/ifconfig %s static %s %s", bridge, nic, jsmac)
|
||||||
|
out, err := executeCommand(cmd)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error adding member %s to %s: %v: %s\n", nic, bridge, err, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check we have an IP for the nic, and set it into jail
|
// Check we have an IP for the nic, and set it into jail
|
||||||
|
Loading…
Reference in New Issue
Block a user