11 comments

  • OptionOfT5 minutes ago
    &gt; And asking for port 0 needs no privileges.<p>My brain has issues with this kind of form. It prevents me from reading words in a fifo manner. I now need to backtrack, because the &#x27;no&#x27; negates the word before.
  • fosco15 minutes ago
    [dupe] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=50399587">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=50399587</a>
  • afn4 hours ago
    <a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20261106234640&#x2F;https:&#x2F;&#x2F;acid.vegas&#x2F;blog&#x2F;the-port-that-does-not-exist&#x2F;" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20261106234640&#x2F;https:&#x2F;&#x2F;acid.vega...</a>
  • greggsy4 hours ago
    I saw the URL and immediately thought it was about Acid Pro DAW or Vegas video editor is used to use back in the early 00’s.
  • 99harry2 hours ago
    Sometimes I have scripts that automatically assign ports starting from 30000. How would that work? Would I have to bind to port 0 multiple times until I randomly get a port in that range?
    • _flux36 minutes ago
      I&#x27;m not quite sure what a script assigning ports actually does, but if I need an app to bind a port in some port range, I just start binding ports starting from 30000 until it succeeds.<p>If it&#x27;s in a script then that might be difficult, but a racy approximation could be to loop e.g. listening socat with different ports for finding the free port. (Or maybe: parse output of ss.) But if the port use is separate from the port binding, then it might still be busy once the time to rebind it comes.
    • 0bytes1 hour ago
      I’m not exactly sure if that’s the question, but the range can be set. Here’s the Linux solution: <a href="https:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;solrhe&#x2F;Securing-Optimizing-Linux-RH-Edition-v1.3&#x2F;chap6sec70.html" rel="nofollow">https:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;solrhe&#x2F;Securing-Optimizing-Linux-RH-Edi...</a> FreeBSD has net.inet.ip.portrange
      • 99harry52 minutes ago
        That might not quite fit my use case. My AI-generated scripts probably won&#x27;t modify system-level configuration files to change the port range
        • Zambyte22 minutes ago
          ... do you not have a say in the matter?
  • embedding-shape4 hours ago
    I&#x27;m not sure how I&#x27;d do acceptance&#x2F;E2E testing without the magic of port 0. As long as you have a way of capturing what port it ended up using (which most languages are able to out of the box more or less), parallelizing testing workloads becomes such a breeze without having to manage ports and all that jazz, just fire everything up with N parallism and let the OS figure out what the free ports are, pass the references down and stuff just works. Thanks Linux :)
    • wolrah40 minutes ago
      &gt; I&#x27;m not sure how I&#x27;d do acceptance&#x2F;E2E testing without the magic of port 0.<p>Same as anything else, an explicit flag to achieve the same &quot;just give me a port&quot; functionality as this &quot;magic number&quot; does without resulting in the documented unpredictable behavior around a technically legitimate port number.<p>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.
      • embedding-shape15 minutes ago
        &gt; Same as anything else<p>Yeah, obviously I&#x27;m a programmer so I&#x27;m well aware it&#x27;s technically possible, it was a bit of an exaggeration to explain how much value I feel I get from it.<p>&gt; most if not all of the services exposed on port 0 seem to be accidental<p>No program actually end up &quot;exposed on port 0&quot;, if it&#x27;s not supported it won&#x27;t be able to create a listener on that port, AFAIK. Most yeah, all no. P2P software commonly leverage port 0, and other &quot;discover&lt;&gt;connect&quot; types of software. But I&#x27;d agree that it&#x27;s most likely accidental if outside of those niches.
    • Joker_vD1 hour ago
      And then there is OpenSSH...<p><pre><code> joker@joker:~$ ssh localhost -D 127.0.0.1:0 Bad dynamic forwarding specification &#x27;127.0.0.1:0&#x27; 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 &#x27;127.0.0.1:0:localhost:8080&#x27; joker@joker:~$ ssh localhost -L 127.0.0.1:9999:localhost:8080 ssh: connect to host localhost port 22: Connection refused </code></pre> Oh well.
  • justsomehnguy29 minutes ago
    I have a feeling what sometimes :0 is interpreted as a &#x27;first listening&#x27;. But Occam says what most of the time it&#x27;s just &#x27;DNAT dst port ANY to :80&#x27; or whatever, no magik.
  • skinfaxi5 hours ago
    Seems hugged?
  • alexkampler1 hour ago
    [flagged]
  • wrayjustin2 hours ago
    [dead]
  • routernat_tools4 hours ago
    [flagged]