Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
d0b9fd89
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,发现更多精彩内容 >>
提交
d0b9fd89
编写于
7月 30, 2011
作者:
M
Marek Lindner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
batman-adv: move routing packet initialization into corresponding file
Signed-off-by:
N
Marek Lindner
<
lindner_marek@yahoo.de
>
上级
fc957275
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
32 deletion
+46
-32
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_iv_ogm.c
+37
-0
net/batman-adv/bat_ogm.h
net/batman-adv/bat_ogm.h
+3
-0
net/batman-adv/hard-interface.c
net/batman-adv/hard-interface.c
+6
-32
未找到文件。
net/batman-adv/bat_iv_ogm.c
浏览文件 @
d0b9fd89
...
...
@@ -30,6 +30,43 @@
#include "hard-interface.h"
#include "send.h"
void
bat_ogm_init
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
hard_iface
->
packet_len
=
BATMAN_OGM_LEN
;
hard_iface
->
packet_buff
=
kmalloc
(
hard_iface
->
packet_len
,
GFP_ATOMIC
);
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
batman_ogm_packet
->
packet_type
=
BAT_OGM
;
batman_ogm_packet
->
version
=
COMPAT_VERSION
;
batman_ogm_packet
->
flags
=
NO_FLAGS
;
batman_ogm_packet
->
ttl
=
2
;
batman_ogm_packet
->
tq
=
TQ_MAX_VALUE
;
batman_ogm_packet
->
tt_num_changes
=
0
;
batman_ogm_packet
->
ttvn
=
0
;
}
void
bat_ogm_init_primary
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
batman_ogm_packet
->
flags
=
PRIMARIES_FIRST_HOP
;
batman_ogm_packet
->
ttl
=
TTL
;
}
void
bat_ogm_update_mac
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
memcpy
(
batman_ogm_packet
->
orig
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
memcpy
(
batman_ogm_packet
->
prev_sender
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
}
/* is there another aggregated packet here? */
static
int
bat_ogm_aggr_packet
(
int
buff_pos
,
int
packet_len
,
int
tt_num_changes
)
...
...
net/batman-adv/bat_ogm.h
浏览文件 @
d0b9fd89
...
...
@@ -24,6 +24,9 @@
#include "main.h"
void
bat_ogm_init
(
struct
hard_iface
*
hard_iface
);
void
bat_ogm_init_primary
(
struct
hard_iface
*
hard_iface
);
void
bat_ogm_update_mac
(
struct
hard_iface
*
hard_iface
);
void
bat_ogm_receive
(
const
struct
ethhdr
*
ethhdr
,
unsigned
char
*
packet_buff
,
int
packet_len
,
struct
hard_iface
*
if_incoming
);
...
...
net/batman-adv/hard-interface.c
浏览文件 @
d0b9fd89
...
...
@@ -28,6 +28,7 @@
#include "bat_sysfs.h"
#include "originator.h"
#include "hash.h"
#include "bat_ogm.h"
#include <linux/if_arp.h>
...
...
@@ -131,7 +132,6 @@ static void primary_if_select(struct bat_priv *bat_priv,
struct
hard_iface
*
new_hard_iface
)
{
struct
hard_iface
*
curr_hard_iface
;
struct
batman_ogm_packet
*
batman_ogm_packet
;
ASSERT_RTNL
();
...
...
@@ -147,11 +147,7 @@ static void primary_if_select(struct bat_priv *bat_priv,
if
(
!
new_hard_iface
)
return
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
(
new_hard_iface
->
packet_buff
);
batman_ogm_packet
->
flags
=
PRIMARIES_FIRST_HOP
;
batman_ogm_packet
->
ttl
=
TTL
;
bat_ogm_init_primary
(
new_hard_iface
);
primary_if_update_addr
(
bat_priv
);
}
...
...
@@ -163,17 +159,6 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
return
false
;
}
static
void
update_mac_addresses
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
memcpy
(
batman_ogm_packet
->
orig
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
memcpy
(
batman_ogm_packet
->
prev_sender
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
}
static
void
check_known_mac_addr
(
const
struct
net_device
*
net_dev
)
{
const
struct
hard_iface
*
hard_iface
;
...
...
@@ -248,7 +233,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
bat_priv
=
netdev_priv
(
hard_iface
->
soft_iface
);
update_mac_addresses
(
hard_iface
);
bat_ogm_update_mac
(
hard_iface
);
hard_iface
->
if_status
=
IF_TO_BE_ACTIVATED
;
/**
...
...
@@ -287,7 +272,6 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
const
char
*
iface_name
)
{
struct
bat_priv
*
bat_priv
;
struct
batman_ogm_packet
*
batman_ogm_packet
;
struct
net_device
*
soft_iface
;
int
ret
;
...
...
@@ -322,8 +306,8 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
hard_iface
->
soft_iface
=
soft_iface
;
bat_priv
=
netdev_priv
(
hard_iface
->
soft_iface
);
hard_iface
->
packet_len
=
BATMAN_OGM_LEN
;
hard_iface
->
packet_buff
=
kmalloc
(
hard_iface
->
packet_len
,
GFP_ATOMIC
);
bat_ogm_init
(
hard_iface
);
if
(
!
hard_iface
->
packet_buff
)
{
bat_err
(
hard_iface
->
soft_iface
,
"Can't add interface packet "
...
...
@@ -332,16 +316,6 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
goto
err
;
}
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
(
hard_iface
->
packet_buff
);
batman_ogm_packet
->
packet_type
=
BAT_OGM
;
batman_ogm_packet
->
version
=
COMPAT_VERSION
;
batman_ogm_packet
->
flags
=
NO_FLAGS
;
batman_ogm_packet
->
ttl
=
2
;
batman_ogm_packet
->
tq
=
TQ_MAX_VALUE
;
batman_ogm_packet
->
tt_num_changes
=
0
;
batman_ogm_packet
->
ttvn
=
0
;
hard_iface
->
if_num
=
bat_priv
->
num_ifaces
;
bat_priv
->
num_ifaces
++
;
hard_iface
->
if_status
=
IF_INACTIVE
;
...
...
@@ -556,7 +530,7 @@ static int hard_if_event(struct notifier_block *this,
goto
hardif_put
;
check_known_mac_addr
(
hard_iface
->
net_dev
);
update_mac_addresses
(
hard_iface
);
bat_ogm_update_mac
(
hard_iface
);
bat_priv
=
netdev_priv
(
hard_iface
->
soft_iface
);
primary_if
=
primary_if_get_selected
(
bat_priv
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录