v0.42h: finish previous commit

This commit is contained in:
yo 2024-11-21 20:36:19 +01:00
parent 1006207fc2
commit f33b3cfec4

View File

@ -1009,11 +1009,15 @@ func setupVnetInterfaceJailSide(jail *Jail, hostepairs []string) error {
} }
// Fix mac flapping and instabilities with bridged vnet network // Fix mac flapping and instabilities with bridged vnet network
if gBridgeStaticMac { if gBridgeStaticMac {
log.Debugf("Set %s as static to %s in %s address cache\n") printablemac := hex.EncodeToString(jsmac)
cmd = fmt.Sprintf("/sbin/ifconfig %s static %s %s", bridge, nic, jsmac) for i := 2 ; i < len(printablemac) ; i += 3 {
printablemac = printablemac[:i] + ":" + printablemac[i:]
}
log.Debugf("Set %s.%d as static to %s in %s address cache\n", nic, jail.JID, printablemac, bridge)
cmd = fmt.Sprintf("/sbin/ifconfig %s static %s.%d %s", bridge, nic, jail.JID, printablemac)
out, err := executeCommand(cmd) out, err := executeCommand(cmd)
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 setting %s.%d static with %s on %s: %v: %s\n", nic, jail.JID, printablemac, bridge, err, out)
} }
} }
} }