Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
5f803b58
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5f803b58
编写于
2月 24, 2011
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xfrm: Const'ify address args to hash helpers.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
183cad12
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
15 deletion
+26
-15
net/xfrm/xfrm_hash.h
net/xfrm/xfrm_hash.h
+19
-13
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_policy.c
+7
-2
未找到文件。
net/xfrm/xfrm_hash.h
浏览文件 @
5f803b58
...
...
@@ -4,29 +4,32 @@
#include <linux/xfrm.h>
#include <linux/socket.h>
static
inline
unsigned
int
__xfrm4_addr_hash
(
xfrm_address_t
*
addr
)
static
inline
unsigned
int
__xfrm4_addr_hash
(
const
xfrm_address_t
*
addr
)
{
return
ntohl
(
addr
->
a4
);
}
static
inline
unsigned
int
__xfrm6_addr_hash
(
xfrm_address_t
*
addr
)
static
inline
unsigned
int
__xfrm6_addr_hash
(
const
xfrm_address_t
*
addr
)
{
return
ntohl
(
addr
->
a6
[
2
]
^
addr
->
a6
[
3
]);
}
static
inline
unsigned
int
__xfrm4_daddr_saddr_hash
(
xfrm_address_t
*
daddr
,
xfrm_address_t
*
saddr
)
static
inline
unsigned
int
__xfrm4_daddr_saddr_hash
(
const
xfrm_address_t
*
daddr
,
const
xfrm_address_t
*
saddr
)
{
u32
sum
=
(
__force
u32
)
daddr
->
a4
+
(
__force
u32
)
saddr
->
a4
;
return
ntohl
((
__force
__be32
)
sum
);
}
static
inline
unsigned
int
__xfrm6_daddr_saddr_hash
(
xfrm_address_t
*
daddr
,
xfrm_address_t
*
saddr
)
static
inline
unsigned
int
__xfrm6_daddr_saddr_hash
(
const
xfrm_address_t
*
daddr
,
const
xfrm_address_t
*
saddr
)
{
return
ntohl
(
daddr
->
a6
[
2
]
^
daddr
->
a6
[
3
]
^
saddr
->
a6
[
2
]
^
saddr
->
a6
[
3
]);
}
static
inline
unsigned
int
__xfrm_dst_hash
(
xfrm_address_t
*
daddr
,
xfrm_address_t
*
saddr
,
static
inline
unsigned
int
__xfrm_dst_hash
(
const
xfrm_address_t
*
daddr
,
const
xfrm_address_t
*
saddr
,
u32
reqid
,
unsigned
short
family
,
unsigned
int
hmask
)
{
...
...
@@ -42,8 +45,8 @@ static inline unsigned int __xfrm_dst_hash(xfrm_address_t *daddr, xfrm_address_t
return
(
h
^
(
h
>>
16
))
&
hmask
;
}
static
inline
unsigned
__xfrm_src_hash
(
xfrm_address_t
*
daddr
,
xfrm_address_t
*
saddr
,
static
inline
unsigned
__xfrm_src_hash
(
const
xfrm_address_t
*
daddr
,
const
xfrm_address_t
*
saddr
,
unsigned
short
family
,
unsigned
int
hmask
)
{
...
...
@@ -60,8 +63,8 @@ static inline unsigned __xfrm_src_hash(xfrm_address_t *daddr,
}
static
inline
unsigned
int
__xfrm_spi_hash
(
xfrm_address_t
*
daddr
,
__be32
spi
,
u8
proto
,
unsigned
short
family
,
unsigned
int
hmask
)
__xfrm_spi_hash
(
const
xfrm_address_t
*
daddr
,
__be32
spi
,
u8
proto
,
unsigned
short
family
,
unsigned
int
hmask
)
{
unsigned
int
h
=
(
__force
u32
)
spi
^
proto
;
switch
(
family
)
{
...
...
@@ -80,10 +83,11 @@ static inline unsigned int __idx_hash(u32 index, unsigned int hmask)
return
(
index
^
(
index
>>
8
))
&
hmask
;
}
static
inline
unsigned
int
__sel_hash
(
struct
xfrm_selector
*
sel
,
unsigned
short
family
,
unsigned
int
hmask
)
static
inline
unsigned
int
__sel_hash
(
const
struct
xfrm_selector
*
sel
,
unsigned
short
family
,
unsigned
int
hmask
)
{
xfrm_address_t
*
daddr
=
&
sel
->
daddr
;
xfrm_address_t
*
saddr
=
&
sel
->
saddr
;
const
xfrm_address_t
*
daddr
=
&
sel
->
daddr
;
const
xfrm_address_t
*
saddr
=
&
sel
->
saddr
;
unsigned
int
h
=
0
;
switch
(
family
)
{
...
...
@@ -107,7 +111,9 @@ static inline unsigned int __sel_hash(struct xfrm_selector *sel, unsigned short
return
h
&
hmask
;
}
static
inline
unsigned
int
__addr_hash
(
xfrm_address_t
*
daddr
,
xfrm_address_t
*
saddr
,
unsigned
short
family
,
unsigned
int
hmask
)
static
inline
unsigned
int
__addr_hash
(
const
xfrm_address_t
*
daddr
,
const
xfrm_address_t
*
saddr
,
unsigned
short
family
,
unsigned
int
hmask
)
{
unsigned
int
h
=
0
;
...
...
net/xfrm/xfrm_policy.c
浏览文件 @
5f803b58
...
...
@@ -311,7 +311,9 @@ static inline unsigned int idx_hash(struct net *net, u32 index)
return
__idx_hash
(
index
,
net
->
xfrm
.
policy_idx_hmask
);
}
static
struct
hlist_head
*
policy_hash_bysel
(
struct
net
*
net
,
struct
xfrm_selector
*
sel
,
unsigned
short
family
,
int
dir
)
static
struct
hlist_head
*
policy_hash_bysel
(
struct
net
*
net
,
const
struct
xfrm_selector
*
sel
,
unsigned
short
family
,
int
dir
)
{
unsigned
int
hmask
=
net
->
xfrm
.
policy_bydst
[
dir
].
hmask
;
unsigned
int
hash
=
__sel_hash
(
sel
,
family
,
hmask
);
...
...
@@ -321,7 +323,10 @@ static struct hlist_head *policy_hash_bysel(struct net *net, struct xfrm_selecto
net
->
xfrm
.
policy_bydst
[
dir
].
table
+
hash
);
}
static
struct
hlist_head
*
policy_hash_direct
(
struct
net
*
net
,
xfrm_address_t
*
daddr
,
xfrm_address_t
*
saddr
,
unsigned
short
family
,
int
dir
)
static
struct
hlist_head
*
policy_hash_direct
(
struct
net
*
net
,
const
xfrm_address_t
*
daddr
,
const
xfrm_address_t
*
saddr
,
unsigned
short
family
,
int
dir
)
{
unsigned
int
hmask
=
net
->
xfrm
.
policy_bydst
[
dir
].
hmask
;
unsigned
int
hash
=
__addr_hash
(
daddr
,
saddr
,
family
,
hmask
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录