linsk shell: tap net enable option
This commit is contained in:
parent
ff9dcdffa2
commit
2328b58eaa
2 changed files with 7 additions and 3 deletions
|
|
@ -47,6 +47,10 @@ var shellCmd = &cobra.Command{
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if trc != nil {
|
||||||
|
slog.Info("Tap networking is active", "host-ip", trc.Net.HostIP, "vm-ip", trc.Net.GuestIP)
|
||||||
|
}
|
||||||
|
|
||||||
defer func() { _ = sc.Close() }()
|
defer func() { _ = sc.Close() }()
|
||||||
|
|
||||||
sess, err := sc.NewSession()
|
sess, err := sc.NewSession()
|
||||||
|
|
@ -127,13 +131,14 @@ var shellCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}, forwardPortRules, true, false))
|
}, forwardPortRules, true, enableTapNetFlag))
|
||||||
// TODO: Enable tap option.
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var forwardPortsFlagStr string
|
var forwardPortsFlagStr string
|
||||||
|
var enableTapNetFlag bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
shellCmd.Flags().StringVar(&forwardPortsFlagStr, "forward-ports", "", "Extra TCP port forwarding rules. Syntax: '<HOST PORT>:<VM PORT>' OR '<HOST BIND IP>:<HOST PORT>:<VM PORT>'. Multiple rules split by comma are accepted.")
|
shellCmd.Flags().StringVar(&forwardPortsFlagStr, "forward-ports", "", "Extra TCP port forwarding rules. Syntax: '<HOST PORT>:<VM PORT>' OR '<HOST BIND IP>:<HOST PORT>:<VM PORT>'. Multiple rules split by comma are accepted.")
|
||||||
|
shellCmd.Flags().BoolVar(&enableTapNetFlag, "enable-net-tap", false, "Enables host-VM tap networking.")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ func runVM(passthroughArg string, fn func(context.Context, *vm.VM, *vm.FileManag
|
||||||
}
|
}
|
||||||
|
|
||||||
tapNameToUse := nettap.NewRandomTapName()
|
tapNameToUse := nettap.NewRandomTapName()
|
||||||
// TODO: Run two instances at the same time and check whether nothing is wrongfully pruned.
|
|
||||||
knownAllocs, err := store.ListNetTapAllocations()
|
knownAllocs, err := store.ListNetTapAllocations()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("Failed to list net tap allocations", "error", err.Error())
|
slog.Error("Failed to list net tap allocations", "error", err.Error())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue