<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sat Jan 11 07:27:31 UTC 2025

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Mojang Studios Jira</title>
    <link>https://bugs.mojang.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en</language>    <build-info>
        <version>9.12.2</version>
        <build-number>9120002</build-number>
        <build-date>10-01-2024</build-date>
    </build-info>


<item>
            <title>[BDS-3989] Default server port is used even if another port is defined</title>
                <link>https://bugs.mojang.com/browse/BDS-3989</link>
                <project id="11700" key="BDS">Bedrock Dedicated Server</project>
                    <description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br/&gt;
 When non-standard ports are available, BDS will use the standard ports as the &quot;additional&quot; automatic ports (&lt;a href=&quot;https://bugs.mojang.com/browse/BDS-1094&quot; title=&quot;Additional IPv4 and IPv6 port opening upon starting server&quot; class=&quot;issue-link&quot; data-issue-key=&quot;BDS-1094&quot;&gt;&lt;del&gt;BDS-1094&lt;/del&gt;&lt;/a&gt;) rather than ones from the normal random range.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Steps to Reproduce:&lt;/b&gt;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Modify server-port and server-portv6 to 19131 and 19134 respectively&lt;/li&gt;
	&lt;li&gt;Start server&lt;/li&gt;
	&lt;li&gt;Note that the additional open ports are 19132 and 19133 rather than from the usual random range&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;b&gt;What I expected to happen:&lt;/b&gt;&lt;br/&gt;
 The additional ports should be from a higher, unused range&lt;/p&gt;

&lt;p&gt;&lt;b&gt;How this impacts server owners:&lt;/b&gt;&lt;br/&gt;
 If you have 2 servers, one that is configured to run on 19132 and 19133 (BDS A) and another to run on 19134 and 19135 (BDS B). If when starting the server, BDS B starts before BDS A it will consume 19132 and 33 as its random ports preventing BDS A from starting (due to ports being in use)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Original description moved to &lt;a href=&quot;https://bugs.mojang.com/browse/BDS-3989?focusedCommentId=709035&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-709035&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;comments&lt;/a&gt; for clarity&lt;/em&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="254365">BDS-3989</key>
            <summary>Default server port is used even if another port is defined</summary>
                <type id="1" iconUrl="https://bugs.mojang.com/secure/viewavatar?size=xsmall&amp;avatarId=18903&amp;avatarType=issuetype">Bug</type>
                                    <status id="5" iconUrl="https://bugs.mojang.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="Jahus">Jahus</reporter>
                        <labels>
                    </labels>
                <created>Mon, 5 Aug 2019 18:27:57 +0200</created>
                <updated>Wed, 20 Dec 2023 14:13:38 +0100</updated>
                            <resolved>Fri, 7 Jul 2023 14:19:13 +0200</resolved>
                                    <version>1.14.32.1</version>
                    <version>1.14.60</version>
                    <version>1.16.0</version>
                    <version>1.16.40</version>
                                    <fixVersion>1.20.1 Hotfix</fixVersion>
                                            <votes>51</votes>
                                    <watches>22</watches>
                                                                            <comments>
                            <comment id="1296504" author="JIRAUSER573203" created="Wed, 20 Dec 2023 14:05:25 +0100"  >&lt;p&gt;This issue is still a problem and causes severe issues when running multiple servers on the same machine. If BDS finds the default port open it will automatically bind to that port, however, when people try to connect to that port, it will show that the server is popular which makes no sense.&lt;/p&gt;

&lt;p&gt;This is a serious issue and needs to be fixed, its a shame this has been open for as long as it has.&lt;/p&gt;

&lt;p&gt;EDIT:&lt;/p&gt;

&lt;p&gt;Set `enable-lan-visibility=false` in `server.properties`.&lt;/p&gt;</comment>
                            <comment id="1264066" author="jahus" created="Sun, 18 Jun 2023 17:17:53 +0200"  >&lt;p&gt;@Kai, do you confirm that the port is not used if the new option is toggled?&lt;/p&gt;</comment>
                            <comment id="1263899" author="JIRAUSER559342" created="Sat, 17 Jun 2023 21:30:51 +0200"  >&lt;p&gt;@Mods, I guess this issue can be closed as there is now the option to turn the default port discovery on and off since 1.19.50 (See &lt;a href=&quot;https://bugs.mojang.com/browse/BDS-1094&quot; title=&quot;Additional IPv4 and IPv6 port opening upon starting server&quot; class=&quot;issue-link&quot; data-issue-key=&quot;BDS-1094&quot;&gt;&lt;del&gt;BDS-1094&lt;/del&gt;&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="1163361" author="JIRAUSER559342" created="Thu, 12 May 2022 23:17:28 +0200"  >&lt;p&gt;As @Thomas Walker said, my guess is that these ports are used for auto-discovery.&lt;/p&gt;

&lt;p&gt;For security reasons I sincerely think, that server admins of small / family- / church- / school-servers should be able to deactivate the auto-discovery for publicly accessible IPs through server.properties.&lt;/p&gt;

&lt;p&gt;I dunno, @Mojang, if you really think auto-discovery should stay non-deactivatable and thus us being unable to run multiple worlds on one machine, could we please get a &quot;won&apos;t fix&quot; on this issue so that people stop reporting and checkin on this issue every so often?&lt;/p&gt;

&lt;p&gt;Thx!&lt;/p&gt;

&lt;p&gt;K&lt;/p&gt;</comment>
                            <comment id="1152407" author="owlfalls35" created="Thu, 7 Apr 2022 21:48:57 +0200"  >&lt;p&gt;This is also annoying because it means that friends can&apos;t join a single-player world even if the server is on a different port.&lt;/p&gt;</comment>
                            <comment id="979611" author="JIRAUSER638023" created="Sun, 25 Apr 2021 05:37:59 +0200"  >&lt;p&gt;I recently came across this bug and am similarly frustrated with how long this has been open.&#160; It looks like Mojang is opening those for &quot;auto-discovery&quot; to work but if you don&apos;t care about that, this is seriously annoying.&lt;/p&gt;

&lt;p&gt;For those using Linux, I do have a quick, exceedingly ugly hack to work around this though.&#160; This is, admittedly, hideous.&#160; But it works!&lt;/p&gt;

&lt;p&gt;tldr, this hooks calls to glibc bind() and, if the requested port is 19132 or 19133, redirects it into the ephemeral range (typically&#160;32768-61000) where they won&apos;t get in the way of anything.&#160; Yes, it would be much cleaner to simply not open them at all, but this is simply transparent to bedrock_server (it just thinks it opened the ports and nobody is connecting to them).&lt;/p&gt;

&lt;p&gt;Working happily with multiple bedrock_server instances on one system (obviously no auto-discovery) and using BedrockConnect (which uses the default ports).&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;/*
 * An incredibly ugly hack to hook bedrock_server&apos;s
 * superfluous bind to the default ports (19132 and 19133)
 * and redirect them out of the way into the ephemeral range
 *
 * Instructions:
 * Save this file as bindhook.c in the same dir as bedrock_server
 * compile with `gcc -o libhook.so -shared -fPIC -ldl bindhook.c`
 * run with `LD_PRELOAD=./libhook.so ./bedrock_server`
 */

#define _GNU_SOURCE
#include &amp;lt;dlfcn.h&amp;gt;
#include &amp;lt;sys/socket.h&amp;gt;
#include &amp;lt;netinet/in.h&amp;gt;
#include &amp;lt;stddef.h&amp;gt;

int bind (int fd, const struct sockaddr *sk, socklen_t sl) {
    static int (*real_bind)(int, const struct sockaddr *, socklen_t) = NULL;
    static struct sockaddr_in *sk_in;
    uint16_t port;

    if (!real_bind)
        real_bind = dlsym(RTLD_NEXT, &quot;bind&quot;);
    // AF_INET or AF_INET6, sin_port is in the same place
    sk_in = (struct sockaddr_in *) sk;
    port = ntohs(sk_in-&amp;gt;sin_port);
    if ((port == 19132) || (port == 19133))
        sk_in-&amp;gt;sin_port = htons(0);
    return real_bind(fd, sk, sl);
}
 &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This should theoretically be possible on Windows as well using DLL injection and API hooks, but it is much more involved than a simple call to dlsym() and I haven&apos;t really worked on Windows for 20+ years at this point.&lt;/p&gt;</comment>
                            <comment id="949786" author="JIRAUSER559342" created="Sat, 20 Mar 2021 18:07:11 +0100"  >&lt;p&gt;&#160;I bet you know what I was gonna comment, still affects 1.16.210.06.&lt;/p&gt;</comment>
                            <comment id="908293" author="JIRAUSER602532" created="Sat, 30 Jan 2021 13:15:19 +0100"  >&lt;p&gt;As it really is a problem to navigate around, it should be fixed at last.&lt;/p&gt;</comment>
                            <comment id="906386" author="pjprijs" created="Thu, 28 Jan 2021 11:38:47 +0100"  >&lt;p&gt;Can confirm this also happening with windows version 1.16.201.2 on Windows 10.&lt;/p&gt;

&lt;p&gt;It is a real PITA since if my default server crashes, and my secondary server restarts, it takes up the default port.&lt;/p&gt;

&lt;p&gt;Took me a while the first time to figure out why the default port was already in use...&lt;/p&gt;</comment>
                            <comment id="867111" author="omkhar" created="Sat, 19 Dec 2020 16:29:43 +0100"  >&lt;p&gt;I can confirm this issue on multiple versions of the Bedrock Linux server I&#8217;ve tried through 2020. I have resorted to rather hacky work arounds. The network code for the Linux port appears quite defective. Why isn&#8217;t this being prioritized or addressed?&lt;/p&gt;</comment>
                            <comment id="863731" author="JIRAUSER559342" created="Tue, 15 Dec 2020 22:59:00 +0100"  >&lt;p&gt;This issue still persists in 1.16.201 as of December 15th, 2020 and has also been in 1.16.100 and 1.16.200 (if affected versions shall be updated)&lt;/p&gt;

&lt;p&gt;@&lt;a href=&quot;https://bugs.mojang.com/secure/ViewProfile.jspa?name=OcelotOnesie&quot; class=&quot;user-hover&quot; rel=&quot;OcelotOnesie&quot;&gt;OcelotOnesie&lt;/a&gt;, is there any chance for this Bug to be fixed any time soon? As a Linux bedrock server user with multiple different worlds for different groups it&apos;s a real pain in the backside to have only one server running at any given time.&lt;/p&gt;

&lt;p&gt;Thank you for updating us!&lt;/p&gt;

&lt;p&gt;Kai&lt;/p&gt;</comment>
                            <comment id="763608" author="JIRAUSER525991" created="Mon, 13 Jul 2020 21:56:37 +0200"  >&lt;p&gt;This is confirmed in 1.16.1.&lt;/p&gt;</comment>
                            <comment id="741674" author="JIRAUSER511433" created="Wed, 24 Jun 2020 10:55:11 +0200"  >&lt;p&gt;I can confirm the issue in 1.16 as well&lt;/p&gt;</comment>
                            <comment id="709035" author="ionicecko" created="Wed, 27 May 2020 10:49:43 +0200"  >&lt;p&gt;&lt;b&gt;Original Description by &lt;a href=&quot;https://bugs.mojang.com/secure/ViewProfile.jspa?name=Jahus&quot; class=&quot;user-hover&quot; rel=&quot;Jahus&quot;&gt;Jahus&lt;/a&gt;:&lt;/b&gt;&lt;br/&gt;
From &lt;tt&gt;server.properties&lt;/tt&gt;:&lt;/p&gt;

&lt;p&gt;server-port=19131&lt;br/&gt;
server-portv6=19134&lt;/p&gt;

&lt;p&gt;When server is ran:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&#8230; }}{{INFO] IPv4 supported, port: 19131&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] IPv6 supported, port: 19134&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] IPv4 supported, port: 19132&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] IPv6 supported, port: 19133&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] Server started.&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the server ran on defined ports, but also on default ones.&lt;/p&gt;

&lt;p&gt;It looks like the server always runs 2 other ports after running on the ones defined in &lt;tt&gt;server.properties&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;In instance, if you set default ports in &lt;tt&gt;server.properties&lt;/tt&gt;, the server adds two random ports.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&#8230; }}{{INFO] IPv4 supported, port: 19131&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] IPv6 supported, port: 19134&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] IPv4 supported, port: 42484&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] IPv6 supported, port: 54985&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] Server started.&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;I don&apos;t see why it should do such a thing. Especially that if the ports are random, we can&apos;t create a proper firewall rule for them.&lt;/p&gt;

&lt;p&gt;Finally, I want to point out that this behavior is new and wasn&apos;t present in &lt;tt&gt;1.11.2.1&lt;/tt&gt;. Here is a typical output from the latter:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&#8230; }}{{INFO] IPv4 supported, port: 19131&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] IPv6 supported, port: 19134&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#8230; }}{{INFO] Server started.&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;This issue is preventing me from launching 2 servers as services; one on default ports (needed) and another on other ports because the one that doesn&apos;t use default port may occupy default ports if ran first. This would make the other server unable to run because the ports are already in use.&lt;/p&gt;</comment>
                            <comment id="625730" author="ashermaximum@gmail.com" created="Sun, 19 Jan 2020 08:02:35 +0100"  >&lt;p&gt;I am having this issue in 1.14 as well. If I start the server on 19132 first, starting the one on 19134 doesn&apos;t try to use 19132, however, the server is not able to be connected to.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10102">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="310604">BDS-4552</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="311720">BDS-4620</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="386134">BDS-9819</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10103">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="249803">BDS-1094</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_11500" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>ADO</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>359891</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10500" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Confirmation Status</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10303"><![CDATA[Confirmed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_11700" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_11100" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Linked</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_11300" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>Operating System Version</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Ubuntu 18.04.2 LTS</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_11600" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i11snz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>