s2s no longer allows IPv4 outgoing connections when bound to ::

Bug #374687 reported by Mark Kamichoff
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Jabberd
Fix Released
Medium
Unassigned

Bug Description

Hi -

It looks like between jabberd 2.2.5 and 2.2.6 there was a change to s2s/main.c that checks the origin_ip for outgoing connections. Unfortunately, it seems that this has broken s2s's ability to bind to :: (via the ip tags in s2s.xml) and be able to connect to IPv4 addresses (via mapping from the kernel). One must now set the IP to 0.0.0.0 to connect to any IPv4 XMPP servers, but this prevents IPv6 connections. When :: is specified, the error in the logs is the following:

May 10 20:14:17 dax jabberd/s2s[98801]: dns lookup for gmail.com returned 2 results (ttl 1800)
May 10 20:14:17 dax jabberd/s2s[98801]: [-1] [209.85.163.125, port=5269] mio_connect error: Invalid argument (22)
May 10 20:14:17 dax jabberd/s2s[98801]: [-1] [209.85.201.125, port=5269] mio_connect error: Invalid argument (22)

The origin tags are commented out in my s2s.xml. I have removed the following on version 2.2.8, and s2s works correctly when bound to ::, once again:

--- main2.2.6.c 2009-02-09 07:15:57.000000000 -0500
+++ main2.2.5.c 2008-07-15 06:30:30.000000000 -0400
@@ -115,15 +115,7 @@

     s2s->packet_stats = config_get_one(s2s->config, "stats.packet", 0);

- /*
- * If no origin IP is specified, use local IP as the originating one:
- * it makes most sense, at least for SSL'ized connections.
- */
     s2s->local_ip = config_get_one(s2s->config, "local.ip", 0);
- s2s->origin_ip = config_get_one(s2s->config, "local.origin", 0);
- if(s2s->origin_ip == NULL && s2s->local_ip != NULL)
- s2s->origin_ip = s2s->local_ip;
-
     if(s2s->local_ip == NULL)
         s2s->local_ip = "0.0.0.0";

I'm not too versed in the rest of the code, but I don't believe this is expected behavior. Here is some information about my platform:

FreeBSD 7.0-RELEASE-p9 amd64 (with net.inet6.ip6.v6only=0)
jabberd-2.2.8 (FreeBSD port)
Host is dual-stacked with both IPv4 and IPv6 connectivity.

Please let me know if I'm completely off-base with this, or if you need more information.

Thanks!

- Mark

Revision history for this message
Tomasz Sterna (smoku) wrote :

Please try the following diff instead.

Changed in jabberd2:
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Mark Kamichoff (prox-prolixium) wrote :

Hi Tomasz -

Thanks for the patch. I applied it instead of the one I used, but it looks like I'm still getting invalid argument errors in the log file.

- Mark

Revision history for this message
Tomasz Sterna (smoku) wrote :

Could you please paste the local/ip and local/origin settings from your s2s.xml? I will try to reproduce it locally.

Revision history for this message
Mark Kamichoff (prox-prolixium) wrote :

Hi Tomasz -

Sure, here is the relevant part of my s2s.xml:

[...]
  <local>
    <!-- IP and port to listen for incoming s2s connections on
                                           (default: 0.0.0.0, 5269) -->
    <ip>::</ip>
    <port>5269</port>

    <!-- Multihomed machines (with more than one interface and IP address)
         need to specify outgoing S2S connections interface/address.
         If not set, the <ip> section address above is used. -->
    <!--
    <origin>1.2.3.4</origin>
    -->
[...]

Thanks!

- Mark

Revision history for this message
Norman Rasmussen (normanr) wrote :

what about a separate bind and origin ip for ipv4 and ipv6?

Revision history for this message
Mark Kamichoff (prox-prolixium) wrote : Re: [Bug 374687] Re: s2s no longer allows IPv4 outgoing connections when bound to ::

On Sun, Mar 07, 2010 at 04:33:04AM -0000, Norman Rasmussen wrote:
> what about a separate bind and origin ip for ipv4 and ipv6?

Probably not a bad idea, considering the push for the IPV6_V6ONLY socket
option being enabled by default in FreeBSD/Linux.

- Mark

--
Mark Kamichoff
<email address hidden>
http://www.prolixium.com/

Revision history for this message
Tomasz Sterna (smoku) wrote :

Fixed by a1cd4ba18b

Changed in jabberd2:
status: Incomplete → Fix Committed
Revision history for this message
Tomasz Sterna (smoku) wrote :

Fixed in 2.2.15

Changed in jabberd2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.