BUGFIX: Correctly handle MAC adresses jail and host side
This commit is contained in:
parent
69665fdcef
commit
b54ebfd915
15
cmd/start.go
15
cmd/start.go
@ -840,7 +840,7 @@ func setupVnetInterfaceHostSide(jail *Jail) ([]string, error) {
|
|||||||
bridge := v[1]
|
bridge := v[1]
|
||||||
|
|
||||||
// Get host side MAC
|
// Get host side MAC
|
||||||
pname := fmt.Sprintf("Config.%s_mac", nic)
|
pname := fmt.Sprintf("Config.%s_mac", strings.Title(nic))
|
||||||
var val *reflect.Value
|
var val *reflect.Value
|
||||||
val, pname, err = getStructFieldValue(jail, pname)
|
val, pname, err = getStructFieldValue(jail, pname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -853,7 +853,10 @@ func setupVnetInterfaceHostSide(jail *Jail) ([]string, error) {
|
|||||||
return []string{}, err
|
return []string{}, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hsmac = val.Bytes()
|
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])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get bridge MTU
|
// Get bridge MTU
|
||||||
@ -934,7 +937,7 @@ func setupVnetInterfaceJailSide(jail *Jail, hostepairs []string) error {
|
|||||||
jsepair := fmt.Sprintf("%sb", strings.TrimSuffix(hostepairs[i], "a"))
|
jsepair := fmt.Sprintf("%sb", strings.TrimSuffix(hostepairs[i], "a"))
|
||||||
|
|
||||||
// Get jail side MAC
|
// Get jail side MAC
|
||||||
pname := fmt.Sprintf("Config.%s_mac", nic)
|
pname := fmt.Sprintf("Config.%s_mac", strings.Title(nic))
|
||||||
var val *reflect.Value
|
var val *reflect.Value
|
||||||
val, pname, err = getStructFieldValue(jail, pname)
|
val, pname, err = getStructFieldValue(jail, pname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -947,7 +950,11 @@ func setupVnetInterfaceJailSide(jail *Jail, hostepairs []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
jsmac = val.Bytes()
|
jsmac, err = hex.DecodeString(strings.Split(val.String(), " ")[1])
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error converting %s to hex\n", strings.Split(val.String(), " ")[1])
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := fmt.Sprintf("/sbin/ifconfig %s vnet %s", jsepair, jail.InternalName)
|
cmd := fmt.Sprintf("/sbin/ifconfig %s vnet %s", jsepair, jail.InternalName)
|
||||||
|
Loading…
Reference in New Issue
Block a user