Skip to content

Commit 83732ec

Browse files
Marc Dionnedhowells
authored andcommitted
afs: Use a dynamic port if 7001 is in use
It is not required that the afs client operate on port 7001. The port could be in use because another kernel or userspace client has already bound to it. If the port is in use, just fallback to using a dynamic port. Signed-off-by: Marc Dionne <[email protected]> Signed-off-by: David Howells <[email protected]>
1 parent dab17c1 commit 83732ec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/afs/rxrpc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ int afs_open_socket(struct afs_net *net)
6161
srx.transport.sin6.sin6_port = htons(AFS_CM_PORT);
6262

6363
ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
64+
if (ret == -EADDRINUSE) {
65+
srx.transport.sin6.sin6_port = 0;
66+
ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
67+
}
6468
if (ret < 0)
6569
goto error_2;
6670

0 commit comments

Comments
 (0)