Compare commits

..

4 Commits

4 changed files with 17 additions and 8 deletions

View File

@ -1,8 +1,9 @@
package cmd
import (
"errors"
"os"
"fmt"
"errors"
"reflect"
"strconv"
"strings"
@ -20,7 +21,7 @@ func GetJailProperties(args []string) {
jail, err = getJailFromArray(a, []string{""}, gJails)
if err != nil {
fmt.Printf("Error: %s\n", err.Error())
return
os.Exit(1)
}
} else {
props = append(props, a)

View File

@ -14,7 +14,7 @@ import (
)
const (
gVersion = "0.38b"
gVersion = "0.39"
// TODO : Get from $jail_zpool/defaults.json
MIN_DYN_DEVFS_RULESET = 1000

View File

@ -840,7 +840,7 @@ func setupVnetInterfaceHostSide(jail *Jail) ([]string, error) {
bridge := v[1]
// Get host side MAC
pname := fmt.Sprintf("Config.%s_mac", nic)
pname := fmt.Sprintf("Config.%s_mac", strings.Title(nic))
var val *reflect.Value
val, pname, err = getStructFieldValue(jail, pname)
if err != nil {
@ -853,7 +853,10 @@ func setupVnetInterfaceHostSide(jail *Jail) ([]string, error) {
return []string{}, err
}
} 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
@ -934,7 +937,7 @@ func setupVnetInterfaceJailSide(jail *Jail, hostepairs []string) error {
jsepair := fmt.Sprintf("%sb", strings.TrimSuffix(hostepairs[i], "a"))
// Get jail side MAC
pname := fmt.Sprintf("Config.%s_mac", nic)
pname := fmt.Sprintf("Config.%s_mac", strings.Title(nic))
var val *reflect.Value
val, pname, err = getStructFieldValue(jail, pname)
if err != nil {
@ -947,7 +950,11 @@ func setupVnetInterfaceJailSide(jail *Jail, hostepairs []string) error {
return err
}
} 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)

View File

@ -917,7 +917,8 @@ func getFstab(path string) ([]Mount, error) {
scan := bufio.NewScanner(f)
for scan.Scan() {
res := strings.Fields(scan.Text())
if len(res) != 6 {
// iocage create lines like that : "/iocage/releases/13.2-RELEASE/root/bin /iocage/jails/smtp-router-02/root/bin nullfs ro 0 0 # Added by iocage on 2023-10-10 17:20:51"
if (len(res) > 6 && !strings.EqualFold(res[6], "#")) || len(res) < 6 {
return mounts, fmt.Errorf("Incorrect format for fstab line %s", scan.Text())
}
freq, err := strconv.Atoi(res[4])