BUGFIX on mac handling when none + BUGFIX on mac generation (+1 for jailside)
This commit is contained in:
parent
4edd0b7414
commit
6ead474a78
14
cmd/start.go
14
cmd/start.go
@ -810,7 +810,9 @@ func generateMAC(jail *Jail, nic string) ([]byte, []byte, error) {
|
||||
}
|
||||
|
||||
hsmac := append(prefix, suffix...)
|
||||
jsmac := append(hsmac[:5], hsmac[5]+1)
|
||||
jsmac := make([]byte, 6)
|
||||
copy(jsmac, hsmac)
|
||||
jsmac[5] = jsmac[5] + 1
|
||||
|
||||
// Save MACs to config
|
||||
pname := fmt.Sprintf("Config.%s_mac", strings.Title(nic))
|
||||
@ -853,6 +855,12 @@ func setupVnetInterfaceHostSide(jail *Jail) ([]string, error) {
|
||||
return []string{}, err
|
||||
}
|
||||
} else {
|
||||
if strings.EqualFold(val.String(), "none") {
|
||||
hsmac, _, err = generateMAC(jail, nic)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
}
|
||||
hsmac, err = hex.DecodeString(strings.Split(val.String(), " ")[0])
|
||||
if err != nil {
|
||||
return []string{}, fmt.Errorf("Error converting %s to hex\n", strings.Split(val.String(), " ")[0])
|
||||
@ -912,7 +920,9 @@ func setupVnetInterfaceJailSide(jail *Jail, hostepairs []string) error {
|
||||
|
||||
for _, i := range strings.Split(jail.Config.Ip4_addr, ",") {
|
||||
v := strings.Split(i, "|")
|
||||
ip4s[v[0]] = v[1]
|
||||
if len(v) > 1 {
|
||||
ip4s[v[0]] = v[1]
|
||||
}
|
||||
}
|
||||
for _, i := range strings.Split(jail.Config.Ip6_addr, ",") {
|
||||
v := strings.Split(i, "|")
|
||||
|
Loading…
Reference in New Issue
Block a user