Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
1563587b
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
大约 1 年 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1563587b
编写于
1月 28, 2016
作者:
R
Rich Felker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reuse parsed resolv.conf in dns core to avoid re-reading/re-parsing
上级
dcad020c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
22 addition
and
16 deletion
+22
-16
src/network/lookup_name.c
src/network/lookup_name.c
+6
-5
src/network/res_msend.c
src/network/res_msend.c
+16
-11
未找到文件。
src/network/lookup_name.c
浏览文件 @
1563587b
...
...
@@ -93,7 +93,7 @@ struct dpc_ctx {
int
__dns_parse
(
const
unsigned
char
*
,
int
,
int
(
*
)(
void
*
,
int
,
const
void
*
,
int
,
const
void
*
),
void
*
);
int
__dn_expand
(
const
unsigned
char
*
,
const
unsigned
char
*
,
const
unsigned
char
*
,
char
*
,
int
);
int
__res_mkquery
(
int
,
const
char
*
,
int
,
int
,
const
unsigned
char
*
,
int
,
const
unsigned
char
*
,
unsigned
char
*
,
int
);
int
__res_msend
(
int
,
const
unsigned
char
*
const
*
,
const
int
*
,
unsigned
char
*
const
*
,
int
*
,
int
);
int
__res_msend
_rc
(
int
,
const
unsigned
char
*
const
*
,
const
int
*
,
unsigned
char
*
const
*
,
int
*
,
int
,
const
struct
resolvconf
*
);
#define RR_A 1
#define RR_CNAME 5
...
...
@@ -125,7 +125,7 @@ static int dns_parse_callback(void *c, int rr, const void *data, int len, const
return
0
;
}
static
int
name_from_dns
(
struct
address
buf
[
static
MAXADDRS
],
char
canon
[
static
256
],
const
char
*
name
,
int
family
)
static
int
name_from_dns
(
struct
address
buf
[
static
MAXADDRS
],
char
canon
[
static
256
],
const
char
*
name
,
int
family
,
const
struct
resolvconf
*
conf
)
{
unsigned
char
qbuf
[
2
][
280
],
abuf
[
2
][
512
];
const
unsigned
char
*
qp
[
2
]
=
{
qbuf
[
0
],
qbuf
[
1
]
};
...
...
@@ -145,7 +145,8 @@ static int name_from_dns(struct address buf[static MAXADDRS], char canon[static
nq
++
;
}
if
(
__res_msend
(
nq
,
qp
,
qlens
,
ap
,
alens
,
sizeof
*
abuf
)
<
0
)
return
EAI_SYSTEM
;
if
(
__res_msend_rc
(
nq
,
qp
,
qlens
,
ap
,
alens
,
sizeof
*
abuf
,
conf
)
<
0
)
return
EAI_SYSTEM
;
for
(
i
=
0
;
i
<
nq
;
i
++
)
__dns_parse
(
abuf
[
i
],
alens
[
i
],
dns_parse_callback
,
&
ctx
);
...
...
@@ -188,13 +189,13 @@ static int name_from_dns_search(struct address buf[static MAXADDRS], char canon[
if
(
z
-
p
<
256
-
l
-
1
)
{
memcpy
(
canon
+
l
+
1
,
p
,
z
-
p
);
canon
[
z
-
p
+
1
+
l
]
=
0
;
int
cnt
=
name_from_dns
(
buf
,
canon
,
canon
,
family
);
int
cnt
=
name_from_dns
(
buf
,
canon
,
canon
,
family
,
&
conf
);
if
(
cnt
)
return
cnt
;
}
}
canon
[
l
]
=
0
;
return
name_from_dns
(
buf
,
canon
,
name
,
family
);
return
name_from_dns
(
buf
,
canon
,
name
,
family
,
&
conf
);
}
static
const
struct
policy
{
...
...
src/network/res_msend.c
浏览文件 @
1563587b
...
...
@@ -27,8 +27,9 @@ static unsigned long mtime()
+
ts
.
tv_nsec
/
1000000
;
}
int
__res_msend
(
int
nqueries
,
const
unsigned
char
*
const
*
queries
,
const
int
*
qlens
,
unsigned
char
*
const
*
answers
,
int
*
alens
,
int
asize
)
int
__res_msend_rc
(
int
nqueries
,
const
unsigned
char
*
const
*
queries
,
const
int
*
qlens
,
unsigned
char
*
const
*
answers
,
int
*
alens
,
int
asize
,
const
struct
resolvconf
*
conf
)
{
int
fd
;
int
timeout
,
attempts
,
retry_interval
,
servfail_retry
;
...
...
@@ -45,19 +46,15 @@ int __res_msend(int nqueries, const unsigned char *const *queries,
int
cs
;
struct
pollfd
pfd
;
unsigned
long
t0
,
t1
,
t2
;
struct
resolvconf
conf
;
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
cs
);
/* Get nameservers & timeout/retry settings from resolv.conf */
if
(
__get_resolv_conf
(
&
conf
,
0
,
0
)
<
0
)
return
-
1
;
timeout
=
1000
*
conf
.
timeout
;
attempts
=
conf
.
attempts
;
timeout
=
1000
*
conf
->
timeout
;
attempts
=
conf
->
attempts
;
nns
=
conf
.
nns
;
for
(
nns
=
0
;
nns
<
conf
.
nns
;
nns
++
)
{
struct
address
*
iplit
=
&
conf
.
ns
[
nns
];
nns
=
conf
->
nns
;
for
(
nns
=
0
;
nns
<
conf
->
nns
;
nns
++
)
{
const
struct
address
*
iplit
=
&
conf
->
ns
[
nns
];
if
(
iplit
->
family
==
AF_INET
)
{
memcpy
(
&
ns
[
nns
].
sin
.
sin_addr
,
iplit
->
addr
,
4
);
ns
[
nns
].
sin
.
sin_port
=
htons
(
53
);
...
...
@@ -178,3 +175,11 @@ out:
return
0
;
}
int
__res_msend
(
int
nqueries
,
const
unsigned
char
*
const
*
queries
,
const
int
*
qlens
,
unsigned
char
*
const
*
answers
,
int
*
alens
,
int
asize
)
{
struct
resolvconf
conf
;
if
(
__get_resolv_conf
(
&
conf
,
0
,
0
)
<
0
)
return
-
1
;
return
__res_msend_rc
(
nqueries
,
queries
,
qlens
,
answers
,
alens
,
asize
,
&
conf
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录