Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
a8e7f4bc
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
153
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,发现更多精彩内容 >>
提交
a8e7f4bc
编写于
12月 12, 2010
作者:
M
Marek Lindner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
batman-adv: protect neighbor nodes with reference counters
Signed-off-by:
N
Marek Lindner
<
lindner_marek@yahoo.de
>
上级
8d689218
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
8 deletion
+28
-8
net/batman-adv/originator.c
net/batman-adv/originator.c
+15
-5
net/batman-adv/originator.h
net/batman-adv/originator.h
+5
-3
net/batman-adv/routing.c
net/batman-adv/routing.c
+7
-0
net/batman-adv/types.h
net/batman-adv/types.h
+1
-0
未找到文件。
net/batman-adv/originator.c
浏览文件 @
a8e7f4bc
...
...
@@ -59,9 +59,18 @@ int originator_init(struct bat_priv *bat_priv)
return
0
;
}
struct
neigh_node
*
create_neighbor
(
struct
orig_node
*
orig_node
,
struct
orig_node
*
orig_neigh_node
,
uint8_t
*
neigh
,
struct
batman_if
*
if_incoming
)
void
neigh_node_free_ref
(
struct
kref
*
refcount
)
{
struct
neigh_node
*
neigh_node
;
neigh_node
=
container_of
(
refcount
,
struct
neigh_node
,
refcount
);
kfree
(
neigh_node
);
}
struct
neigh_node
*
create_neighbor
(
struct
orig_node
*
orig_node
,
struct
orig_node
*
orig_neigh_node
,
uint8_t
*
neigh
,
struct
batman_if
*
if_incoming
)
{
struct
bat_priv
*
bat_priv
=
netdev_priv
(
if_incoming
->
soft_iface
);
struct
neigh_node
*
neigh_node
;
...
...
@@ -78,6 +87,7 @@ create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node,
memcpy
(
neigh_node
->
addr
,
neigh
,
ETH_ALEN
);
neigh_node
->
orig_node
=
orig_neigh_node
;
neigh_node
->
if_incoming
=
if_incoming
;
kref_init
(
&
neigh_node
->
refcount
);
list_add_tail
(
&
neigh_node
->
list
,
&
orig_node
->
neigh_list
);
return
neigh_node
;
...
...
@@ -95,7 +105,7 @@ static void free_orig_node(void *data, void *arg)
neigh_node
=
list_entry
(
list_pos
,
struct
neigh_node
,
list
);
list_del
(
list_pos
);
k
free
(
neigh_node
);
k
ref_put
(
&
neigh_node
->
refcount
,
neigh_node_free_ref
);
}
frag_list_free
(
&
orig_node
->
frag_list
);
...
...
@@ -216,7 +226,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
neigh_purged
=
true
;
list_del
(
list_pos
);
k
free
(
neigh_node
);
k
ref_put
(
&
neigh_node
->
refcount
,
neigh_node_free_ref
);
}
else
{
if
((
!*
best_neigh_node
)
||
(
neigh_node
->
tq_avg
>
(
*
best_neigh_node
)
->
tq_avg
))
...
...
net/batman-adv/originator.h
浏览文件 @
a8e7f4bc
...
...
@@ -26,9 +26,11 @@ int originator_init(struct bat_priv *bat_priv);
void
originator_free
(
struct
bat_priv
*
bat_priv
);
void
purge_orig_ref
(
struct
bat_priv
*
bat_priv
);
struct
orig_node
*
get_orig_node
(
struct
bat_priv
*
bat_priv
,
uint8_t
*
addr
);
struct
neigh_node
*
create_neighbor
(
struct
orig_node
*
orig_node
,
struct
orig_node
*
orig_neigh_node
,
uint8_t
*
neigh
,
struct
batman_if
*
if_incoming
);
struct
neigh_node
*
create_neighbor
(
struct
orig_node
*
orig_node
,
struct
orig_node
*
orig_neigh_node
,
uint8_t
*
neigh
,
struct
batman_if
*
if_incoming
);
void
neigh_node_free_ref
(
struct
kref
*
refcount
);
int
orig_seq_print_text
(
struct
seq_file
*
seq
,
void
*
offset
);
int
orig_hash_add_if
(
struct
batman_if
*
batman_if
,
int
max_if_num
);
int
orig_hash_del_if
(
struct
batman_if
*
batman_if
,
int
max_if_num
);
...
...
net/batman-adv/routing.c
浏览文件 @
a8e7f4bc
...
...
@@ -89,6 +89,8 @@ static void update_route(struct bat_priv *bat_priv,
struct
neigh_node
*
neigh_node
,
unsigned
char
*
hna_buff
,
int
hna_buff_len
)
{
struct
neigh_node
*
neigh_node_tmp
;
/* route deleted */
if
((
orig_node
->
router
)
&&
(
!
neigh_node
))
{
...
...
@@ -115,7 +117,12 @@ static void update_route(struct bat_priv *bat_priv,
orig_node
->
router
->
addr
);
}
if
(
neigh_node
)
kref_get
(
&
neigh_node
->
refcount
);
neigh_node_tmp
=
orig_node
->
router
;
orig_node
->
router
=
neigh_node
;
if
(
neigh_node_tmp
)
kref_put
(
&
neigh_node_tmp
->
refcount
,
neigh_node_free_ref
);
}
...
...
net/batman-adv/types.h
浏览文件 @
a8e7f4bc
...
...
@@ -115,6 +115,7 @@ struct neigh_node {
struct
neigh_node
*
next_bond_candidate
;
unsigned
long
last_valid
;
unsigned
long
real_bits
[
NUM_WORDS
];
struct
kref
refcount
;
struct
orig_node
*
orig_node
;
struct
batman_if
*
if_incoming
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录