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
1b66fb03
Commit
1b66fb03
authored
Nov 08, 2010
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tunnel port problem for 2.6.33
parent
698c4776
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
44 deletions
+30
-44
connect.c
sources/2.6.33/connect.c
+30
-44
No files found.
sources/2.6.33/connect.c
View file @
1b66fb03
...
...
@@ -1391,6 +1391,10 @@ cifs_find_tcp_session(struct sockaddr_storage *addr, unsigned short int port)
struct
sockaddr_in
*
addr4
=
(
struct
sockaddr_in
*
)
addr
;
struct
sockaddr_in6
*
addr6
=
(
struct
sockaddr_in6
*
)
addr
;
/* looking for CIFS_PORT if user doens't specify the port manually */
if
(
!
port
)
port
=
CIFS_PORT
;
write_lock
(
&
cifs_tcp_ses_lock
);
list_for_each
(
tmp
,
&
cifs_tcp_ses_list
)
{
server
=
list_entry
(
tmp
,
struct
TCP_Server_Info
,
...
...
@@ -1406,34 +1410,23 @@ cifs_find_tcp_session(struct sockaddr_storage *addr, unsigned short int port)
switch
(
addr
->
ss_family
)
{
case
AF_INET
:
if
(
addr4
->
sin_addr
.
s_addr
==
server
->
addr
.
sockAddr
.
sin_addr
.
s_addr
)
{
addr4
->
sin_port
=
htons
(
port
);
/* user overrode default port? */
if
(
addr4
->
sin_port
)
{
if
(
addr4
->
sin_port
!=
server
->
addr
.
sockAddr
.
sin_port
)
continue
;
}
break
;
}
else
addr4
->
sin_port
=
htons
(
port
);
if
((
addr4
->
sin_addr
.
s_addr
!=
server
->
addr
.
sockAddr
.
sin_addr
.
s_addr
)
||
(
addr4
->
sin_port
!=
server
->
addr
.
sockAddr
.
sin_port
))
continue
;
break
;
case
AF_INET6
:
if
(
ipv6_addr_equal
(
&
addr6
->
sin6_addr
,
&
server
->
addr
.
sockAddr6
.
sin6_addr
)
&&
(
addr6
->
sin6_scope_id
==
server
->
addr
.
sockAddr6
.
sin6_scope_id
))
{
addr6
->
sin6_port
=
htons
(
port
);
/* user overrode default port? */
if
(
addr6
->
sin6_port
)
{
if
(
addr6
->
sin6_port
!=
server
->
addr
.
sockAddr6
.
sin6_port
)
continue
;
}
break
;
}
else
addr6
->
sin6_port
=
htons
(
port
);
if
(
!
ipv6_addr_equal
(
&
addr6
->
sin6_addr
,
&
server
->
addr
.
sockAddr6
.
sin6_addr
)
||
(
addr6
->
sin6_scope_id
!=
server
->
addr
.
sockAddr6
.
sin6_scope_id
)
||
(
addr6
->
sin6_port
!=
server
->
addr
.
sockAddr6
.
sin6_port
))
continue
;
break
;
}
++
server
->
srv_count
;
...
...
@@ -1774,7 +1767,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
)
{
...
...
@@ -1792,20 +1785,18 @@ ipv4_connect(struct TCP_Server_Info *server)
cifs_reclassify_socket4
(
socket
);
}
/* 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
;
}
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
;
if
(
!
orig_port_error
&&
!
connected
)
{
/* 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
);
...
...
@@ -1817,7 +1808,8 @@ ipv4_connect(struct TCP_Server_Info *server)
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
,
...
...
@@ -1829,15 +1821,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
...
...
@@ -1935,7 +1924,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
)
{
...
...
@@ -1961,13 +1950,11 @@ ipv6_connect(struct TCP_Server_Info *server)
sizeof
(
struct
sockaddr_in6
),
0
);
if
(
rc
>=
0
)
connected
=
true
;
else
orig_port_error
=
true
;
}
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
;
if
(
!
orig_port_error
&&
!
connected
)
{
/* 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
);
...
...
@@ -1978,7 +1965,8 @@ ipv6_connect(struct TCP_Server_Info *server)
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
,
...
...
@@ -1990,8 +1978,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
;
...
...
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