diff --git a/pkg/hostagent/hostagent.go b/pkg/hostagent/hostagent.go index 4239b6998c2..dcc7321fbb2 100644 --- a/pkg/hostagent/hostagent.go +++ b/pkg/hostagent/hostagent.go @@ -510,13 +510,7 @@ sudo chown -R "${USER}" /run/host-services` case <-a.guestAgentAliveCh: // NOP case <-time.After(time.Minute): - err := errors.New("guest agent does not seem to be running; port forwards will not work") - if *a.y.VMType == limayaml.WSL2 { - // geustagent is currently not available for WSL2: https://github.com/lima-vm/lima/issues/2025 - logrus.Warn(err) - } else { - errs = append(errs, err) - } + errs = append(errs, errors.New("guest agent does not seem to be running; port forwards will not work")) } } if err := a.waitForRequirements("final", a.finalRequirements()); err != nil { @@ -660,7 +654,7 @@ func (a *HostAgent) processGuestAgentEvents(ctx context.Context, client *guestag for _, f := range ev.Errors { logrus.Warnf("received error from the guest: %q", f) } - a.portForwarder.OnEvent(ctx, ev, a.instSSHAddress) + a.portForwarder.OnEvent(ctx, ev) } if err := client.Events(ctx, onEvent); err != nil { diff --git a/pkg/hostagent/port.go b/pkg/hostagent/port.go index 57f48ab55a3..36d0ea86f73 100644 --- a/pkg/hostagent/port.go +++ b/pkg/hostagent/port.go @@ -44,16 +44,8 @@ func hostAddress(rule limayaml.PortForward, guest *api.IPPort) string { return host.HostString() } -func (pf *portForwarder) forwardingAddresses(guest *api.IPPort, localUnixIP net.IP) (hostAddr, guestAddr string) { +func (pf *portForwarder) forwardingAddresses(guest *api.IPPort) (hostAddr, guestAddr string) { guestIP := net.ParseIP(guest.Ip) - if pf.vmType == limayaml.WSL2 { - guestIP = localUnixIP - host := &api.IPPort{ - Ip: guestIP.String(), - Port: guest.Port, - } - return host.String(), guest.HostString() - } for _, rule := range pf.rules { if rule.GuestSocket != "" { continue @@ -82,11 +74,9 @@ func (pf *portForwarder) forwardingAddresses(guest *api.IPPort, localUnixIP net. return "", guest.HostString() } -func (pf *portForwarder) OnEvent(ctx context.Context, ev *api.Event, instSSHAddress string) { - localUnixIP := net.ParseIP(instSSHAddress) - +func (pf *portForwarder) OnEvent(ctx context.Context, ev *api.Event) { for _, f := range ev.LocalPortsRemoved { - local, remote := pf.forwardingAddresses(f, localUnixIP) + local, remote := pf.forwardingAddresses(f) if local == "" { continue } @@ -96,7 +86,7 @@ func (pf *portForwarder) OnEvent(ctx context.Context, ev *api.Event, instSSHAddr } } for _, f := range ev.LocalPortsAdded { - local, remote := pf.forwardingAddresses(f, localUnixIP) + local, remote := pf.forwardingAddresses(f) if local == "" { logrus.Infof("Not forwarding TCP %s", remote) continue