mIRC Home    About    Download    Register    News    Help

Print Thread
uPnP port bind not released #250548 21/01/15 01:49 AM
Joined: Dec 2002
Posts: 198
T
Talon Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 198
Apparently once a socklisten is started with the flag -p to request a uPnP port forward from your router, the bind is perminant. Even when you exit mIRC, and start it back up.

I attempted to close the socklisten with /sockclose <name>, and re-open it "without" the -p flag, yet the outside world is still allowed in. Upon closing the socket, the uPnP bind isn't released.

Code:
;== Request uPnP port forward socklisten
socklisten -p Name 80

;== Close the socket
sockclose Name

;== Listen again only locally this time no bind
socklisten Name 80


I stumbled upon this attempting to show a server I wrote to a couple of buddies. I thought if I closed the listener and re-opened it without -p they'd no longer be able to access it and I could continue working on it locally. No matter how many times I close the listener and re-open it, they were able to still connect. Also it remains if I exit and re-open mIRC and start the socklisten without -p, they're still able to connect once the socklistens opened again.

I haven't tried restarting windows yet to see if the bind dissapears (my IP from my router is static so if the port forward stays even a computer restart won't resolve it)

I'm not entirely sure this is a bug, I don't fully know how uPnP works, but I would assume it's possible to request, and cancel a bind.

Re: uPnP port bind not released [Re: Talon] #250553 21/01/15 09:45 AM
Joined: Dec 2002
Posts: 4,519
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,519
Thanks for your bug report. Unfortunately I have not been able to reproduce this issue so far. mIRC unsets UPnP ports automatically when a socket is closed.

In my tests, I monitor UPnP port usage through the router UPnP web page and through the PortForward UPnP utility.

/socklisten -p Name 80
-> adds UPnP port 80

/sockclose Name
-> removes UPnP port 80

If several /socklisten requests are created for the same port, eg:

/socklisten -p Name 80
/socklisten -p Name2 80
/socklisten -p Name3 80

Any /sockclose on one of the above sockets will remove UPnP port 80, which is the only potential issue I have found. mIRC should probably look through its entire list of open ports, across all features, to determine whether any other internal sockets are using that UPnP port, and leave it open if that is the case.

If you restart your computer, are you able to reproduce this issue? If not, it may be due to network/UPnP/router issues.

Update: After more testing, it looks like this could be down to intermittent network/UPnP/router issues. When using PortForward, every so often it will suddenly report that it is unable to monitor the UPnP settings on the router, even though it was able to a few moments ago. mIRC also reported this issue occasionally in the Ports dialog. It is difficult to say exactly why this is happening. UPnP has always been a bit unpredictable and a search through Google shows up a large number of UPnP issues. It may just be that it is not 100% reliable.

Re: uPnP port bind not released [Re: Khaled] #250567 21/01/15 09:02 PM
Joined: Dec 2002
Posts: 198
T
Talon Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 198
I've tried several "uPnP" programs like the one you posted above, I couldn't try that one because i'm not a member of codeproject so it won't let me download.

This turns out to be a windows issue apparently. I also have a laptop with windows and linux on it, I used my laptop in linux and the uPnP assign and release worked flawlessly.

On my main PC, none of the uPnP tools would even recognize my router to monitor and manage the uPnP mappings, but once I rebooted, I immediately tried the tools again, this time they worked. I also immediately tried to have it happen again on mIRC and now this time it's working flawlessly.

I'm unclear on how long Windows would need to run or what might be the culprit of uPnP breaking sometime during operation but you're right, it's definately not a mIRC issue. It's either my router, or Windows and my bet is Windows.

Thanks for your swift reply and vigorous attempts to reproduce this issue, sorry it was for nothing!

Re: uPnP port bind not released [Re: Talon] #250583 22/01/15 11:12 AM
Joined: Dec 2002
Posts: 4,519
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,519
I have been testing this out a little more and it looks like the cause of the intermittent behaviour may actually be my software firewall. If I disable it, the UPnP seems to work all the time. If I enable it, the UPnP sometimes works and other times does not. I cannot see anything in my firewall logs to indicate what is being blocked and as far as I can tell, the application rules for allowing UPnP connections are set correctly. In any case, I seem to have narrowed my UPnP issues down to the software firewall.