Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
6546bc37
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6546bc37
编写于
8月 05, 2011
作者:
A
Anthony Liguori
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'kiszka/queues/slirp' into staging
上级
b3198cc2
e3a110b5
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
14 addition
and
17 deletion
+14
-17
slirp/arp_table.c
slirp/arp_table.c
+8
-8
slirp/if.c
slirp/if.c
+1
-7
slirp/slirp.c
slirp/slirp.c
+3
-0
slirp/slirp.h
slirp/slirp.h
+2
-2
未找到文件。
slirp/arp_table.c
浏览文件 @
6546bc37
...
...
@@ -24,9 +24,9 @@
#include "slirp.h"
void
arp_table_add
(
Slirp
*
slirp
,
in
t
ip_addr
,
uint8_t
ethaddr
[
ETH_ALEN
])
void
arp_table_add
(
Slirp
*
slirp
,
uint32_
t
ip_addr
,
uint8_t
ethaddr
[
ETH_ALEN
])
{
const
in_addr
_t
broadcast_addr
=
const
uint32
_t
broadcast_addr
=
~
slirp
->
vnetwork_mask
.
s_addr
|
slirp
->
vnetwork_addr
.
s_addr
;
ArpTable
*
arptbl
=
&
slirp
->
arp_table
;
int
i
;
...
...
@@ -60,29 +60,29 @@ void arp_table_add(Slirp *slirp, int ip_addr, uint8_t ethaddr[ETH_ALEN])
arptbl
->
next_victim
=
(
arptbl
->
next_victim
+
1
)
%
ARP_TABLE_SIZE
;
}
bool
arp_table_search
(
Slirp
*
slirp
,
int
in_
ip_addr
,
bool
arp_table_search
(
Slirp
*
slirp
,
uint32_t
ip_addr
,
uint8_t
out_ethaddr
[
ETH_ALEN
])
{
const
in_addr
_t
broadcast_addr
=
const
uint32
_t
broadcast_addr
=
~
slirp
->
vnetwork_mask
.
s_addr
|
slirp
->
vnetwork_addr
.
s_addr
;
ArpTable
*
arptbl
=
&
slirp
->
arp_table
;
int
i
;
DEBUG_CALL
(
"arp_table_search"
);
DEBUG_ARG
(
"ip = 0x%x"
,
i
n_i
p_addr
);
DEBUG_ARG
(
"ip = 0x%x"
,
ip_addr
);
/* Check 0.0.0.0/8 invalid source-only addresses */
assert
((
i
n_i
p_addr
&
htonl
(
~
(
0xf
<<
28
)))
!=
0
);
assert
((
ip_addr
&
htonl
(
~
(
0xf
<<
28
)))
!=
0
);
/* If broadcast address */
if
(
i
n_ip_addr
==
0xffffffff
||
in_
ip_addr
==
broadcast_addr
)
{
if
(
i
p_addr
==
0xffffffff
||
ip_addr
==
broadcast_addr
)
{
/* return Ethernet broadcast address */
memset
(
out_ethaddr
,
0xff
,
ETH_ALEN
);
return
1
;
}
for
(
i
=
0
;
i
<
ARP_TABLE_SIZE
;
i
++
)
{
if
(
arptbl
->
table
[
i
].
ar_sip
==
i
n_i
p_addr
)
{
if
(
arptbl
->
table
[
i
].
ar_sip
==
ip_addr
)
{
memcpy
(
out_ethaddr
,
arptbl
->
table
[
i
].
ar_sha
,
ETH_ALEN
);
DEBUG_ARGS
((
dfd
,
" found hw addr = %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
out_ethaddr
[
0
],
out_ethaddr
[
1
],
out_ethaddr
[
2
],
...
...
slirp/if.c
浏览文件 @
6546bc37
...
...
@@ -106,9 +106,6 @@ if_output(struct socket *so, struct mbuf *ifm)
ifs_init
(
ifm
);
insque
(
ifm
,
ifq
);
/* Expiration date = Now + 1 second */
ifm
->
expiration_date
=
qemu_get_clock_ns
(
rt_clock
)
+
1000000000ULL
;
diddit:
slirp
->
if_queued
++
;
...
...
@@ -157,9 +154,8 @@ diddit:
void
if_start
(
Slirp
*
slirp
)
{
uint64_t
now
=
qemu_get_clock_ns
(
rt_clock
);
int
requeued
=
0
;
uint64_t
now
;
struct
mbuf
*
ifm
,
*
ifqt
;
DEBUG_CALL
(
"if_start"
);
...
...
@@ -172,8 +168,6 @@ if_start(Slirp *slirp)
if
(
!
slirp_can_output
(
slirp
->
opaque
))
return
;
now
=
qemu_get_clock_ns
(
rt_clock
);
/*
* See which queue to get next packet from
* If there's something in the fastq, select it immediately
...
...
slirp/slirp.c
浏览文件 @
6546bc37
...
...
@@ -738,6 +738,9 @@ int if_encap(Slirp *slirp, struct mbuf *ifm)
slirp
->
client_ipaddr
=
iph
->
ip_dst
;
slirp_output
(
slirp
->
opaque
,
arp_req
,
sizeof
(
arp_req
));
ifm
->
arp_requested
=
true
;
/* Expire request and drop outgoing packet after 1 second */
ifm
->
expiration_date
=
qemu_get_clock_ns
(
rt_clock
)
+
1000000000ULL
;
}
return
0
;
}
else
{
...
...
slirp/slirp.h
浏览文件 @
6546bc37
...
...
@@ -208,9 +208,9 @@ typedef struct ArpTable {
int
next_victim
;
}
ArpTable
;
void
arp_table_add
(
Slirp
*
slirp
,
in
t
ip_addr
,
uint8_t
ethaddr
[
ETH_ALEN
]);
void
arp_table_add
(
Slirp
*
slirp
,
uint32_
t
ip_addr
,
uint8_t
ethaddr
[
ETH_ALEN
]);
bool
arp_table_search
(
Slirp
*
slirp
,
int
in_
ip_addr
,
bool
arp_table_search
(
Slirp
*
slirp
,
uint32_t
ip_addr
,
uint8_t
out_ethaddr
[
ETH_ALEN
]);
struct
Slirp
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录