Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etercifs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etercifs
Commits
c834a6ae
Commit
c834a6ae
authored
Nov 08, 2010
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tunnel port problem for centos52
parent
66354c55
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
25 deletions
+26
-25
connect.c
sources/centos52/connect.c
+26
-25
No files found.
sources/centos52/connect.c
View file @
c834a6ae
...
@@ -1357,21 +1357,28 @@ cifs_parse_mount_options(char *options, const char *devname,
...
@@ -1357,21 +1357,28 @@ cifs_parse_mount_options(char *options, const char *devname,
static
struct
cifsSesInfo
*
static
struct
cifsSesInfo
*
cifs_find_tcp_session
(
struct
in_addr
*
target_ip_addr
,
cifs_find_tcp_session
(
struct
in_addr
*
target_ip_addr
,
struct
in6_addr
*
target_ip6_addr
,
struct
in6_addr
*
target_ip6_addr
,
char
*
userName
,
struct
TCP_Server_Info
**
psrvTcp
)
char
*
userName
,
unsigned
short
int
port
,
struct
TCP_Server_Info
**
psrvTcp
)
{
{
struct
list_head
*
tmp
;
struct
list_head
*
tmp
;
struct
cifsSesInfo
*
ses
;
struct
cifsSesInfo
*
ses
;
*
psrvTcp
=
NULL
;
*
psrvTcp
=
NULL
;
if
(
!
port
)
port
=
CIFS_PORT
;
read_lock
(
&
GlobalSMBSeslock
);
read_lock
(
&
GlobalSMBSeslock
);
list_for_each
(
tmp
,
&
GlobalSMBSessionList
)
{
list_for_each
(
tmp
,
&
GlobalSMBSessionList
)
{
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
cifsSessionList
);
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
cifsSessionList
);
if
(
ses
->
server
)
{
if
(
ses
->
server
)
{
if
((
target_ip_addr
&&
if
((
target_ip_addr
&&
(
ses
->
server
->
addr
.
sockAddr
.
sin_addr
.
s_addr
((
ses
->
server
->
addr
.
sockAddr
.
sin_addr
.
s_addr
==
target_ip_addr
->
s_addr
))
||
(
target_ip6_addr
==
target_ip_addr
->
s_addr
)
&&
&&
memcmp
(
&
ses
->
server
->
addr
.
sockAddr6
.
sin6_addr
,
(
ses
->
server
->
addr
.
sockAddr
.
sin_port
==
htons
(
port
))))
target_ip6_addr
,
sizeof
(
*
target_ip6_addr
))))
{
||
(
target_ip6_addr
&&
(
memcmp
(
&
ses
->
server
->
addr
.
sockAddr6
.
sin6_addr
,
target_ip6_addr
,
sizeof
(
*
target_ip6_addr
))
&&
(
ses
->
server
->
addr
.
sockAddr6
.
sin6_port
==
htons
(
port
)))))
{
/* BB lock server and tcp session and increment
/* BB lock server and tcp session and increment
use count here?? */
use count here?? */
...
@@ -1519,7 +1526,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
...
@@ -1519,7 +1526,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
{
{
int
rc
=
0
;
int
rc
=
0
;
int
connected
=
0
;
int
connected
=
0
;
__be16
orig_port
=
0
;
int
orig_port_error
=
0
;
if
(
*
csocket
==
NULL
)
{
if
(
*
csocket
==
NULL
)
{
rc
=
sock_create_kern
(
PF_INET
,
SOCK_STREAM
,
rc
=
sock_create_kern
(
PF_INET
,
SOCK_STREAM
,
...
@@ -1546,13 +1553,11 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
...
@@ -1546,13 +1553,11 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
sizeof
(
struct
sockaddr_in
),
0
);
sizeof
(
struct
sockaddr_in
),
0
);
if
(
rc
>=
0
)
if
(
rc
>=
0
)
connected
=
1
;
connected
=
1
;
else
orig_port_error
=
1
;
}
}
if
(
!
connected
)
{
if
(
!
orig_port_error
&&
!
connected
)
{
/* save original port so we can retry user specified port
later if fall back ports fail this time */
orig_port
=
psin_server
->
sin_port
;
/* do not retry on the same port we just failed on */
/* do not retry on the same port we just failed on */
if
(
psin_server
->
sin_port
!=
htons
(
CIFS_PORT
))
{
if
(
psin_server
->
sin_port
!=
htons
(
CIFS_PORT
))
{
psin_server
->
sin_port
=
htons
(
CIFS_PORT
);
psin_server
->
sin_port
=
htons
(
CIFS_PORT
);
...
@@ -1564,7 +1569,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
...
@@ -1564,7 +1569,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
connected
=
1
;
connected
=
1
;
}
}
}
}
if
(
!
connected
)
{
if
(
!
orig_port_error
&&
!
connected
)
{
psin_server
->
sin_port
=
htons
(
RFC1001_PORT
);
psin_server
->
sin_port
=
htons
(
RFC1001_PORT
);
rc
=
(
*
csocket
)
->
ops
->
connect
(
*
csocket
,
(
struct
sockaddr
*
)
rc
=
(
*
csocket
)
->
ops
->
connect
(
*
csocket
,
(
struct
sockaddr
*
)
psin_server
,
psin_server
,
...
@@ -1576,8 +1582,6 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
...
@@ -1576,8 +1582,6 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
/* give up here - unless we want to retry on different
/* give up here - unless we want to retry on different
protocol families some day */
protocol families some day */
if
(
!
connected
)
{
if
(
!
connected
)
{
if
(
orig_port
)
psin_server
->
sin_port
=
orig_port
;
cFYI
(
1
,
(
"Error %d connecting to server via ipv4"
,
rc
));
cFYI
(
1
,
(
"Error %d connecting to server via ipv4"
,
rc
));
sock_release
(
*
csocket
);
sock_release
(
*
csocket
);
*
csocket
=
NULL
;
*
csocket
=
NULL
;
...
@@ -1665,8 +1669,8 @@ static int
...
@@ -1665,8 +1669,8 @@ static int
ipv6_connect
(
struct
sockaddr_in6
*
psin_server
,
struct
socket
**
csocket
)
ipv6_connect
(
struct
sockaddr_in6
*
psin_server
,
struct
socket
**
csocket
)
{
{
int
rc
=
0
;
int
rc
=
0
;
int
orig_port_error
=
0
;
int
connected
=
0
;
int
connected
=
0
;
__be16
orig_port
=
0
;
if
(
*
csocket
==
NULL
)
{
if
(
*
csocket
==
NULL
)
{
rc
=
sock_create_kern
(
PF_INET6
,
SOCK_STREAM
,
rc
=
sock_create_kern
(
PF_INET6
,
SOCK_STREAM
,
...
@@ -1694,13 +1698,11 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
...
@@ -1694,13 +1698,11 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
sizeof
(
struct
sockaddr_in6
),
0
);
sizeof
(
struct
sockaddr_in6
),
0
);
if
(
rc
>=
0
)
if
(
rc
>=
0
)
connected
=
1
;
connected
=
1
;
else
orig_port_error
=
1
;
}
}
if
(
!
connected
)
{
if
(
!
orig_port_error
&&
!
connected
)
{
/* save original port so we can retry user specified port
later if fall back ports fail this time */
orig_port
=
psin_server
->
sin6_port
;
/* do not retry on the same port we just failed on */
/* do not retry on the same port we just failed on */
if
(
psin_server
->
sin6_port
!=
htons
(
CIFS_PORT
))
{
if
(
psin_server
->
sin6_port
!=
htons
(
CIFS_PORT
))
{
psin_server
->
sin6_port
=
htons
(
CIFS_PORT
);
psin_server
->
sin6_port
=
htons
(
CIFS_PORT
);
...
@@ -1712,7 +1714,8 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
...
@@ -1712,7 +1714,8 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
connected
=
1
;
connected
=
1
;
}
}
}
}
if
(
!
connected
)
{
if
(
!
orig_port_error
&&
!
connected
)
{
psin_server
->
sin6_port
=
htons
(
RFC1001_PORT
);
psin_server
->
sin6_port
=
htons
(
RFC1001_PORT
);
rc
=
(
*
csocket
)
->
ops
->
connect
(
*
csocket
,
(
struct
sockaddr
*
)
rc
=
(
*
csocket
)
->
ops
->
connect
(
*
csocket
,
(
struct
sockaddr
*
)
psin_server
,
sizeof
(
struct
sockaddr_in6
),
0
);
psin_server
,
sizeof
(
struct
sockaddr_in6
),
0
);
...
@@ -1723,8 +1726,6 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
...
@@ -1723,8 +1726,6 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
/* give up here - unless we want to retry on different
/* give up here - unless we want to retry on different
protocol families some day */
protocol families some day */
if
(
!
connected
)
{
if
(
!
connected
)
{
if
(
orig_port
)
psin_server
->
sin6_port
=
orig_port
;
cFYI
(
1
,
(
"Error %d connecting to server via ipv6"
,
rc
));
cFYI
(
1
,
(
"Error %d connecting to server via ipv6"
,
rc
));
sock_release
(
*
csocket
);
sock_release
(
*
csocket
);
*
csocket
=
NULL
;
*
csocket
=
NULL
;
...
@@ -1966,12 +1967,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
...
@@ -1966,12 +1967,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if
(
address_type
==
AF_INET
)
if
(
address_type
==
AF_INET
)
existingCifsSes
=
cifs_find_tcp_session
(
&
sin_server
.
sin_addr
,
existingCifsSes
=
cifs_find_tcp_session
(
&
sin_server
.
sin_addr
,
NULL
/* no ipv6 addr */
,
NULL
/* no ipv6 addr */
,
volume_info
.
username
,
&
srvTcp
);
volume_info
.
username
,
volume_info
.
port
,
&
srvTcp
);
else
if
(
address_type
==
AF_INET6
)
{
else
if
(
address_type
==
AF_INET6
)
{
cFYI
(
1
,
(
"looking for ipv6 address"
));
cFYI
(
1
,
(
"looking for ipv6 address"
));
existingCifsSes
=
cifs_find_tcp_session
(
NULL
/* no ipv4 addr */
,
existingCifsSes
=
cifs_find_tcp_session
(
NULL
/* no ipv4 addr */
,
&
sin_server6
.
sin6_addr
,
&
sin_server6
.
sin6_addr
,
volume_info
.
username
,
&
srvTcp
);
volume_info
.
username
,
volume_info
.
port
,
&
srvTcp
);
}
else
{
}
else
{
kfree
(
volume_info
.
UNC
);
kfree
(
volume_info
.
UNC
);
kfree
(
volume_info
.
password
);
kfree
(
volume_info
.
password
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment