CIFS: Fix mounting share on non-standard ports
Subsystems (2)
PATCH 1/1 CIFS: Fix mounting share on non-standard ports
This patch fixes the following situation: we have the share (1) mounted with a non-standard port and try to mount another share (2) with the standard one (not specifying the port), the client doesn't connect to the new share (2) and returns with existing connection (1). The patch also makes the client prevent connecting to a wrong share on a reconnect if the client fails during the re-establishing connection to a lost share.
--- fs/cifs/connect.c | 86 ++++++++++++++++++++++++++--------------------------- 1 files changed, 42 insertions(+), 44 deletions(-)
fs/cifs/connect.c +42 -44
@@ -1446,25 +1446,32 @@ match_address(struct TCP_Server_Info *server, struct sockaddr *addr, {struct sockaddr_in *addr4 = (struct sockaddr_in *)addr;struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr; +unsigned short int port; + +/* search for a connection with the default port if user doesn't +specify the port manually */ + port =htons (CIFS_PORT );switch (addr->sa_family) {case AF_INET : +if (addr4->sin_port) + port = addr4->sin_port;if (addr4->sin_addr.s_addr != server->addr.sockAddr.sin_addr.s_addr)return false; -if (addr4->sin_port && - addr4->sin_port != server->addr.sockAddr.sin_port) +if (port != server->addr.sockAddr.sin_port)return false;break ;case AF_INET6 : +if (addr6->sin6_port) + port = addr6->sin6_port;if (!ipv6_addr_equal (&addr6->sin6_addr, &server->addr.sockAddr6.sin6_addr))return false;if (addr6->sin6_scope_id != server->addr.sockAddr6.sin6_scope_id)return false; -if (addr6->sin6_port && - addr6->sin6_port != server->addr.sockAddr6.sin6_port) +if (port != server->addr.sockAddr6.sin6_port)return false;break ; }
@@ -2126,7 +2133,7 @@ ipv4_connect(struct TCP_Server_Info *server)int rc =0 ;int val;bool connected = false; -__be16 orig_port =0 ; +bool orig_port_error = false;struct socket *socket = server->ssocket;if (socket ==NULL ) {
@@ -2148,32 +2155,30 @@ ipv4_connect(struct TCP_Server_Info *server)if (rc <0 )return rc; -/* user overrode default port */ +/* user overrode default port or we perform reconnect */ if (server->addr.sockAddr.sin_port) { rc = socket->ops->connect (socket, (struct sockaddr *) &server->addr.sockAddr,sizeof (struct sockaddr_in ),0 );if (rc >=0 ) connected = true; +else + orig_port_error = true; +/* in this case we don't have to try other port +because we can mount another share */ } -if (!connected) { -/* save original port so we can retry user specified port -later if fall back ports fail this time */ - orig_port = server->addr.sockAddr.sin_port; - -/* do not retry on the same port we just failed on */ -if (server->addr.sockAddr.sin_port !=htons (CIFS_PORT )) { - server->addr.sockAddr.sin_port =htons (CIFS_PORT ); - rc = socket->ops->connect (socket, - (struct sockaddr *) - &server->addr.sockAddr, -sizeof (struct sockaddr_in ),0 ); -if (rc >=0 ) - connected = true; - } +if (!orig_port_error && !connected) { + server->addr.sockAddr.sin_port =htons (CIFS_PORT ); + rc = socket->ops->connect (socket, + (struct sockaddr *) + &server->addr.sockAddr, +sizeof (struct sockaddr_in ),0 ); +if (rc >=0 ) + connected = true; } -if (!connected) { + +if (!orig_port_error && !connected) { server->addr.sockAddr.sin_port =htons (RFC1001_PORT ); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr,
@@ -2185,15 +2190,12 @@ ipv4_connect(struct TCP_Server_Info *server)/* give up here - unless we want to retry on different protocol families some day */ if (!connected) { -if (orig_port) - server->addr.sockAddr.sin_port = orig_port;cFYI (1 ,"Error %d connecting to server via ipv4" , rc);sock_release (socket); server->ssocket =NULL ;return rc; } -/* * Eventually check for other socket options to change from * the default. sock_setsockopt not used because it expects
@@ -2291,7 +2293,7 @@ ipv6_connect(struct TCP_Server_Info *server)int rc =0 ;int val;bool connected = false; -__be16 orig_port =0 ; +bool orig_port_error = false;struct socket *socket = server->ssocket;if (socket ==NULL ) {
@@ -2314,31 +2316,29 @@ ipv6_connect(struct TCP_Server_Info *server)if (rc <0 )return rc; -/* user overrode default port */ +/* user overrode default port or we perform reconnect */ if (server->addr.sockAddr6.sin6_port) { rc = socket->ops->connect (socket, (struct sockaddr *) &server->addr.sockAddr6,sizeof (struct sockaddr_in6 ),0 );if (rc >=0 ) connected = true; +else + orig_port_error = true; +/* in this case we don't have to try other port +because we can mount another share */ } -if (!connected) { -/* save original port so we can retry user specified port -later if fall back ports fail this time */ - - orig_port = server->addr.sockAddr6.sin6_port; -/* do not retry on the same port we just failed on */ -if (server->addr.sockAddr6.sin6_port !=htons (CIFS_PORT )) { - server->addr.sockAddr6.sin6_port =htons (CIFS_PORT ); - rc = socket->ops->connect (socket, (struct sockaddr *) - &server->addr.sockAddr6, -sizeof (struct sockaddr_in6 ),0 ); -if (rc >=0 ) - connected = true; - } +if (!orig_port_error && !connected) { + server->addr.sockAddr6.sin6_port =htons (CIFS_PORT ); + rc = socket->ops->connect (socket, (struct sockaddr *) + &server->addr.sockAddr6, +sizeof (struct sockaddr_in6 ),0 ); +if (rc >=0 ) + connected = true; } -if (!connected) { + +if (!orig_port_error && !connected) { server->addr.sockAddr6.sin6_port =htons (RFC1001_PORT ); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr6,
@@ -2350,8 +2350,6 @@ ipv6_connect(struct TCP_Server_Info *server)/* give up here - unless we want to retry on different protocol families some day */ if (!connected) { -if (orig_port) - server->addr.sockAddr6.sin6_port = orig_port;cFYI (1 ,"Error %d connecting to server via ipv6" , rc);sock_release (socket); server->ssocket =NULL ;
Signature · 1 line
1.7.2.3
A message that is not in the archive (sent off-list or not yet received): 1289321425-7860-1-git-send-email-piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010/11/9 Pavel Shilovsky <[email protected]>:
Quoted 6 lines
This patch fixes the following situation: we have the share (1) mounted with a non-standard port and try to mount another share (2) with the standard one (not specifying the port), the client doesn't connect to the new share (2) and returns with existing connection (1). The patch also makes the client prevent connecting to a wrong share on a reconnect if the client fails during the re-establishing connection to a lost share.
What's about this patch?
Signature · 2 lines
Best regards, Pavel Shilovsky.
Quoted 17 lines · On Tue, 9 Nov 2010 19:50:25 +0300 Pavel Shilovsky…
This patch fixes the following situation: we have the share (1) mounted with a non-standard port and try to mount another share (2) with the standard one (not specifying the port), the client doesn't connect to the new share (2) and returns with existing connection (1). The patch also makes the client prevent connecting to a wrong share on a reconnect if the client fails during the re-establishing connection to a lost share.
Signed-off-by Pavel Shilovsky <[email protected]>--- fs/cifs/connect.c | 86 ++++++++++++++++++++++++++--------------------------- 1 files changed, 42 insertions(+), 44 deletions(-)fs/cifs/connect.c +0
-0
fs/cifs/connect.c match_address(struct TCP_Server_Info *server, struct sockaddr *addr, · line 1454
Quoted 9 lines
fs/cifs/connect.c +5
-0@@ -1446,25 +1446,32 @@ match_address(struct TCP_Server_Info *server, struct sockaddr *addr, {struct sockaddr_in *addr4 = (struct sockaddr_in *)addr;struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr; +unsigned short int port; + +/* search for a connection with the default port if user doesn't +specify the port manually */ + port =htons (CIFS_PORT );
I don't think this patch deals correctly with servers that are listening on RFC1001_PORT but not CIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?
Also, the logic in match_address is getting to be rather convoluted. It might be good to break that out into a match_port function.
Quoted 156 lines
fs/cifs/connect.c +37
-42switch (addr->sa_family) {case AF_INET : +if (addr4->sin_port) + port = addr4->sin_port;if (addr4->sin_addr.s_addr != server->addr.sockAddr.sin_addr.s_addr)return false; -if (addr4->sin_port && - addr4->sin_port != server->addr.sockAddr.sin_port) +if (port != server->addr.sockAddr.sin_port)return false;break ;case AF_INET6 : +if (addr6->sin6_port) + port = addr6->sin6_port;if (!ipv6_addr_equal (&addr6->sin6_addr, &server->addr.sockAddr6.sin6_addr))return false;if (addr6->sin6_scope_id != server->addr.sockAddr6.sin6_scope_id)return false; -if (addr6->sin6_port && - addr6->sin6_port != server->addr.sockAddr6.sin6_port) +if (port != server->addr.sockAddr6.sin6_port)return false;break ; }@@ -2126,7 +2133,7 @@ ipv4_connect(struct TCP_Server_Info *server)int rc =0 ;int val;bool connected = false; -__be16 orig_port =0 ; +bool orig_port_error = false;struct socket *socket = server->ssocket;if (socket ==NULL ) {@@ -2148,32 +2155,30 @@ ipv4_connect(struct TCP_Server_Info *server)if (rc <0 )return rc; -/* user overrode default port */ +/* user overrode default port or we perform reconnect */ if (server->addr.sockAddr.sin_port) { rc = socket->ops->connect (socket, (struct sockaddr *) &server->addr.sockAddr,sizeof (struct sockaddr_in ),0 );if (rc >=0 ) connected = true; +else + orig_port_error = true; +/* in this case we don't have to try other port +because we can mount another share */ } -if (!connected) { -/* save original port so we can retry user specified port -later if fall back ports fail this time */ - orig_port = server->addr.sockAddr.sin_port; - -/* do not retry on the same port we just failed on */ -if (server->addr.sockAddr.sin_port !=htons (CIFS_PORT )) { - server->addr.sockAddr.sin_port =htons (CIFS_PORT ); - rc = socket->ops->connect (socket, - (struct sockaddr *) - &server->addr.sockAddr, -sizeof (struct sockaddr_in ),0 ); -if (rc >=0 ) - connected = true; - } +if (!orig_port_error && !connected) { + server->addr.sockAddr.sin_port =htons (CIFS_PORT ); + rc = socket->ops->connect (socket, + (struct sockaddr *) + &server->addr.sockAddr, +sizeof (struct sockaddr_in ),0 ); +if (rc >=0 ) + connected = true; } -if (!connected) { + +if (!orig_port_error && !connected) { server->addr.sockAddr.sin_port =htons (RFC1001_PORT ); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr,@@ -2185,15 +2190,12 @@ ipv4_connect(struct TCP_Server_Info *server)/* give up here - unless we want to retry on different protocol families some day */ if (!connected) { -if (orig_port) - server->addr.sockAddr.sin_port = orig_port;cFYI (1 ,"Error %d connecting to server via ipv4" , rc);sock_release (socket); server->ssocket =NULL ;return rc; } -/* * Eventually check for other socket options to change from * the default. sock_setsockopt not used because it expects @@ -2291,7 +2293,7 @@ ipv6_connect(struct TCP_Server_Info *server)int rc =0 ;int val;bool connected = false; -__be16 orig_port =0 ; +bool orig_port_error = false;struct socket *socket = server->ssocket;if (socket ==NULL ) {@@ -2314,31 +2316,29 @@ ipv6_connect(struct TCP_Server_Info *server)if (rc <0 )return rc; -/* user overrode default port */ +/* user overrode default port or we perform reconnect */ if (server->addr.sockAddr6.sin6_port) { rc = socket->ops->connect (socket, (struct sockaddr *) &server->addr.sockAddr6,sizeof (struct sockaddr_in6 ),0 );if (rc >=0 ) connected = true; +else + orig_port_error = true; +/* in this case we don't have to try other port +because we can mount another share */ } -if (!connected) { -/* save original port so we can retry user specified port -later if fall back ports fail this time */ - - orig_port = server->addr.sockAddr6.sin6_port; -/* do not retry on the same port we just failed on */ -if (server->addr.sockAddr6.sin6_port !=htons (CIFS_PORT )) { - server->addr.sockAddr6.sin6_port =htons (CIFS_PORT ); - rc = socket->ops->connect (socket, (struct sockaddr *) - &server->addr.sockAddr6, -sizeof (struct sockaddr_in6 ),0 ); -if (rc >=0 ) - connected = true; - } +if (!orig_port_error && !connected) { + server->addr.sockAddr6.sin6_port =htons (CIFS_PORT ); + rc = socket->ops->connect (socket, (struct sockaddr *) + &server->addr.sockAddr6, +sizeof (struct sockaddr_in6 ),0 ); +if (rc >=0 ) + connected = true; } -if (!connected) { + +if (!orig_port_error && !connected) { server->addr.sockAddr6.sin6_port =htons (RFC1001_PORT ); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr6,
fs/cifs/connect.c ipv6_connect(struct TCP_Server_Info *server) · line 2355
Quoted 8 lines
fs/cifs/connect.c +0
-2@@ -2350,8 +2350,6 @@ ipv6_connect(struct TCP_Server_Info *server)/* give up here - unless we want to retry on different protocol families some day */ if (!connected) { -if (orig_port) - server->addr.sockAddr6.sin6_port = orig_port;cFYI (1 ,"Error %d connecting to server via ipv6" , rc);sock_release (socket); server->ssocket =NULL ;
ipv4_connect and ipv6_connect ought to be sharing a lot of code. It would be good to do some cleanup here and try to consolidate these functions more than they are today.
I envision a function that just handles setting up the socket and leaves the caller to determine the port to use. Also, breaking out the RFC1001 stuff into a separate function would be good too.
Signature · 1 line
Jeff Layton <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20101113070012.760cf09d-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org
2010/11/13 Jeff Layton <[email protected]>:
Quoted 5 lines
I don't think this patch deals correctly with servers that are listening on
RFC1001_PORTbut notCIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?
Yes, you are right. I don't think that it is a big problem im comparison with what we have today. Today we have totally broken code
- when I have two servers on the one host with different ports (e.x. the first on one host and the second on the second but can be accesed through the first with ssh forwarded port) and user wants to mount both. In results, user mount only the first share twice - it can break a lot of things!
Quoted 4 lines
Also, the logic in
match_addressis getting to be rather convoluted. It might be good to break that out into amatch_portfunction.
Quoted 8 lines
ipv4_connectandipv6_connectought to be sharing a lot of code. It would be good to do some cleanup here and try to consolidate these functions more than they are today.I envision a function that just handles setting up the socket and leaves the caller to determine the port to use. Also, breaking out the RFC1001 stuff into a separate function would be good too.
You are absolutely right. I agree with you about copy-and-past code for ipv4(v6)_connect function - good chance for cleanup. I am going to do it as soon as I finished with strict cache mode. But for a while - I don't think we can leave such a bug I described above.
Signature · 2 lines
Best regards, Pavel Shilovsky.
A message that is not in the archive (sent off-list or not yet received): AANLkTinb-A4kdumURzhkVb9oNojtfW94LPL99GwOr9MU-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
2010/11/13 Pavel Shilovsky <[email protected]>:
Quoted 7 lines
2010/11/13 Jeff Layton <[email protected]>:
Quoted 5 lines
I don't think this patch deals correctly with servers that are listening on
RFC1001_PORTbut notCIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?
And from another hand: If user doesn't specify the port we should think that it means the 445 port. If user wants to mount 139 port, he should specify this port manually. So, there is no error with the patch in this case.
Quoted 1 line
From this point of view we should remove trying with 139 port if we
failed with 445 port. What do you think about it?
Signature · 2 lines
Best regards, Pavel Shilovsky.
A message that is not in the archive (sent off-list or not yet received): AANLkTim+SO4TfTJnXHnvaSjbPaoHt4k63hbVbs0gtbn9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 9 lines · On Sun, 14 Nov 2010 12:38:18 +0300 Pavel Shilovsky…
2010/11/13 Pavel Shilovsky <[email protected]>:
Quoted 7 lines
2010/11/13 Jeff Layton <[email protected]>:
Quoted 5 lines
I don't think this patch deals correctly with servers that are listening on
RFC1001_PORTbut notCIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?
Quoted 8 lines
And from another hand: If user doesn't specify the port we should think that it means the 445 port. If user wants to mount 139 port, he should specify this port manually. So, there is no error with the patch in this case.
From this point of view we should remove trying with 139 port if we failed with 445 port. What do you think about it?
That sounds like a regression. The mount.cifs manpage says:
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If the CIFS server is not listening on this port or if it is not specified, the default ports will be tried i.e. port 445 is tried and if no response then port 139 is tried.
I think we ought to preserve that behavior. Perhaps if no port is specified then match any TCP session that is on port 445 or port 139?
Signature · 1 line
Jeff Layton <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20101114203112.5d901619-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org
Quoted 30 lines · Jeff Layton
Quoted 9 lines · On Sun, 14 Nov 2010 12:38:18 +0300 Pavel Shilovsky…
2010/11/13 Pavel Shilovsky <[email protected]>:
Quoted 7 lines
2010/11/13 Jeff Layton <[email protected]>:
Quoted 5 lines
I don't think this patch deals correctly with servers that are listening on
RFC1001_PORTbut notCIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?Quoted 8 lines
And from another hand: If user doesn't specify the port we should think that it means the 445 port. If user wants to mount 139 port, he should specify this port manually. So, there is no error with the patch in this case.
From this point of view we should remove trying with 139 port if we failed with 445 port. What do you think about it?
That sounds like a regression. The mount.cifs manpage says:
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If the CIFS server is not listening on this port or if it is not specified, the default ports will be tried i.e. port 445 is tried and if no response then port 139 is tried.
Quoted 2 lines
I think we ought to preserve that behavior. Perhaps if no port is specified then match any TCP session that is on port 445 or port 139?
Right - sounds logical that if you don't specify a port, then we try to match a connection on any existing port. If there is no existing port, and none was specified, then 445 first then 139.
Signature · 3 lines
Thanks, Steve
A message that is not in the archive (sent off-list or not yet received): AANLkTin-HyDEVKTStoPFRx5a0ycAYAx2uSCoh+4NspfO-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
2010/11/15 Steve French <[email protected]>:
Quoted 10 lines · Jeff Layton
Quoted 9 lines
That sounds like a regression. The mount.cifs manpage says:
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If the CIFS server is not listening on this port or if it is not specified, the default ports will be tried i.e. port 445 is tried and if no response then port 139 is tried.
Quoted 7 lines
Quoted 2 lines
I think we ought to preserve that behavior. Perhaps if no port is specified then match any TCP session that is on port 445 or port 139?
Right - sounds logical that if you don't specify a port, then we try to match a connection on any existing port. If there is no existing port, and none was specified, then 445 first then 139.
Let's predict the following situation:
we have server with two smbd's: 1th on 445 port, and 2nd on 5000 port. At first user mounts 2nd smbd with specifying 5000 port. Then it tries to mount 1th without specifying any ports. If we consider your logic, our client looks for an any existing connection, finds connection to 5000 port (2nd smbd) and mounts it. So, as the result, user thinks that it successfully mounted the 1th share, but it is the 2nd - it is not right.
If we should follow mount.cifs spec, I think we need to do:
1) if user doesn't specify a port we at first try to match a connection with 445 port, then if we are not successful - with 139 port. If there are no connections with these ports, we return an error.
2) if user specifies a port, we should try to match a connection only with this port. If no connections with this port, we should return an error.
I think that it is real problem. I faced with a real application freenx server that uses CIFS for mounting many shares on different ports (freenx clients want mount to mount its own share through ssh port forwarding - many smbds with non-standard ports and local smbd with standard port) on localhost.
You can try the following to reproduce the bug:
run smbd's on localhost and smbserver_host (another).
On the first console:
ssh -L5000:smbserver_host:445 smbserver_host On the second:
mount -t cifs //localhost/share ~/test -oport=5000 mount -t cifs //localhost/share ~/test2
As the result, we can see that the second call connects to smbserve_host rather than to localhost and return without any error - so, user doesn't know that it has mounted smbserver_host instead of localhost.
Even more, if we unmounted and mount them vice versa:
mount -t cifs //localhost/share ~/test2
mount -t cifs //localhost/share ~/test -oport=5000
it will be ok - two different connection to two different share, but (!) if we losing the connection to port 5000, today's code reconnects with share to localhost - wrong again! My patch number 1 fixes this situation too.
I am ready to provide changes to the patches I posted later according to mount.cifs spec as soon as we find an agreement in all the things above.
Signature · 2 lines
Best regards, Pavel Shilovsky.
2010/11/15 Jeff Layton <[email protected]>:
Quoted 30 lines
Quoted 9 lines · On Sun, 14 Nov 2010 12:38:18 +0300 Pavel Shilovsky…
2010/11/13 Pavel Shilovsky <[email protected]>:
Quoted 7 lines
2010/11/13 Jeff Layton <[email protected]>:
Quoted 5 lines
I don't think this patch deals correctly with servers that are listening on
RFC1001_PORTbut notCIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?Quoted 8 lines
And from another hand: If user doesn't specify the port we should think that it means the 445 port. If user wants to mount 139 port, he should specify this port manually. So, there is no error with the patch in this case.
From this point of view we should remove trying with 139 port if we failed with 445 port. What do you think about it?
That sounds like a regression. The mount.cifs manpage says:
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If the CIFS server is not listening on this port or if it is not specified, the default ports will be tried i.e. port 445 is tried and if no response then port 139 is tried.
Quoted 3 lines
I think we ought to preserve that behavior. Perhaps if no port is specified then match any TCP session that is on port 445 or port 139?
Jeff, according to my patches (try #2) I think we should replace it this with:
port=arg
sets the port number on the server to attempt to contact to
negotiate CIFS support.
If the CIFS server is not listening on this port, we return
with error. If it is not specified,
the default ports will be tried i.e. port 445 is tried and
if no response then port 139 is tried.
Signature · 2 lines
Best regards, Pavel Shilovsky.
A message that is not in the archive (sent off-list or not yet received): AANLkTikJVcpezQ54_XrsNMEBewq15YO3iHymoQ-9xc9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Even more. I think it should be the following:
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If this value is specified, looking for an existing connection with this port and try to connect if no such a connection. Return an error if it fails.
If this value isn't specified, looking for an existing connection with 445 or 139 port. If no such a connection, try to connect with 445 port and if it fails - with 139 port. Return an error if both fail.
Signature · 2 lines
Best regards, Pavel Shilovsky.
Quoted 37 lines · On Tue, 16 Nov 2010 10:51:23 +0300 Pavel Shilovsky…
2010/11/15 Jeff Layton <[email protected]>:
Quoted 30 lines
Quoted 9 lines · On Sun, 14 Nov 2010 12:38:18 +0300 Pavel Shilovsky…
2010/11/13 Pavel Shilovsky <[email protected]>:
Quoted 7 lines
2010/11/13 Jeff Layton <[email protected]>:
Quoted 5 lines
I don't think this patch deals correctly with servers that are listening on
RFC1001_PORTbut notCIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?Quoted 8 lines
And from another hand: If user doesn't specify the port we should think that it means the 445 port. If user wants to mount 139 port, he should specify this port manually. So, there is no error with the patch in this case.
From this point of view we should remove trying with 139 port if we failed with 445 port. What do you think about it?
That sounds like a regression. The mount.cifs manpage says:
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If the CIFS server is not listening on this port or if it is not specified, the default ports will be tried i.e. port 445 is tried and if no response then port 139 is tried.Quoted 3 lines
I think we ought to preserve that behavior. Perhaps if no port is specified then match any TCP session that is on port 445 or port 139?
Jeff, according to my patches (try #2) I think we should replace it this with:
Quoted 9 lines
port=arg
sets the port number on the server to attempt to contact to
negotiate CIFS support.
If the CIFS server is not listening on this port, we return
with error. If it is not specified,
the default ports will be tried i.e. port 445 is tried and
if no response then port 139 is tried.
Sounds correct to me. Care to do a manpage patch for mount.cifs?
Thanks,
Signature · 1 line
Jeff Layton <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20101116092646.44bcf91a-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org
2010/11/16 Jeff Layton <[email protected]>:
Quoted 50 lines
Quoted 37 lines · On Tue, 16 Nov 2010 10:51:23 +0300 Pavel Shilovsky…
2010/11/15 Jeff Layton <[email protected]>:
Quoted 30 lines
Quoted 9 lines · On Sun, 14 Nov 2010 12:38:18 +0300 Pavel Shilovsky…
2010/11/13 Pavel Shilovsky <[email protected]>:
Quoted 7 lines
2010/11/13 Jeff Layton <[email protected]>:
Quoted 5 lines
I don't think this patch deals correctly with servers that are listening on
RFC1001_PORTbut notCIFS_PORT. With two mounts to the same server that don't specify a port, you'll end up with two sockets, right?Quoted 8 lines
And from another hand: If user doesn't specify the port we should think that it means the 445 port. If user wants to mount 139 port, he should specify this port manually. So, there is no error with the patch in this case.
From this point of view we should remove trying with 139 port if we failed with 445 port. What do you think about it?
That sounds like a regression. The mount.cifs manpage says:
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If the CIFS server is not listening on this port or if it is not specified, the default ports will be tried i.e. port 445 is tried and if no response then port 139 is tried.Quoted 3 lines
I think we ought to preserve that behavior. Perhaps if no port is specified then match any TCP session that is on port 445 or port 139?
Jeff, according to my patches (try #2) I think we should replace it this with:
Quoted 9 lines
port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support.
If the CIFS server is not listening on this port, we return with error. If it is not specified,
the default ports will be tried i.e. port 445 is tried and if no response then port 139 is tried.
Quoted 2 lines
Sounds correct to me. Care to do a manpage patch for mount.cifs?
Ok, I will provide a patch with this variant:
"port=arg
sets the port number on the server to attempt to contact to negotiate CIFS support. If this value is specified, looking for an existing connection with this port and try to connect if no such a connection. Return an error if it fails.
If this value isn't specified, looking for an existing connection with 445 or 139 port. If no such a connection, try to connect with 445 port and if it fails - with 139 port. Return an error if both fail."
Signature · 2 lines
Best regards, Pavel Shilovsky.