aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 97f4311b9a8e..e16d7592116a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -70,7 +70,6 @@ struct smb_vol {
70 mode_t file_mode; 70 mode_t file_mode;
71 mode_t dir_mode; 71 mode_t dir_mode;
72 unsigned secFlg; 72 unsigned secFlg;
73 bool rw:1;
74 bool retry:1; 73 bool retry:1;
75 bool intr:1; 74 bool intr:1;
76 bool setuids:1; 75 bool setuids:1;
@@ -832,7 +831,6 @@ cifs_parse_mount_options(char *options, const char *devname,
832 vol->dir_mode = vol->file_mode = S_IRUGO | S_IXUGO | S_IWUSR; 831 vol->dir_mode = vol->file_mode = S_IRUGO | S_IXUGO | S_IWUSR;
833 832
834 /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ 833 /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */
835 vol->rw = true;
836 /* default is always to request posix paths. */ 834 /* default is always to request posix paths. */
837 vol->posix_paths = 1; 835 vol->posix_paths = 1;
838 /* default to using server inode numbers where available */ 836 /* default to using server inode numbers where available */
@@ -1199,7 +1197,9 @@ cifs_parse_mount_options(char *options, const char *devname,
1199 } else if (strnicmp(data, "guest", 5) == 0) { 1197 } else if (strnicmp(data, "guest", 5) == 0) {
1200 /* ignore */ 1198 /* ignore */
1201 } else if (strnicmp(data, "rw", 2) == 0) { 1199 } else if (strnicmp(data, "rw", 2) == 0) {
1202 vol->rw = true; 1200 /* ignore */
1201 } else if (strnicmp(data, "ro", 2) == 0) {
1202 /* ignore */
1203 } else if (strnicmp(data, "noblocksend", 11) == 0) { 1203 } else if (strnicmp(data, "noblocksend", 11) == 0) {
1204 vol->noblocksnd = 1; 1204 vol->noblocksnd = 1;
1205 } else if (strnicmp(data, "noautotune", 10) == 0) { 1205 } else if (strnicmp(data, "noautotune", 10) == 0) {
@@ -1218,8 +1218,6 @@ cifs_parse_mount_options(char *options, const char *devname,
1218 parse these options again and set anything and it 1218 parse these options again and set anything and it
1219 is ok to just ignore them */ 1219 is ok to just ignore them */
1220 continue; 1220 continue;
1221 } else if (strnicmp(data, "ro", 2) == 0) {
1222 vol->rw = false;
1223 } else if (strnicmp(data, "hard", 4) == 0) { 1221 } else if (strnicmp(data, "hard", 4) == 0) {
1224 vol->retry = 1; 1222 vol->retry = 1;
1225 } else if (strnicmp(data, "soft", 4) == 0) { 1223 } else if (strnicmp(data, "soft", 4) == 0) {
@@ -1386,8 +1384,10 @@ cifs_find_tcp_session(struct sockaddr_storage *addr)
1386 server->addr.sockAddr.sin_addr.s_addr)) 1384 server->addr.sockAddr.sin_addr.s_addr))
1387 continue; 1385 continue;
1388 else if (addr->ss_family == AF_INET6 && 1386 else if (addr->ss_family == AF_INET6 &&
1389 !ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr, 1387 (!ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr,
1390 &addr6->sin6_addr)) 1388 &addr6->sin6_addr) ||
1389 server->addr.sockAddr6.sin6_scope_id !=
1390 addr6->sin6_scope_id))
1391 continue; 1391 continue;
1392 1392
1393 ++server->srv_count; 1393 ++server->srv_count;
@@ -1433,28 +1433,15 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1433 1433
1434 memset(&addr, 0, sizeof(struct sockaddr_storage)); 1434 memset(&addr, 0, sizeof(struct sockaddr_storage));
1435 1435
1436 if (volume_info->UNCip && volume_info->UNC) { 1436 cFYI(1, ("UNC: %s ip: %s", volume_info->UNC, volume_info->UNCip));
1437 rc = cifs_inet_pton(AF_INET, volume_info->UNCip,
1438 &sin_server->sin_addr.s_addr);
1439
1440 if (rc <= 0) {
1441 /* not ipv4 address, try ipv6 */
1442 rc = cifs_inet_pton(AF_INET6, volume_info->UNCip,
1443 &sin_server6->sin6_addr.in6_u);
1444 if (rc > 0)
1445 addr.ss_family = AF_INET6;
1446 } else {
1447 addr.ss_family = AF_INET;
1448 }
1449 1437
1450 if (rc <= 0) { 1438 if (volume_info->UNCip && volume_info->UNC) {
1439 rc = cifs_convert_address(volume_info->UNCip, &addr);
1440 if (!rc) {
1451 /* we failed translating address */ 1441 /* we failed translating address */
1452 rc = -EINVAL; 1442 rc = -EINVAL;
1453 goto out_err; 1443 goto out_err;
1454 } 1444 }
1455
1456 cFYI(1, ("UNC: %s ip: %s", volume_info->UNC,
1457 volume_info->UNCip));
1458 } else if (volume_info->UNCip) { 1445 } else if (volume_info->UNCip) {
1459 /* BB using ip addr as tcp_ses name to connect to the 1446 /* BB using ip addr as tcp_ses name to connect to the
1460 DFS root below */ 1447 DFS root below */
@@ -1513,14 +1500,14 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1513 cFYI(1, ("attempting ipv6 connect")); 1500 cFYI(1, ("attempting ipv6 connect"));
1514 /* BB should we allow ipv6 on port 139? */ 1501 /* BB should we allow ipv6 on port 139? */
1515 /* other OS never observed in Wild doing 139 with v6 */ 1502 /* other OS never observed in Wild doing 139 with v6 */
1503 sin_server6->sin6_port = htons(volume_info->port);
1516 memcpy(&tcp_ses->addr.sockAddr6, sin_server6, 1504 memcpy(&tcp_ses->addr.sockAddr6, sin_server6,
1517 sizeof(struct sockaddr_in6)); 1505 sizeof(struct sockaddr_in6));
1518 sin_server6->sin6_port = htons(volume_info->port);
1519 rc = ipv6_connect(tcp_ses); 1506 rc = ipv6_connect(tcp_ses);
1520 } else { 1507 } else {
1508 sin_server->sin_port = htons(volume_info->port);
1521 memcpy(&tcp_ses->addr.sockAddr, sin_server, 1509 memcpy(&tcp_ses->addr.sockAddr, sin_server,
1522 sizeof(struct sockaddr_in)); 1510 sizeof(struct sockaddr_in));
1523 sin_server->sin_port = htons(volume_info->port);
1524 rc = ipv4_connect(tcp_ses); 1511 rc = ipv4_connect(tcp_ses);
1525 } 1512 }
1526 if (rc < 0) { 1513 if (rc < 0) {