Hello community,

here is the log from the commit of package csync2 for openSUSE:Factory checked 
in at 2013-05-27 09:43:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/csync2 (Old)
 and      /work/SRC/openSUSE:Factory/.csync2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "csync2"

Changes:
--------
--- /work/SRC/openSUSE:Factory/csync2/csync2.changes    2013-03-01 
07:17:04.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.csync2.new/csync2.changes       2013-05-27 
09:43:46.000000000 +0200
@@ -1,0 +2,7 @@
+Fri May 10 12:56:38 UTC 2013 - [email protected]
+
+- Try to bind to "local" IP explicitly to avoid "identification failed"
+  errors with multiple IPs on same subnet (bnc#757327)
+  + Added bind-to-local-hostname.patch
+
+-------------------------------------------------------------------

New:
----
  bind-to-local-hostname.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ csync2.spec ++++++
--- /var/tmp/diff_new_pack.qhGDN1/_old  2013-05-27 09:43:47.000000000 +0200
+++ /var/tmp/diff_new_pack.qhGDN1/_new  2013-05-27 09:43:47.000000000 +0200
@@ -34,6 +34,7 @@
 BuildRequires:  pkg-config
 %endif
 Patch3:         force-debug-stderr-off-inetd.patch
+Patch4:         bind-to-local-hostname.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires(post): openssl 
 Requires:       gnutls
@@ -68,6 +69,7 @@
 %patch2 -p1
 %endif
 %patch3 -p1
+%patch4 -p1
 install -p -m 644 %{SOURCE1} README.quickstart
 
 %build

++++++ bind-to-local-hostname.patch ++++++
Index: csync2-1.34/conn.c
===================================================================
--- csync2-1.34.orig/conn.c
+++ csync2-1.34/conn.c
@@ -50,7 +50,9 @@ SSL *conn_ssl;
 int conn_open(const char *peername)
 {
         struct sockaddr_in sin;
+       struct sockaddr_in sme;
         struct hostent *hp;
+       struct hostent *me;
        int on = 1;
 
         hp = gethostbyname(peername);
@@ -69,6 +71,23 @@ int conn_open(const char *peername)
         bcopy(hp->h_addr, &sin.sin_addr, hp->h_length);
         sin.sin_port = htons(csync_port);
 
+       /* Try to bind to IP address of local hostname, else in cases where
+        * there's multiple local IPs on the same subnet, we might autobind
+        * to the wrong one, and the remote csync2 instance will fail because
+        * it verifies the expected hostname against the initiating IP.
+        * If the explicit bind fails for some reason though, we'll still
+        * try to connect (it might work, and it can't hurt...).
+        */
+       me = gethostbyname(myhostname);
+       if (me) {
+               sme.sin_family = me->h_addrtype;
+               bcopy(me->h_addr, &sme.sin_addr, me->h_length);
+               sme.sin_port = 0; /* random port */
+               if (bind(conn_fd_in, (struct sockaddr *)&sme, sizeof(sme)) < 0) 
{
+                       csync_debug(1, "Can't bind local socket (attempting 
connect anyway).\n");
+               }
+       }
+
         if (connect(conn_fd_in, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
                 csync_debug(1, "Can't connect to remote host.\n");
                close(conn_fd_in); conn_fd_in = -1;
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to