Commit f1a6f780 authored by Matt Stancliff's avatar Matt Stancliff Committed by antirez
Browse files

Networking: add more outbound IP binding fixes

Same as the original bind fixes (we just missed these the
first time around).

This helps Redis not automatically send
connections from the first IP on an interface if we are bound
to a specific IP address (e.g. with multiple IP aliases on one
interface, you want to send from _your_ IP, not from the first IP
on the interface).
parent e8f7899a
......@@ -4307,8 +4307,8 @@ int migrateGetSocket(redisClient *c, robj *host, robj *port, long timeout) {
}
/* Create the socket */
fd = anetTcpNonBlockConnect(server.neterr,c->argv[1]->ptr,
atoi(c->argv[2]->ptr));
fd = anetTcpNonBlockBindConnect(server.neterr,c->argv[1]->ptr,
atoi(c->argv[2]->ptr),REDIS_BIND_ADDR);
if (fd == -1) {
sdsfree(name);
addReplyErrorFormat(c,"Can't connect to target node: %s",
......
......@@ -1357,7 +1357,8 @@ error:
int connectWithMaster(void) {
int fd;
fd = anetTcpNonBlockConnect(NULL,server.masterhost,server.masterport);
fd = anetTcpNonBlockBindConnect(NULL,
server.masterhost,server.masterport,REDIS_BIND_ADDR);
if (fd == -1) {
redisLog(REDIS_WARNING,"Unable to connect to MASTER: %s",
strerror(errno));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment