News for hackers. Stuff that matters.
Re:Port 0: The Port That Does Not Exist by embedding-shape on Saturday November 07, 2026 @06:54AM (#50403755)
[delayed]
Re:Port 0: The Port That Does Not Exist by Joker_vD on Saturday November 07, 2026 @09:38AM (#50404931)
And then there is OpenSSH...

    joker@joker:~$ ssh localhost -D 127.0.0.1:0
    Bad dynamic forwarding specification '127.0.0.1:0'
    joker@joker:~$ ssh localhost -D 127.0.0.1:9999
    ssh: connect to host localhost port 22: Connection refused
    joker@joker:~$ ssh localhost -L 127.0.0.1:0:localhost:8080
    Bad local forwarding specification '127.0.0.1:0:localhost:8080'
    joker@joker:~$ ssh localhost -L 127.0.0.1:9999:localhost:8080
    ssh: connect to host localhost port 22: Connection refused
Oh well.
Re:Port 0: The Port That Does Not Exist by wolrah on Saturday November 07, 2026 @10:25AM (#50405338)
> I'm not sure how I'd do acceptance/E2E testing without the magic of port 0.

Same as anything else, an explicit flag to achieve the same "just give me a port" functionality as this "magic number" does without resulting in the documented unpredictable behavior around a technically legitimate port number.

As the article points out, most if not all of the services exposed on port 0 seem to be accidental and likely resulted from people assuming this magic behavior applies everywhere instead of just to one specific API.

Re:Port 0: The Port That Does Not Exist by embedding-shape on Saturday November 07, 2026 @10:50AM (#50405544)
> Same as anything else

Yeah, obviously I'm a programmer so I'm well aware it's technically possible, it was a bit of an exaggeration to explain how much value I feel I get from it.

> most if not all of the services exposed on port 0 seem to be accidental

No program actually end up "exposed on port 0", if it's not supported it won't be able to create a listener on that port, AFAIK. Most yeah, all no. P2P software commonly leverage port 0, and other "discover<>connect" types of software. But I'd agree that it's most likely accidental if outside of those niches.

Re:Port 0: The Port That Does Not Exist by wolrah on Saturday November 07, 2026 @12:29PM (#50406308)
> No program actually end up "exposed on port 0"

Clearly you didn't read the article, plenty of stuff is in fact exposed on actual port 0 because it's a real thing and not just a way to get whatever ephemeral port like you're using.