qBT announcing port as 1 to DHT even when "anonymous mode" is turned off #11887

Closed
opened 2026-02-21 22:04:07 -05:00 by deekerman · 1 comment
Owner

Originally created by @showstoppre on GitHub (Mar 24, 2021).

Please provide the following information

qBittorrent version and Operating System

(4.3.3) Windows 10 and Ubuntu 18.04

If on linux, libtorrent-rasterbar and Qt version

(type here)

What is the problem

qBT is announcing port as 1 to DHT in addition to my actual external port. I can confirm that "anonymous mode" is turned off under Tools>Options>BitTorrent. Problem here is that most clients doesn't allow multiple connections to/from same IP(including qBT) by default. So when a remote client obtains peer list from DHT, it sees two peers for same ip (one with correct external port and other with port as '1'). Now there is only a 50% chance that it connects to my client correctly.

I tested using qBT as remote client. My observation is as below. qBT always tries connecting using uTP first then using TCP. It tries one peer for uTP and other for TCP and the first peer to connect is chosen randomly.

Situation #1 - Desired

  • Remote qBT tries connection to my_ip:my_port using uTP. Connection is successful.

Situation #2 - Undesired

  • Remote qBT tries connection to my_ip:1 using uTP. Connection fails.
  • Remote qBT tries connection to my_ip:my_port using TCP. Connection fails as I'm behind CGN

What is the expected behavior

Only my actual external port should be announced to DHT.

Steps to reproduce

Can be observed using any torrents with DHT enabled in settings.

Extra info(if any)

Originally created by @showstoppre on GitHub (Mar 24, 2021). **Please provide the following information** ### qBittorrent version and Operating System (4.3.3) Windows 10 and Ubuntu 18.04 ### If on linux, libtorrent-rasterbar and Qt version (type here) ### What is the problem qBT is announcing port as 1 to DHT in addition to my actual external port. I can confirm that "anonymous mode" is turned off under Tools>Options>BitTorrent. Problem here is that most clients doesn't allow multiple connections to/from same IP(including qBT) by default. So when a remote client obtains peer list from DHT, it sees two peers for same ip (one with correct external port and other with port as '1'). Now there is only a 50% chance that it connects to my client correctly. I tested using qBT as remote client. My observation is as below. qBT always tries connecting using uTP first then using TCP. It tries one peer for uTP and other for TCP and the first peer to connect is chosen randomly. Situation #1 - Desired - Remote qBT tries connection to my_ip:my_port using uTP. Connection is successful. Situation #2 - Undesired - Remote qBT tries connection to my_ip:1 using uTP. Connection fails. - Remote qBT tries connection to my_ip:my_port using TCP. Connection fails as I'm behind CGN ### What is the expected behavior Only my actual external port should be announced to DHT. ### Steps to reproduce Can be observed using any torrents with DHT enabled in settings. ### Extra info(if any)
deekerman 2026-02-21 22:04:07 -05:00
Author
Owner

@showstoppre commented on GitHub (Aug 10, 2021):

Closing issue.

Upon more investigation, I identified that the issue is caused by some bad nodes, capturing port as '1', when 'implied_port' argument is set.

@showstoppre commented on GitHub (Aug 10, 2021): Closing issue. Upon more investigation, I identified that the issue is caused by some bad nodes, capturing port as '1', when 'implied_port' argument is set.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#11887
No description provided.