qBittorrent does not check if ports are open and does not reopen ports after router reboot #9845

Closed
opened 2026-02-21 20:24:59 -05:00 by deekerman · 27 comments
Owner

Originally created by @whoodini on GitHub (Mar 5, 2020).

Originally assigned to: @FranciscoPombal on GitHub.

Please provide the following information

qBittorrent version and Operating System

qBittorrent 4.2.1 on Windows 10 1909.

If on linux, libtorrent-rasterbar and Qt version

(type here)

What is the problem

qBittorrent does not check if the ports are open and does not reopen the ports after router reboot.
Nor does Random button in Options -> Connection open the ports. It changes the port but does not open it in router (router is a mikrotik).
I need to manually restart the whole qBittorrent in order for it to open the ports.

What is the expected behavior

I would expect the qBittorrent to check the ports every x (60 min) and try to open/reopen them again. Router might have rebooted or lost connection or was a power outage.

Steps to reproduce

Simple, just reboot your router.

Extra info(if any)

Fixed ports and no reboots would be a fix but not the correct one.
I do weekly reboots and random ports.
ty

Originally created by @whoodini on GitHub (Mar 5, 2020). Originally assigned to: @FranciscoPombal on GitHub. **Please provide the following information** ### qBittorrent version and Operating System qBittorrent 4.2.1 on Windows 10 1909. ### If on linux, libtorrent-rasterbar and Qt version (type here) ### What is the problem qBittorrent does not check if the ports are open and does not reopen the ports after router reboot. Nor does Random button in Options -> Connection open the ports. It changes the port but does not open it in router (router is a mikrotik). I need to manually restart the whole qBittorrent in order for it to open the ports. ### What is the expected behavior I would expect the qBittorrent to check the ports every x (60 min) and try to open/reopen them again. Router might have rebooted or lost connection or was a power outage. ### Steps to reproduce Simple, just reboot your router. ### Extra info(if any) Fixed ports and no reboots would be a fix but not the correct one. I do weekly reboots and random ports. ty
deekerman 2026-02-21 20:24:59 -05:00
  • closed this issue
  • added the
    Network
    label
Author
Owner

@ghost commented on GitHub (Mar 6, 2020):

Why not just forward the ports manually?

@ghost commented on GitHub (Mar 6, 2020): Why not just forward the ports manually?
Author
Owner

@whoodini commented on GitHub (Mar 6, 2020):

I do not think that predictability is good thing in some cases. I think random would be better in my case.
Besides, routers have UPnP, it is a good thing, it works and we should use it.
Im not an expert on networking, but imo and fwik manual/fixed ports are used when: one does not know how to do it/one does not care/one wants to be done quick, equipment is incompatibile, equipment is old or needs high reliability no matter the costs.

@whoodini commented on GitHub (Mar 6, 2020): I do not think that predictability is good thing in some cases. I think random would be better in my case. Besides, routers have UPnP, it is a good thing, it works and we should use it. Im not an expert on networking, but imo and fwik manual/fixed ports are used when: one does not know how to do it/one does not care/one wants to be done quick, equipment is incompatibile, equipment is old or needs high reliability no matter the costs.
Author
Owner

@Seeker2 commented on GitHub (Mar 6, 2020):

qBitTorrent sometimes doesn't even activate UPnP on the selected port...and instead activates UPnP on a different one: https://github.com/qbittorrent/qBittorrent/issues/11816
(This is likely triggered when using random ports...)

Incoming connections is not guaranteed proof UPnP port forwarding is working -- uTP connections (which use UDP packets) can use a version of STUN to bypass NAT routers under some conditions.

Only incoming TCP peer/seed connections is proof of an unfirewalled incoming path to qBitTorrent through local networking (routers, firewalls, etc).

@Seeker2 commented on GitHub (Mar 6, 2020): qBitTorrent sometimes doesn't even activate UPnP on the selected port...and instead activates UPnP on a different one: https://github.com/qbittorrent/qBittorrent/issues/11816 (This is likely triggered when using random ports...) Incoming connections is not guaranteed proof UPnP port forwarding is working -- uTP connections (which use UDP packets) can use a version of STUN to bypass NAT routers under some conditions. Only incoming TCP peer/seed connections is proof of an unfirewalled incoming path to qBitTorrent through local networking (routers, firewalls, etc).
Author
Owner

@whoodini commented on GitHub (Mar 6, 2020):

I can see in my router if the ports are open, how many are open and which ports are open. I can also see bytes and packets.

Currently I see in IP -> Firewall -> NAT, 2 opened ports:
protocol:6(tcp) dst port:49692 opened by: upnp "local-IP": qBitorrent/4.2.1
protocol:17(udp) dst port:50105 opened by: upnp "local-IP":qBitorrent/4.2.1
and qBitorrent/4.2.1 lists "Port for incoming connections: 25897" its a random one.

PS. qBitorrent execution log reports:
05.03.2020 23:43 - UPnP/NAT-PMP: Port mapping successful, message: successfully mapped port using UPnP. external port: UDP/50105
05.03.2020 23:43 - UPnP/NAT-PMP: Port mapping successful, message: successfully mapped port using UPnP. external port: TCP/49692
05.03.2020 23:43 - Successfully listening on IP: fe80::70a5:ebad:9c24:1563%9, port: UDP/52083
05.03.2020 23:43 - Successfully listening on IP: fe80::70a5:ebad:9c24:1563%9, port: TCP/49695
05.03.2020 23:43 - Successfully listening on IP: 0.0.0.0, port: UDP/50105
05.03.2020 23:43 - Successfully listening on IP: 0.0.0.0, port: TCP/49692
05.03.2020 23:43 - UPnP / NAT-PMP support [ON]
there is no mention in the log about the port 25897.

PPS. I can confirm with canyouseeme.org and ipvoid.com/udp-port-scan that the truly opened ports are the ones reported by the router. Why does the IPv6 have different ports?

@whoodini commented on GitHub (Mar 6, 2020): I can see in my router if the ports are open, how many are open and which ports are open. I can also see bytes and packets. Currently I see in IP -> Firewall -> NAT, 2 opened ports: protocol:6(tcp) dst port:49692 opened by: upnp "local-IP": qBitorrent/4.2.1 protocol:17(udp) dst port:50105 opened by: upnp "local-IP":qBitorrent/4.2.1 and qBitorrent/4.2.1 lists "Port for incoming connections: 25897" its a random one. PS. qBitorrent execution log reports: 05.03.2020 23:43 - UPnP/NAT-PMP: Port mapping successful, message: successfully mapped port using UPnP. external port: UDP/50105 05.03.2020 23:43 - UPnP/NAT-PMP: Port mapping successful, message: successfully mapped port using UPnP. external port: TCP/49692 05.03.2020 23:43 - Successfully listening on IP: fe80::70a5:ebad:9c24:1563%9, port: UDP/52083 05.03.2020 23:43 - Successfully listening on IP: fe80::70a5:ebad:9c24:1563%9, port: TCP/49695 05.03.2020 23:43 - Successfully listening on IP: 0.0.0.0, port: UDP/50105 05.03.2020 23:43 - Successfully listening on IP: 0.0.0.0, port: TCP/49692 05.03.2020 23:43 - UPnP / NAT-PMP support [ON] there is no mention in the log about the port 25897. PPS. I can confirm with canyouseeme.org and ipvoid.com/udp-port-scan that the truly opened ports are the ones reported by the router. Why does the IPv6 have different ports?
Author
Owner

@Seeker2 commented on GitHub (Mar 6, 2020):

I thought (normally?) the same port was supposed to be used for both UDP and TCP -- so incoming TCP and uTP peers/seeds go to the same destination.
Most trackers only hand out a single port per ip address...and it could be the wrong one with multiple port destinations that are TCP or uTP specific.

@Seeker2 commented on GitHub (Mar 6, 2020): I thought (normally?) the same port was supposed to be used for both UDP and TCP -- so incoming TCP and uTP peers/seeds go to the same destination. Most trackers only hand out a single port per ip address...and it could be the wrong one with multiple port destinations that are TCP or uTP specific.
Author
Owner

@mschumacher69 commented on GitHub (Mar 7, 2020):

How can I check in qBitorrent if the port is open or not?

@mschumacher69 commented on GitHub (Mar 7, 2020): How can I check in qBitorrent if the port is open or not?
Author
Owner

@FranciscoPombal commented on GitHub (Mar 7, 2020):

@arvidn does libtorrent support periodically checking UPnP?

@FranciscoPombal commented on GitHub (Mar 7, 2020): @arvidn does libtorrent support periodically checking UPnP?
Author
Owner

@arvidn commented on GitHub (Mar 8, 2020):

This really seems like a fringe use case. Why is this important? Is it common to restart routers?

does libtorrent support periodically checking UPnP?

yes, but it's disabled. A long time ago, libtorrent would request a UPnP port forward that expired in 1 hour, and then refresh it. Some routers don't support port forwards with expiration times, so they would send a 725 error code back. This would make libtorrent retry with a permanent lease duration.

However, it turned out that there are also UPnP routers that don't support returning the 725 error code. To make it work on those, I just disabled the expiration time logic and always mapped permanent port forwards.

Maybe we're in a time now where we don't need to care about shitty UPnP implementations (although, I'm not convinced there really are any good ones, it's just a shitty protocol in general).

Perhaps I should restore the periodic refreshing of the port map.

Here's the code in libtorrent.

@arvidn commented on GitHub (Mar 8, 2020): This really seems like a fringe use case. Why is this important? Is it common to restart routers? > does libtorrent support periodically checking UPnP? yes, but it's disabled. A long time ago, libtorrent would request a UPnP port forward that expired in 1 hour, and then refresh it. Some routers don't support port forwards with expiration times, so they would send a 725 error code back. This would make libtorrent retry with a permanent lease duration. However, it turned out that there are also UPnP routers that don't support returning the 725 error code. To make it work on those, I just disabled the expiration time logic and *always* mapped permanent port forwards. Maybe we're in a time now where we don't need to care about shitty UPnP implementations (although, I'm not convinced there really are any good ones, it's just a shitty protocol in general). Perhaps I should restore the periodic refreshing of the port map. [Here's](https://github.com/arvidn/libtorrent/blob/RC_1_2/include/libtorrent/upnp.hpp#L295) the code in libtorrent.
Author
Owner

@FranciscoPombal commented on GitHub (Mar 8, 2020):

@arvidn

This really seems like a fringe use case. Why is this important? Is it common to restart routers?

If they are shitty, yes. And my guess would be that many people have shitty ISP-provided routers.

Still, even if it is a fringe case, it seems wrong for libtorrent to break down like this due to a router restart.

yes, but it's disabled. A long time ago, libtorrent would request a UPnP port forward that expired in 1 hour, and then refresh it. Some routers don't support port forwards with expiration times, so they would send a 725 error code back. This would make libtorrent retry with a permanent lease duration.

However, it turned out that there are also UPnP routers that don't support returning the 725 error code. To make it work on those, I just disabled the expiration time logic and always mapped permanent port forwards.

Maybe we're in a time now where we don't need to care about shitty UPnP implementations (although, I'm not convinced there really are any good ones, it's just a shitty protocol in general).

Perhaps I should restore the periodic refreshing of the port map.

Here's the code in libtorrent.

IMO the best approach would be:

  • Assume a reasonable UPnP implementation by default, and use periodic temporary leases.
  • Expose an option to disable them, for users that might run into problems due to this
  • Maybe also expose an option to configure the lease duration? Just for extra flexibility, some people might care about it.
@FranciscoPombal commented on GitHub (Mar 8, 2020): @arvidn > This really seems like a fringe use case. Why is this important? Is it common to restart routers? If they are shitty, yes. And my guess would be that many people have shitty ISP-provided routers. Still, even if it is a fringe case, it seems wrong for libtorrent to break down like this due to a router restart. > yes, but it's disabled. A long time ago, libtorrent would request a UPnP port forward that expired in 1 hour, and then refresh it. Some routers don't support port forwards with expiration times, so they would send a 725 error code back. This would make libtorrent retry with a permanent lease duration. > > However, it turned out that there are also UPnP routers that don't support returning the 725 error code. To make it work on those, I just disabled the expiration time logic and _always_ mapped permanent port forwards. > > Maybe we're in a time now where we don't need to care about shitty UPnP implementations (although, I'm not convinced there really are any good ones, it's just a shitty protocol in general). > > Perhaps I should restore the periodic refreshing of the port map. > > [Here's](https://github.com/arvidn/libtorrent/blob/RC_1_2/include/libtorrent/upnp.hpp#L295) the code in libtorrent. IMO the best approach would be: - Assume a reasonable UPnP implementation by default, and use periodic temporary leases. - Expose an option to disable them, for users that might run into problems due to this - Maybe also expose an option to configure the lease duration? Just for extra flexibility, some people might care about it.
Author
Owner

@arvidn commented on GitHub (Mar 8, 2020):

In the long run, I would like to remove support for UPnP, now that the world is moving towards PCP (which is a much more reasonable protocol).

Would anyone be interested in giving this patch a try? It's simply restoring the 1 hour expirations of UPnP port maps. https://github.com/arvidn/libtorrent/pull/4406

@arvidn commented on GitHub (Mar 8, 2020): In the long run, I would like to remove support for UPnP, now that the world is moving towards PCP (which is a much more reasonable protocol). Would anyone be interested in giving this patch a try? It's simply restoring the 1 hour expirations of UPnP port maps. https://github.com/arvidn/libtorrent/pull/4406
Author
Owner

@Seeker2 commented on GitHub (Mar 8, 2020):

"This really seems like a fringe use case."
...That gets reported pretty often: https://github.com/qbittorrent/qBittorrent/issues/11759#issuecomment-596001851

A LOT of people are too lazy or unable to manually port forward and configure firewalls, so sadly UPnP is still needed for now.

@Seeker2 commented on GitHub (Mar 8, 2020): "This really seems like a fringe use case." ...That gets reported pretty often: https://github.com/qbittorrent/qBittorrent/issues/11759#issuecomment-596001851 A LOT of people are too lazy or unable to manually port forward and configure firewalls, so sadly UPnP is still needed for now.
Author
Owner

@FranciscoPombal commented on GitHub (Mar 8, 2020):

@arvidn

In the long run, I would like to remove support for UPnP, now that the world is moving towards PCP (which is a much more reasonable protocol).

It will take a looooong time before UPnP usage becomes insignificant enough to be ignored.

Would anyone be interested in giving this patch a try? It's simply restoring the 1 hour expirations of UPnP port maps. arvidn/libtorrent#4406

The patch is a good idea, but I still think exposing an option to set this to zero would be ideal, to also not leave the users with only shitty UPnP implementations at their disposal completely SOL

@FranciscoPombal commented on GitHub (Mar 8, 2020): @arvidn > In the long run, I would like to remove support for UPnP, now that the world is moving towards PCP (which is a much more reasonable protocol). It will take a looooong time before UPnP usage becomes insignificant enough to be ignored. > Would anyone be interested in giving this patch a try? It's simply restoring the 1 hour expirations of UPnP port maps. [arvidn/libtorrent#4406](https://github.com/arvidn/libtorrent/pull/4406) The patch is a good idea, but I still think exposing an option to set this to zero would be ideal, to also not leave the users with only shitty UPnP implementations at their disposal completely SOL
Author
Owner

@arvidn commented on GitHub (Mar 9, 2020):

If I understand correctly, the two opposing sides to my patch are:

  1. a router that doesn't support timed-lease mappings and also doesn't support reporting it
  2. routers that restart frequently and lose their permanent port maps

Since I have no idea which one is more common, it makes sense to have an escape hatch from whichever becomes the default. Not having it work automatically, though, probably means that most people affected by a bad router won't ever notice, let alone do something about it.

I don't want to hold up the 1.2.5 release by this. I will make this change for 1.2.6.

@arvidn commented on GitHub (Mar 9, 2020): If I understand correctly, the two opposing sides to my patch are: 1. a router that doesn't support timed-lease mappings and also doesn't support reporting it 2. routers that restart frequently and lose their permanent port maps Since I have no idea which one is more common, it makes sense to have an escape hatch from whichever becomes the default. Not having it work automatically, though, probably means that most people affected by a bad router won't ever notice, let alone do something about it. I don't want to hold up the 1.2.5 release by this. I will make this change for 1.2.6.
Author
Owner

@Seeker2 commented on GitHub (Mar 9, 2020):

UPnP mapping to the wrong port or ports still needs to be dealt with though, even if this issue temporarily goes untouched.

UPnP remapping ports probably shouldn't be done or even allowed faster than every 1-5 minutes, or it might cause bigger problems with a router's internal resource consumption (extra load on its weak CPU and limited ram).

Were there to be a default remapping of the port via UPnP, I'd recommend only once per day...with advanced option to change it.

If the router replies it's already forwarded (due to UPnP requests?) and/or incoming TCP connections continue to arrive, do not remap via UPnP.

uTP could be incoming due to STUN, so only if it can be determined that's not happening should it be used to indirectly determine if UPnP port-forward/firewall bypass is still working.

@Seeker2 commented on GitHub (Mar 9, 2020): UPnP mapping to the wrong port or ports still needs to be dealt with though, even if this issue temporarily goes untouched. UPnP remapping ports probably shouldn't be done or even allowed faster than every 1-5 minutes, or it might cause bigger problems with a router's internal resource consumption (extra load on its weak CPU and limited ram). Were there to be a default remapping of the port via UPnP, I'd recommend only once per day...with advanced option to change it. If the router replies it's already forwarded (due to UPnP requests?) and/or incoming TCP connections continue to arrive, do not remap via UPnP. uTP could be incoming due to STUN, so only if it can be determined that's not happening should it be used to indirectly determine if UPnP port-forward/firewall bypass is still working.
Author
Owner

@whoodini commented on GitHub (Mar 9, 2020):

@arvidn

In the long run, I would like to remove support for UPnP, now that the world is moving towards PCP (which is a much more reasonable protocol).

PCP (standardized in 2013, already 7+ years old) does not seem to be taking off too soon, maybe you will do a implementation of it in 10-15 years (if it does not die first or gets replaced by something else).

routers that restart frequently and lose their permanent port maps

Yes this is the most common cause.

Not having it work automatically, though, probably means that most people affected by a bad router won't ever notice, let alone do something about it.

I know the speeds that my qBittorrent should reach and whenever does not go as it is supposed to, I go and investigate. I do not know what kind of equipment you guys run but im confident that most of the users using qBittorrent have the default or SOHO comercial type and not the business kind.
Like I said im done with default or SOHO types, im now into business entry level type of equipment (Mikrotik) and im sure I wont be upgrading again.

@Seeker2

A LOT of people are too lazy or unable to manually port forward and configure firewalls, so sadly UPnP is still needed for now.

No, this is not my case (I do know how to do manual port forwarding), I would like to use UPnP and qBittorrent with the intention of having my port changed whenever the router reboots again, out of security concerns, do you know how difficult is to track fragmented traffic through different ports and IPs.

@FranciscoPombal

IMO the best approach would be:

Assume a reasonable UPnP implementation by default, and use periodic temporary leases.
Expose an option to disable them, for users that might run into problems due to this
Maybe also expose an option to configure the lease duration? Just for extra flexibility, some people might care about it.

I think the same.
Taking into account all the different router manufactures and their dodgy implementations, can qBittorrent use a service to check for port forwarding and report it back to user into UI?

PS As far as I understood, UPnP supports queries. You could query the router to check if it has opened the ports and if not, open them (maybe even check for lease duration). Link

@whoodini commented on GitHub (Mar 9, 2020): @arvidn > In the long run, I would like to remove support for UPnP, now that the world is moving towards PCP (which is a much more reasonable protocol). PCP (standardized in 2013, already 7+ years old) does not seem to be taking off too soon, maybe you will do a implementation of it in 10-15 years (if it does not die first or gets replaced by something else). > routers that restart frequently and lose their permanent port maps Yes this is the most common cause. > Not having it work automatically, though, probably means that most people affected by a bad router won't ever notice, let alone do something about it. I know the speeds that my qBittorrent should reach and whenever does not go as it is supposed to, I go and investigate. I do not know what kind of equipment you guys run but im confident that most of the users using qBittorrent have the default or SOHO comercial type and not the business kind. Like I said im done with default or SOHO types, im now into business entry level type of equipment (Mikrotik) and im sure I wont be upgrading again. @Seeker2 > A LOT of people are too lazy or unable to manually port forward and configure firewalls, so sadly UPnP is still needed for now. No, this is not my case (I do know how to do manual port forwarding), I would like to use UPnP and qBittorrent with the intention of having my port changed whenever the router reboots again, out of security concerns, do you know how difficult is to track fragmented traffic through different ports and IPs. @FranciscoPombal > IMO the best approach would be: > > Assume a reasonable UPnP implementation by default, and use periodic temporary leases. > Expose an option to disable them, for users that might run into problems due to this > Maybe also expose an option to configure the lease duration? Just for extra flexibility, some people might care about it. I think the same. Taking into account all the different router manufactures and their dodgy implementations, can qBittorrent use a service to check for port forwarding and report it back to user into UI? PS As far as I understood, UPnP supports queries. You could query the router to check if it has opened the ports and if not, open them (maybe even check for lease duration). [Link](https://www.electricmonk.nl/log/2016/07/05/exploring-upnp-with-python/)
Author
Owner

@arvidn commented on GitHub (Mar 9, 2020):

PCP (standardized in 2013, already 7+ years old) does not seem to be taking off too soon, maybe you will do a implementation of it in 10-15 years (if it does not die first or gets replaced by something else).

libtorrent has supported PCP since version 1.2.
My router supports it (granted, it's fairly new).
I would be surprised if PCP would die before UPnP. It's a much simpler protocol for both clients and servers, as a result, it works reliably.

@arvidn commented on GitHub (Mar 9, 2020): > PCP (standardized in 2013, already 7+ years old) does not seem to be taking off too soon, maybe you will do a implementation of it in 10-15 years (if it does not die first or gets replaced by something else). libtorrent has supported PCP since version 1.2. My router supports it (granted, it's fairly new). I would be surprised if PCP would die before UPnP. It's a *much* simpler protocol for both clients and servers, as a result, it works reliably.
Author
Owner

@whoodini commented on GitHub (Mar 9, 2020):

It seems it is true. UPnP supports queries and much more.
I think photos speak for themselves.
1  File explorer network
2  router properties
3  settings in general tab
4  edit of a rule

No worries, I have restarted the device after the screenshots were made. new dynamic wan IP, new dynamic lan IP, new dynamic port, as it should be.

I see no implementation of UPnP lease duration in windows or router, nor did I come across one before.

@whoodini commented on GitHub (Mar 9, 2020): It seems it is true. UPnP supports queries and much more. I think photos speak for themselves. ![1 File explorer network](https://user-images.githubusercontent.com/35895002/76266993-9474eb80-6269-11ea-8392-b34660672beb.JPG) ![2 router properties](https://user-images.githubusercontent.com/35895002/76266994-950d8200-6269-11ea-9f1e-b2314c81e016.JPG) ![3 settings in general tab](https://user-images.githubusercontent.com/35895002/76266996-950d8200-6269-11ea-9495-cf58da1cd3a5.JPG) ![4 edit of a rule](https://user-images.githubusercontent.com/35895002/76266997-95a61880-6269-11ea-884d-0d7a87ca3506.JPG) No worries, I have restarted the device after the screenshots were made. new dynamic wan IP, new dynamic lan IP, new dynamic port, as it should be. I see no implementation of UPnP lease duration in windows or router, nor did I come across one before.
Author
Owner

@arvidn commented on GitHub (Mar 9, 2020):

port maps with expiration times can be found here, search for NewLeaseDuration.

@arvidn commented on GitHub (Mar 9, 2020): port maps with expiration times can be found [here](https://upnp.org/specs/gw/UPnP-gw-WANIPConnection-v2-Service.pdf), search for `NewLeaseDuration`.
Author
Owner

@FranciscoPombal commented on GitHub (Mar 9, 2020):

If I understand correctly, the two opposing sides to my patch are:

1. a router that doesn't support timed-lease mappings and also doesn't support reporting it

2. routers that restart frequently and lose their permanent port maps

Since I have no idea which one is more common, it makes sense to have an escape hatch from whichever becomes the default. Not having it work automatically, though, probably means that most people affected by a bad router won't ever notice, let alone do something about it.

I don't want to hold up the 1.2.5 release by this. I will make this change for 1.2.6.

Yes this seems reasonable. IMO you should cater to the "good" implementations by default. As for the config change not happening automatically, for the users who have routers that don't support temporary leases: that's fine. It can simply be documented, even in the qBittorrent wiki FAQ for example:

"If you're having trouble with UPnP, it is possible your router is shitty and does not support temporary leases. In that case, disable them by selecting the xyz checkbox...."

@FranciscoPombal commented on GitHub (Mar 9, 2020): > If I understand correctly, the two opposing sides to my patch are: > > 1. a router that doesn't support timed-lease mappings and also doesn't support reporting it > > 2. routers that restart frequently and lose their permanent port maps > > > Since I have no idea which one is more common, it makes sense to have an escape hatch from whichever becomes the default. Not having it work automatically, though, probably means that most people affected by a bad router won't ever notice, let alone do something about it. > > I don't want to hold up the 1.2.5 release by this. I will make this change for 1.2.6. Yes this seems reasonable. IMO you should cater to the "good" implementations by default. As for the config change not happening automatically, for the users who have routers that don't support temporary leases: that's fine. It can simply be documented, even in the qBittorrent wiki FAQ for example: "If you're having trouble with UPnP, it is possible your router is shitty and does not support temporary leases. In that case, disable them by selecting the xyz checkbox...."
Author
Owner

@ghost commented on GitHub (Mar 9, 2020):

Why go for periodic leases? Why not just query the UPnP device and check if the port is forwarded or not every 5 mins?

@ghost commented on GitHub (Mar 9, 2020): Why go for periodic leases? Why not just query the UPnP device and check if the port is forwarded or not every 5 mins?
Author
Owner

@arvidn commented on GitHub (Mar 10, 2020):

Why go for periodic leases? Why not just query the UPnP device and check if the port is forwarded or not every 5 mins?

Because if your network breaks/your computer reboots/your client crashes/... the router will still remove the port map. It won't "leak".

@arvidn commented on GitHub (Mar 10, 2020): > Why go for periodic leases? Why not just query the UPnP device and check if the port is forwarded or not every 5 mins? Because if your network breaks/your computer reboots/your client crashes/... the router will still remove the port map. It won't "leak".
Author
Owner

@whoodini commented on GitHub (Mar 10, 2020):

The whole point of this issue is to query UPnP:

if no open ports, open new ports.
if there are opened ports BUT old ports, delete them.
if there are opened ports AND are the actual ports we need, keep moving these are not the ports you are looking for.

I found several UPnP "explorers", they can read UPnP scheme and request XML files.

@whoodini commented on GitHub (Mar 10, 2020): The whole point of this issue is to query UPnP: if no open ports, open new ports. if there are opened ports BUT old ports, delete them. if there are opened ports AND are the actual ports we need, keep moving these are not the ports you are looking for. I found several UPnP "explorers", they can read UPnP scheme and request XML files.
Author
Owner

@arvidn commented on GitHub (Mar 10, 2020):

The whole point of this issue is to query UPnP:

That's not my reading. That seems to be your suggestion of a solution. The problem is that some routers reboot and lose their port mappings sometimes.

If you think that solution is better than what @FranciscoPombal and I have proposed, please post your arguments. The cost of your solution is significant complexity and increased risk of bugs and maintenance burden, most likely falling on me (along with finding someone actually do the work of implementing it).

@arvidn commented on GitHub (Mar 10, 2020): > The whole point of this issue is to query UPnP: That's not my reading. That seems to be your suggestion of a solution. The *problem* is that some routers reboot and lose their port mappings sometimes. If you think that solution is better than what @FranciscoPombal and I have proposed, please post your arguments. The cost of your solution is significant complexity and increased risk of bugs and maintenance burden, most likely falling on me (along with finding someone actually do the work of implementing it).
Author
Owner

@FranciscoPombal commented on GitHub (Mar 10, 2020):

For now, and more specifically, for the current issue at hand, the proposed solution above will do. Seems like @whoodini's solution is more comprehensive, but at a much greater cost. Something like that can always be implemented in the future.

@FranciscoPombal commented on GitHub (Mar 10, 2020): For now, and more specifically, for the current issue at hand, the proposed solution above will do. Seems like @whoodini's solution is more comprehensive, but at a much greater cost. Something like that can always be implemented in the future.
Author
Owner

@arvidn commented on GitHub (Mar 11, 2020):

I've updated the PR. Please give it a try! https://github.com/arvidn/libtorrent/pull/4406

@arvidn commented on GitHub (Mar 11, 2020): I've updated the PR. Please give it a try! https://github.com/arvidn/libtorrent/pull/4406
Author
Owner

@NotTsunami commented on GitHub (Mar 15, 2020):

For those with issues, I have a PR up on the qBittorrent side that you can use to play with the value yourself, it currently inherits the new libtorrent default of 1 hour retains the previous default of permanent leases (duration set to 0). To test it prior to merge you will need to use the latest libtorrent RC_1_2 branch and change the libtorrent references in the PR to version 1.2.5 as libtorrent 1.2.6 has not been released yet.

@NotTsunami commented on GitHub (Mar 15, 2020): For those with issues, I have a PR up on the qBittorrent side that you can use to play with the value yourself, it ~~currently inherits the new libtorrent default of 1 hour~~ retains the previous default of permanent leases (duration set to 0). To test it prior to merge you will need to use the latest libtorrent RC_1_2 branch and change the libtorrent references in the PR to version 1.2.5 as libtorrent 1.2.6 has not been released yet.
Author
Owner

@FranciscoPombal commented on GitHub (Apr 4, 2020):

This has been fixed in 4.2.3, since this version now includes the libtorrent commit that changes the upnp default lease duration to 1 hour. Customization of the duration (including the possibility of disabling it, like previously) will come with the next release of qBIttorrent that ships with libtorrent 1.2.6 (most likely 4.2.4)

@FranciscoPombal commented on GitHub (Apr 4, 2020): This has been fixed in 4.2.3, since this version now includes the libtorrent commit that changes the upnp default lease duration to 1 hour. Customization of the duration (including the possibility of disabling it, like previously) will come with the next release of qBIttorrent that ships with libtorrent 1.2.6 (most likely 4.2.4)
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#9845
No description provided.