1
0
Fork 0
forked from forks/go-ethereum
go-ethereum-modded-tocallarg/p2p/nat
Csaba Kiraly a7f24c26c0
p2p/nat: fix UPnP port reset (#31566)
Make UPnP more robust

- Once a random port was mapped, we try to stick to it even if a UPnP
refresh fails. Previously we were immediately moving back to try the
default port, leading to frequent ENR changes.

- We were deleting port mappings before refresh as a possible
workaround. This created issues in some UPnP servers. The UPnP (and PMP)
specification is explicit about the refresh requirements, and delete is
clearly not needed (see
https://github.com/ethereum/go-ethereum/pull/30265#issuecomment-2766987859).
From now on we only delete when closing.

- We were trying to add port mappings only once, and then moved on to
random ports. Now we insist a bit more, so that a simple failed request
won't lead to ENR changes.

Fixes https://github.com/ethereum/go-ethereum/issues/31418

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-04-09 11:28:29 +02:00
..
nat.go all: use fmt.Appendf instead of fmt.Sprintf where possible (#31301) 2025-03-25 14:53:02 +01:00
nat_test.go p2p/nat: add stun protocol (#31064) 2025-01-24 16:16:02 +01:00
natpmp.go p2p/nat: remove forceful port mapping in upnp (#30265) 2025-04-04 10:56:55 +02:00
natupnp.go p2p/nat: fix UPnP port reset (#31566) 2025-04-09 11:28:29 +02:00
natupnp_test.go all: replace strings.Replace with string.ReplaceAll (#24835) 2022-05-09 13:13:23 +03:00
stun-list-update.sh p2p/nat: add stun protocol (#31064) 2025-01-24 16:16:02 +01:00
stun-list.txt p2p/nat: add stun protocol (#31064) 2025-01-24 16:16:02 +01:00
stun.go p2p/nat: add stun protocol (#31064) 2025-01-24 16:16:02 +01:00
stun_test.go p2p/nat: remove test with default servers (#31225) 2025-02-21 10:42:54 +08:00