SHA256
1
0
forked from pool/csync2

Accepting request 176004 from network:ha-clustering:Factory

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/176004
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/csync2?expand=0&rev=14
This commit is contained in:
Stephan Kulow 2013-05-27 07:43:45 +00:00 committed by Git OBS Bridge
commit 66b574a361
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,38 @@
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;

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri May 10 12:56:38 UTC 2013 - tserong@suse.com
- 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
-------------------------------------------------------------------
Thu Feb 28 06:00:00 UTC 2013 - coolo@suse.com

View File

@ -34,6 +34,7 @@ Patch2: csync2-1.34-pure-gnutls-r2.patch
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 @@ and server farms.
%patch2 -p1
%endif
%patch3 -p1
%patch4 -p1
install -p -m 644 %{SOURCE1} README.quickstart
%build