BUGFIX starting jail with dhcp
This commit is contained in:
parent
dbe9622a01
commit
452b0e4b4e
@ -1448,7 +1448,7 @@ func StartJail(args []string) {
|
|||||||
fmt.Printf(" > Setup VNet network: OK\n")
|
fmt.Printf(" > Setup VNet network: OK\n")
|
||||||
|
|
||||||
// Set default route, unless main network is dhcp
|
// Set default route, unless main network is dhcp
|
||||||
if ! cj.isFirstNetDhcp() {
|
if ! cj.isFirstNetDhcp() && !strings.EqualFold(cj.Config.Ip4_addr, "none") {
|
||||||
fmt.Printf(" > Setup default ipv4 gateway:\n")
|
fmt.Printf(" > Setup default ipv4 gateway:\n")
|
||||||
cmd := fmt.Sprintf("/usr/sbin/setfib %s /usr/sbin/jexec %d route add default %s", cj.Config.Exec_fib, cj.JID, cj.Config.Defaultrouter)
|
cmd := fmt.Sprintf("/usr/sbin/setfib %s /usr/sbin/jexec %d route add default %s", cj.Config.Exec_fib, cj.JID, cj.Config.Defaultrouter)
|
||||||
out, err := executeCommand(cmd)
|
out, err := executeCommand(cmd)
|
||||||
|
33
cmd/stop.go
33
cmd/stop.go
@ -83,15 +83,30 @@ func umountAndUnjailZFS(jail *Jail) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func destroyVNetInterfaces(jail *Jail) error {
|
func destroyVNetInterfaces(jail *Jail) error {
|
||||||
for _, i := range strings.Split(jail.Config.Ip4_addr, ",") {
|
if !strings.EqualFold(jail.Config.Ip4_addr, "none") {
|
||||||
iname := fmt.Sprintf("%s.%d", strings.Split(i, "|")[0], jail.JID)
|
for _, i := range strings.Split(jail.Config.Ip4_addr, ",") {
|
||||||
fmt.Printf("%s: ", iname)
|
iname := fmt.Sprintf("%s.%d", strings.Split(i, "|")[0], jail.JID)
|
||||||
_, err := executeCommand(fmt.Sprintf("ifconfig %s destroy", iname))
|
fmt.Printf("%s: ", iname)
|
||||||
//_, err := executeScript(fmt.Sprintf("ifconfig %s destroy >/dev/null 2>&1", iname))
|
_, err := executeCommand(fmt.Sprintf("ifconfig %s destroy", iname))
|
||||||
if err != nil {
|
//_, err := executeScript(fmt.Sprintf("ifconfig %s destroy >/dev/null 2>&1", iname))
|
||||||
return err
|
if err != nil {
|
||||||
} else {
|
return err
|
||||||
fmt.Printf("OK\n")
|
} else {
|
||||||
|
fmt.Printf("OK\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !strings.EqualFold(jail.Config.Ip6_addr, "none") {
|
||||||
|
for _, i := range strings.Split(jail.Config.Ip6_addr, ",") {
|
||||||
|
iname := fmt.Sprintf("%s.%d", strings.Split(i, "|")[0], jail.JID)
|
||||||
|
fmt.Printf("%s: ", iname)
|
||||||
|
_, err := executeCommand(fmt.Sprintf("ifconfig %s destroy", iname))
|
||||||
|
//_, err := executeScript(fmt.Sprintf("ifconfig %s destroy >/dev/null 2>&1", iname))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
fmt.Printf("OK\n")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user