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
5f62bb67
Commit
5f62bb67
authored
Nov 08, 2010
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tunnel port problem for 2.6.24
parent
9f70834e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
25 deletions
+26
-25
connect.c
sources/2.6.24/connect.c
+26
-25
No files found.
sources/2.6.24/connect.c
View file @
5f62bb67
...
...
@@ -1327,21 +1327,28 @@ cifs_parse_mount_options(char *options, const char *devname,
static
struct
cifsSesInfo
*
cifs_find_tcp_session
(
struct
in_addr
*
target_ip_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
cifsSesInfo
*
ses
;
*
psrvTcp
=
NULL
;
if
(
!
port
)
port
=
CIFS_PORT
;
read_lock
(
&
GlobalSMBSeslock
);
list_for_each
(
tmp
,
&
GlobalSMBSessionList
)
{
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
cifsSessionList
);
if
(
ses
->
server
)
{
if
((
target_ip_addr
&&
(
ses
->
server
->
addr
.
sockAddr
.
sin_addr
.
s_addr
==
target_ip_addr
->
s_addr
))
||
(
target_ip6_addr
&&
memcmp
(
&
ses
->
server
->
addr
.
sockAddr6
.
sin6_addr
,
target_ip6_addr
,
sizeof
(
*
target_ip6_addr
))))
{
((
ses
->
server
->
addr
.
sockAddr
.
sin_addr
.
s_addr
==
target_ip_addr
->
s_addr
)
&&
(
ses
->
server
->
addr
.
sockAddr
.
sin_port
==
htons
(
port
))))
||
(
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
use count here?? */
...
...
@@ -1489,7 +1496,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
{
int
rc
=
0
;
int
connected
=
0
;
__be16
orig_port
=
0
;
int
orig_port_error
=
0
;
if
(
*
csocket
==
NULL
)
{
rc
=
sock_create_kern
(
PF_INET
,
SOCK_STREAM
,
...
...
@@ -1512,13 +1519,11 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
sizeof
(
struct
sockaddr_in
),
0
);
if
(
rc
>=
0
)
connected
=
1
;
else
orig_port_error
=
1
;
}
if
(
!
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
;
if
(
!
orig_port_error
&&
!
connected
)
{
/* do not retry on the same port we just failed on */
if
(
psin_server
->
sin_port
!=
htons
(
CIFS_PORT
))
{
psin_server
->
sin_port
=
htons
(
CIFS_PORT
);
...
...
@@ -1530,7 +1535,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
connected
=
1
;
}
}
if
(
!
connected
)
{
if
(
!
orig_port_error
&&
!
connected
)
{
psin_server
->
sin_port
=
htons
(
RFC1001_PORT
);
rc
=
(
*
csocket
)
->
ops
->
connect
(
*
csocket
,
(
struct
sockaddr
*
)
psin_server
,
...
...
@@ -1542,8 +1548,6 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
/* give up here - unless we want to retry on different
protocol families some day */
if
(
!
connected
)
{
if
(
orig_port
)
psin_server
->
sin_port
=
orig_port
;
cFYI
(
1
,
(
"Error %d connecting to server via ipv4"
,
rc
));
sock_release
(
*
csocket
);
*
csocket
=
NULL
;
...
...
@@ -1620,8 +1624,8 @@ static int
ipv6_connect
(
struct
sockaddr_in6
*
psin_server
,
struct
socket
**
csocket
)
{
int
rc
=
0
;
int
orig_port_error
=
0
;
int
connected
=
0
;
__be16
orig_port
=
0
;
if
(
*
csocket
==
NULL
)
{
rc
=
sock_create_kern
(
PF_INET6
,
SOCK_STREAM
,
...
...
@@ -1645,13 +1649,11 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
sizeof
(
struct
sockaddr_in6
),
0
);
if
(
rc
>=
0
)
connected
=
1
;
else
orig_port_error
=
1
;
}
if
(
!
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
;
if
(
!
orig_port_error
&&
!
connected
)
{
/* do not retry on the same port we just failed on */
if
(
psin_server
->
sin6_port
!=
htons
(
CIFS_PORT
))
{
psin_server
->
sin6_port
=
htons
(
CIFS_PORT
);
...
...
@@ -1663,7 +1665,8 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
connected
=
1
;
}
}
if
(
!
connected
)
{
if
(
!
orig_port_error
&&
!
connected
)
{
psin_server
->
sin6_port
=
htons
(
RFC1001_PORT
);
rc
=
(
*
csocket
)
->
ops
->
connect
(
*
csocket
,
(
struct
sockaddr
*
)
psin_server
,
sizeof
(
struct
sockaddr_in6
),
0
);
...
...
@@ -1674,8 +1677,6 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
/* give up here - unless we want to retry on different
protocol families some day */
if
(
!
connected
)
{
if
(
orig_port
)
psin_server
->
sin6_port
=
orig_port
;
cFYI
(
1
,
(
"Error %d connecting to server via ipv6"
,
rc
));
sock_release
(
*
csocket
);
*
csocket
=
NULL
;
...
...
@@ -1890,12 +1891,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if
(
address_type
==
AF_INET
)
existingCifsSes
=
cifs_find_tcp_session
(
&
sin_server
.
sin_addr
,
NULL
/* no ipv6 addr */
,
volume_info
.
username
,
&
srvTcp
);
volume_info
.
username
,
volume_info
.
port
,
&
srvTcp
);
else
if
(
address_type
==
AF_INET6
)
{
cFYI
(
1
,
(
"looking for ipv6 address"
));
existingCifsSes
=
cifs_find_tcp_session
(
NULL
/* no ipv4 addr */
,
&
sin_server6
.
sin6_addr
,
volume_info
.
username
,
&
srvTcp
);
volume_info
.
username
,
volume_info
.
port
,
&
srvTcp
);
}
else
{
rc
=
-
EINVAL
;
goto
out
;
...
...
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