Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d188262d
Commit
d188262d
authored
Mar 28, 2009
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
9f4c899c
' into devel
parents
f738f517
9f4c899c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
29 deletions
+39
-29
fs/nfs/client.c
fs/nfs/client.c
+39
-29
No files found.
fs/nfs/client.c
View file @
d188262d
...
...
@@ -255,6 +255,32 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
}
return
0
;
}
/*
* Test if two ip6 socket addresses refer to the same socket by
* comparing relevant fields. The padding bytes specifically, are not
* compared. sin6_flowinfo is not compared because it only affects QoS
* and sin6_scope_id is only compared if the address is "link local"
* because "link local" addresses need only be unique to a specific
* link. Conversely, ordinary unicast addresses might have different
* sin6_scope_id.
*
* The caller should ensure both socket addresses are AF_INET6.
*/
static
int
nfs_sockaddr_cmp_ip6
(
const
struct
sockaddr
*
sa1
,
const
struct
sockaddr
*
sa2
)
{
const
struct
sockaddr_in6
*
saddr1
=
(
const
struct
sockaddr_in6
*
)
sa1
;
const
struct
sockaddr_in6
*
saddr2
=
(
const
struct
sockaddr_in6
*
)
sa2
;
if
(
!
ipv6_addr_equal
(
&
saddr1
->
sin6_addr
,
&
saddr1
->
sin6_addr
))
return
0
;
if
(
ipv6_addr_scope
(
&
saddr1
->
sin6_addr
)
==
IPV6_ADDR_SCOPE_LINKLOCAL
&&
saddr1
->
sin6_scope_id
!=
saddr2
->
sin6_scope_id
)
return
0
;
return
saddr1
->
sin6_port
==
saddr2
->
sin6_port
;
}
#else
static
int
nfs_sockaddr_match_ipaddr4
(
const
struct
sockaddr_in
*
sa1
,
const
struct
sockaddr_in
*
sa2
)
...
...
@@ -270,6 +296,12 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
return
nfs_sockaddr_match_ipaddr4
((
const
struct
sockaddr_in
*
)
sa1
,
(
const
struct
sockaddr_in
*
)
sa2
);
}
static
int
nfs_sockaddr_cmp_ip6
(
const
struct
sockaddr
*
sa1
,
const
struct
sockaddr
*
sa2
)
{
return
0
;
}
#endif
/*
...
...
@@ -279,37 +311,17 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
*
* The caller should ensure both socket addresses are AF_INET.
*/
static
int
nfs_sockaddr_cmp_ip4
(
const
struct
sockaddr
_in
*
saddr
1
,
const
struct
sockaddr
_in
*
saddr
2
)
static
int
nfs_sockaddr_cmp_ip4
(
const
struct
sockaddr
*
sa
1
,
const
struct
sockaddr
*
sa
2
)
{
const
struct
sockaddr_in
*
saddr1
=
(
const
struct
sockaddr_in
*
)
sa1
;
const
struct
sockaddr_in
*
saddr2
=
(
const
struct
sockaddr_in
*
)
sa2
;
if
(
saddr1
->
sin_addr
.
s_addr
!=
saddr2
->
sin_addr
.
s_addr
)
return
0
;
return
saddr1
->
sin_port
==
saddr2
->
sin_port
;
}
/*
* Test if two ip6 socket addresses refer to the same socket by
* comparing relevant fields. The padding bytes specifically, are not
* compared. sin6_flowinfo is not compared because it only affects QoS
* and sin6_scope_id is only compared if the address is "link local"
* because "link local" addresses need only be unique to a specific
* link. Conversely, ordinary unicast addresses might have different
* sin6_scope_id.
*
* The caller should ensure both socket addresses are AF_INET6.
*/
static
int
nfs_sockaddr_cmp_ip6
(
const
struct
sockaddr_in6
*
saddr1
,
const
struct
sockaddr_in6
*
saddr2
)
{
if
(
!
ipv6_addr_equal
(
&
saddr1
->
sin6_addr
,
&
saddr1
->
sin6_addr
))
return
0
;
if
(
ipv6_addr_scope
(
&
saddr1
->
sin6_addr
)
==
IPV6_ADDR_SCOPE_LINKLOCAL
&&
saddr1
->
sin6_scope_id
!=
saddr2
->
sin6_scope_id
)
return
0
;
return
saddr1
->
sin6_port
==
saddr2
->
sin6_port
;
}
/*
* Test if two socket addresses represent the same actual socket,
* by comparing (only) relevant fields.
...
...
@@ -322,11 +334,9 @@ static int nfs_sockaddr_cmp(const struct sockaddr *sa1,
switch
(
sa1
->
sa_family
)
{
case
AF_INET
:
return
nfs_sockaddr_cmp_ip4
((
const
struct
sockaddr_in
*
)
sa1
,
(
const
struct
sockaddr_in
*
)
sa2
);
return
nfs_sockaddr_cmp_ip4
(
sa1
,
sa2
);
case
AF_INET6
:
return
nfs_sockaddr_cmp_ip6
((
const
struct
sockaddr_in6
*
)
sa1
,
(
const
struct
sockaddr_in6
*
)
sa2
);
return
nfs_sockaddr_cmp_ip6
(
sa1
,
sa2
);
}
return
0
;
}
...
...
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