libnet/portmapper: remove dead DeleteForwardingTableEntry

Prior to commit 4f09af626, DeleteForwardingTableEntry had a Linux
implementation. That's not the case anymore, and it's a no-op on
Windows. Remove it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton
2025-06-30 04:14:17 +02:00
parent 32710d3e5e
commit b48442db4c
2 changed files with 0 additions and 16 deletions

View File

@@ -123,15 +123,11 @@ func (pm *PortMapper) MapRange(container net.Addr, hostIP net.IP, hostPortStart,
return nil, ErrPortMappedForIP
}
containerIP, containerPort := getIPAndPort(m.container)
var err error
m.stopUserlandProxy, err = newDummyProxy(m.proto, hostIP, allocatedHostPort)
if err != nil {
// FIXME(thaJeztah): both stopping the proxy and deleting iptables rules can produce an error, and both are not currently handled.
m.stopUserlandProxy()
// need to undo the iptables rules before we return
pm.DeleteForwardingTableEntry(m.proto, hostIP, allocatedHostPort, containerIP.String(), containerPort)
return nil, err
}
@@ -156,12 +152,6 @@ func (pm *PortMapper) Unmap(host net.Addr) error {
delete(pm.currentMappings, key)
containerIP, containerPort := getIPAndPort(data.container)
hostIP, hostPort := getIPAndPort(data.host)
if err := pm.DeleteForwardingTableEntry(data.proto, hostIP, hostPort, containerIP.String(), containerPort); err != nil {
log.G(context.TODO()).Errorf("Error on iptables delete: %s", err)
}
switch a := host.(type) {
case *net.TCPAddr:
pm.allocator.ReleasePort(a.IP, "tcp", a.Port)

View File

@@ -1,7 +1,6 @@
package portmapper
import (
"net"
"sync"
"github.com/moby/moby/v2/daemon/libnetwork/portallocator"
@@ -19,8 +18,3 @@ type PortMapper struct {
allocator *portallocator.PortAllocator
}
// DeleteForwardingTableEntry removes a port mapping from the forwarding table
func (pm *PortMapper) DeleteForwardingTableEntry(proto string, sourceIP net.IP, sourcePort int, containerIP string, containerPort int) error {
return nil
}