ejabberd development
  1. ejabberd development
  2. EJAB-389

Impossible to bind the same port to multiple interfaces

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: ejabberd 2.1.0
    • Component/s: Config
    • Labels:
      None

      Description

      There is a problem with ejabberd_listener, which can be considered a bug: it uses the Port number as identifier, so an ejabberd server can only have 1 listener with a given port number.

      This limitation does not exist in TCP/IP: in the same machine, the same port can be listened in different addresses.

      ejabberd should allow several listeners with the same port: the administrator will bind them to different IP addresses.
      Each listener may have also different options (shapers, IPv4/IPv6...)

      Alexey already expressed interested in solving this issue eventually.

      This bug was previously reported in Bugzilla:
      http://www.jabber.ru/bugzilla/show_bug.cgi?id=273
      The reporter included a small patch, but it may raise problems to stop or restart listeners (which is possible using ejabberd Web Admin), so I doubt the patch is acceptable for ejabberd without major testing and/or rewritting.

      Adding this feature will also allow to listen IPv4 and IPv6 in the same port. Mentioned in:
      http://www.ejabberd.im/node/1003

      1. 389-portdef.diff
        34 kB
        Badlop
      2. 389-portdef.diff
        31 kB
        Badlop
      3. 389-portdef.diff
        31 kB
        Badlop
      4. 389-portdef.diff
        6 kB
        Badlop
      5. ejabberd_listener.patch
        4 kB
        Fabrice Colliot

        Issue Links

          Activity

          Hide
          Michael Grigutsch
          added a comment -

          t's the same problem (even with or without IPv6):

          • machine has three IPs, e.g. 12.34.45.1, 12.34.45.2 and 12.34.45.3.
          • ejabberd should only listen on the IPs 12.34.45.1 and 12.34.45.3, each using the ports 5222 and 5269,
            but not on the IP 12.34.45.2
            This is not possible due to this bug, as you cannot bind the ports to differend IPs simultaneously.
          Show
          Michael Grigutsch
          added a comment - t's the same problem (even with or without IPv6): machine has three IPs, e.g. 12.34.45.1, 12.34.45.2 and 12.34.45.3. ejabberd should only listen on the IPs 12.34.45.1 and 12.34.45.3, each using the ports 5222 and 5269, but not on the IP 12.34.45.2 This is not possible due to this bug, as you cannot bind the ports to differend IPs simultaneously.
          Hide
          Badlop
          added a comment -

          This is an improvement over the original patch. There is some basic documentation of how to use the new feature at the beginning of the patch.

          Show
          Badlop
          added a comment - This is an improvement over the original patch. There is some basic documentation of how to use the new feature at the beginning of the patch.
          Hide
          Badlop
          added a comment -

          This patch is based in Fabrice Colliot and Sergei Golovan previous proposals, and extends them.

          Compared to ejabberd 2.0.x, this patch proposes a different way to specify IP address and IP version: using the tuple {{PortNumber, IPAddress}, Module, Opts}

          The simple syntax

          {PortNumber, Module, Opts}

          is still supported. In this case Opts can include inet6 and

          {ip, tuple()}

          .

          This patch also adds some checks for valid port definition when starting ejabberd and when adding/restarting a port using WebAdmin. Those tests may not detect all the possible problems.

          Includes detailed documentation for the Guide and some brief EDoc.

          If you test this patch, your feedback is welcomed

          Show
          Badlop
          added a comment - This patch is based in Fabrice Colliot and Sergei Golovan previous proposals, and extends them. Compared to ejabberd 2.0.x, this patch proposes a different way to specify IP address and IP version: using the tuple {{PortNumber, IPAddress}, Module, Opts} The simple syntax {PortNumber, Module, Opts} is still supported. In this case Opts can include inet6 and {ip, tuple()} . This patch also adds some checks for valid port definition when starting ejabberd and when adding/restarting a port using WebAdmin. Those tests may not detect all the possible problems. Includes detailed documentation for the Guide and some brief EDoc. If you test this patch, your feedback is welcomed
          Hide
          Badlop
          added a comment -

          The previous patch called to lists:keytake/3 that is available only in recent OTP R12B.

          This updated patch does not require R12B.

          Show
          Badlop
          added a comment - The previous patch called to lists:keytake/3 that is available only in recent OTP R12B. This updated patch does not require R12B.
          Hide
          Badlop
          added a comment -

          An improved version of the patch reported in this ticket was committed to ejabberd trunk SVN r1812.

          Show
          Badlop
          added a comment - An improved version of the patch reported in this ticket was committed to ejabberd trunk SVN r1812.

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 14 weeks, 4 days ago

                Issue deployment