Skip to content

Commit

Permalink
Fix PortsForwarder.Expose() proxy check
Browse files Browse the repository at this point in the history
The check for existing `proxies` entries used `local` as a key, but
they're actually inserted using keys of: `key(protocol, local)`.

This meant that, previously, the check was ineffective and wouldn't
reject duplicate forwards.

Signed-off-by: Chris Pick <[email protected]>
  • Loading branch information
Chris Pick authored and cfergeau committed Jan 8, 2025
1 parent 56a2606 commit 8943ed3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/services/forwarder/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewPortsForwarder(s *stack.Stack) *PortsForwarder {
func (f *PortsForwarder) Expose(protocol types.TransportProtocol, local, remote string) error {
f.proxiesLock.Lock()
defer f.proxiesLock.Unlock()
if _, ok := f.proxies[local]; ok {
if _, ok := f.proxies[key(protocol, local)]; ok {
return errors.New("proxy already running")
}

Expand Down

0 comments on commit 8943ed3

Please sign in to comment.