Skip to content

Commit

Permalink
[PATCH] ocfs2: added source addr to bind() in o2net_start_connect()
Browse files Browse the repository at this point in the history
to prevent confusion when a virtual ip is created on the same interface

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
  • Loading branch information
Sunil Mushran authored and Mark Fasheh committed Mar 1, 2006
1 parent 110ba90 commit b7668c7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fs/ocfs2/cluster/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ static void o2net_start_connect(void *arg)
{
struct o2net_node *nn = arg;
struct o2net_sock_container *sc = NULL;
struct o2nm_node *node = NULL;
struct o2nm_node *node = NULL, *mynode = NULL;
struct socket *sock = NULL;
struct sockaddr_in myaddr = {0, }, remoteaddr = {0, };
int ret = 0;
Expand All @@ -1334,6 +1334,12 @@ static void o2net_start_connect(void *arg)
goto out;
}

mynode = o2nm_get_node_by_num(o2nm_this_node());
if (mynode == NULL) {
ret = 0;
goto out;
}

spin_lock(&nn->nn_lock);
/* see if we already have one pending or have given up */
if (nn->nn_sc || nn->nn_persistent_error)
Expand Down Expand Up @@ -1361,12 +1367,14 @@ static void o2net_start_connect(void *arg)
sock->sk->sk_allocation = GFP_ATOMIC;

myaddr.sin_family = AF_INET;
myaddr.sin_addr.s_addr = (__force u32)mynode->nd_ipv4_address;
myaddr.sin_port = (__force u16)htons(0); /* any port */

ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
sizeof(myaddr));
if (ret) {
mlog(0, "bind failed: %d\n", ret);
mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n",
ret, NIPQUAD(mynode->nd_ipv4_address));
goto out;
}

Expand Down Expand Up @@ -1407,6 +1415,8 @@ static void o2net_start_connect(void *arg)
sc_put(sc);
if (node)
o2nm_node_put(node);
if (mynode)
o2nm_node_put(mynode);

return;
}
Expand Down

0 comments on commit b7668c7

Please sign in to comment.