linsk shell: tap net enable option

This commit is contained in:
AlexSSD7 2023-08-31 19:56:22 +01:00
commit 2328b58eaa
2 changed files with 7 additions and 3 deletions

View file

@ -47,6 +47,10 @@ var shellCmd = &cobra.Command{
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() }()
sess, err := sc.NewSession()
@ -127,13 +131,14 @@ var shellCmd = &cobra.Command{
}
return 0
}, forwardPortRules, true, false))
// TODO: Enable tap option.
}, forwardPortRules, true, enableTapNetFlag))
},
}
var forwardPortsFlagStr string
var enableTapNetFlag bool
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().BoolVar(&enableTapNetFlag, "enable-net-tap", false, "Enables host-VM tap networking.")
}

View file

@ -100,7 +100,6 @@ func runVM(passthroughArg string, fn func(context.Context, *vm.VM, *vm.FileManag
}
tapNameToUse := nettap.NewRandomTapName()
// TODO: Run two instances at the same time and check whether nothing is wrongfully pruned.
knownAllocs, err := store.ListNetTapAllocations()
if err != nil {
slog.Error("Failed to list net tap allocations", "error", err.Error())