Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
d188262d
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d188262d
编写于
3月 28, 2009
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
差异文件
Merge commit '
9f4c899c
' into devel
上级
f738f517
9f4c899c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
29 deletion
+39
-29
fs/nfs/client.c
fs/nfs/client.c
+39
-29
未找到文件。
fs/nfs/client.c
浏览文件 @
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
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录