Compare commits
4 Commits
26ceb1630a
...
4edd0b7414
Author | SHA1 | Date | |
---|---|---|---|
4edd0b7414 | |||
b54ebfd915 | |||
69665fdcef | |||
7e1c213ff4 |
@ -1,8 +1,9 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"os"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"errors"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -20,7 +21,7 @@ func GetJailProperties(args []string) {
|
|||||||
jail, err = getJailFromArray(a, []string{""}, gJails)
|
jail, err = getJailFromArray(a, []string{""}, gJails)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error: %s\n", err.Error())
|
fmt.Printf("Error: %s\n", err.Error())
|
||||||
return
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
props = append(props, a)
|
props = append(props, a)
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
gVersion = "0.38b"
|
gVersion = "0.39"
|
||||||
|
|
||||||
// TODO : Get from $jail_zpool/defaults.json
|
// TODO : Get from $jail_zpool/defaults.json
|
||||||
MIN_DYN_DEVFS_RULESET = 1000
|
MIN_DYN_DEVFS_RULESET = 1000
|
||||||
|
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)
|
||||||
|
@ -917,7 +917,8 @@ func getFstab(path string) ([]Mount, error) {
|
|||||||
scan := bufio.NewScanner(f)
|
scan := bufio.NewScanner(f)
|
||||||
for scan.Scan() {
|
for scan.Scan() {
|
||||||
res := strings.Fields(scan.Text())
|
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())
|
return mounts, fmt.Errorf("Incorrect format for fstab line %s", scan.Text())
|
||||||
}
|
}
|
||||||
freq, err := strconv.Atoi(res[4])
|
freq, err := strconv.Atoi(res[4])
|
||||||
|
Loading…
Reference in New Issue
Block a user