Skip to content

Add support for overriding the NAT-PMP gateway with a nat_pmp_gateway config option#8144

Open
samvv wants to merge 3 commits intoarvidn:RC_2_0from
samvv:feat/nat-pmp-gateway
Open

Add support for overriding the NAT-PMP gateway with a nat_pmp_gateway config option#8144
samvv wants to merge 3 commits intoarvidn:RC_2_0from
samvv:feat/nat-pmp-gateway

Conversation

@samvv
Copy link

@samvv samvv commented Feb 10, 2026

As discussed in #7681, this pull request updates farcaller's changes to the latest commit on RC_2_0.

This is a fresh pull request due to the issues @qBittUser made me aware of. I started off a fresh branch and cherry-picked the relevant commits.

This hasn't been thoroughly been tested yet. This seems to fix users behind ProtonVPN not being able to seed due to the default gateway not being set. However, it's difficult to tell because I fail to find a good torrent to test (I used the Arch Linux image). I sometimes get speeds in the kilobytes instead of plain nothing, which is better than nothing but still not ideal.

Copy link
Owner

@arvidn arvidn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, except the handling of the address string from the settings into an optional address should be improved

error_code ignored;
std::string gateway = m_settings.get_str(settings_pack::nat_pmp_gateway);
boost::optional<address> gateway_addr;
if (gateway == "") {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (gateway == "") {
if (gateway.empty()) {

if (gateway == "") {
gateway_addr = boost::none;
} else {
gateway_addr = make_address(gateway, ignored);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this call fails, it would be reasonable to have gateway_addr be nullopt. Otherwise any invalid address will break NAT-PMP.

i.e. the ignored error code should not be ignored.

@arvidn
Copy link
Owner

arvidn commented Feb 15, 2026

Does this look good? #8154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants