aboutsummaryrefslogtreecommitdiff
path: root/sbin/hastd/proto_socketpair.c
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2011-03-21 08:54:59 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2011-03-21 08:54:59 +0000
commit0b626a289e9814fa1f14ea32280410521fc43224 (patch)
treec174097a26c9fb50392210eb339837c6cf4e95d9 /sbin/hastd/proto_socketpair.c
parent1884f6bbf3f0aa458619b83d8ff555561ff65a2d (diff)
downloadsrc-0b626a289e9814fa1f14ea32280410521fc43224.tar.gz
src-0b626a289e9814fa1f14ea32280410521fc43224.zip
In hast.conf we define the other node's address in 'remote' variable.
This way we know how to connect to secondary node when we are primary. The same variable is used by the secondary node - it only accepts connections from the address stored in 'remote' variable. In cluster configurations it is common that each node has its individual IP address and there is one addtional shared IP address which is assigned to primary node. It seems it is possible that if the shared IP address is from the same network as the individual IP address it might be choosen by the kernel as a source address for connection with the secondary node. Such connection will be rejected by secondary, as it doesn't come from primary node individual IP. Add 'source' variable that allows to specify source IP address we want to bind to before connecting to the secondary node. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=219818
Diffstat (limited to 'sbin/hastd/proto_socketpair.c')
-rw-r--r--sbin/hastd/proto_socketpair.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/hastd/proto_socketpair.c b/sbin/hastd/proto_socketpair.c
index d681493a8663..74034d7d998a 100644
--- a/sbin/hastd/proto_socketpair.c
+++ b/sbin/hastd/proto_socketpair.c
@@ -57,14 +57,16 @@ struct sp_ctx {
static void sp_close(void *ctx);
static int
-sp_client(const char *addr, void **ctxp)
+sp_client(const char *srcaddr, const char *dstaddr, void **ctxp)
{
struct sp_ctx *spctx;
int ret;
- if (strcmp(addr, "socketpair://") != 0)
+ if (strcmp(dstaddr, "socketpair://") != 0)
return (-1);
+ PJDLOG_ASSERT(srcaddr == NULL);
+
spctx = malloc(sizeof(*spctx));
if (spctx == NULL)
return (errno);