Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
fc657985
Commit
fc657985
authored
Sep 05, 2017
by
jehan
Browse files
remove IPV6 DNS with scope local when sin6_scope_id is not available from res_getservers
parent
6fc38ad6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
src/dns.c
src/dns.c
+17
-3
No files found.
src/dns.c
View file @
fc657985
...
...
@@ -118,6 +118,7 @@
#include <bctoolbox/port.h>
#include <bctoolbox/defs.h>
#include <belle-sip/utils.h>
/*
* C O M P I L E R V E R S I O N & F E A T U R E D E T E C T I O N
...
...
@@ -5004,7 +5005,8 @@ int dns_resconf_loadandroid(struct dns_resolv_conf *resconf) {
int
dns_resconf_loadfromresolv
(
struct
dns_resolv_conf
*
resconf
)
{
struct
__res_state
res
;
union
res_sockaddr_union
addresses
[
3
];
int
i
,
error
;
int
i
,
error
,
write_index
;
if
((
error
=
res_ninit
(
&
res
)))
{
return
error
;
...
...
@@ -5012,8 +5014,17 @@ int dns_resconf_loadfromresolv(struct dns_resolv_conf *resconf) {
error
=
res_getservers
(
&
res
,
addresses
,
3
);
if
(
error
>
0
){
for
(
i
=
0
;
i
<
error
;
i
++
)
{
memcpy
(
&
resconf
->
nameserver
[
i
],
&
addresses
[
i
],
sizeof
(
union
res_sockaddr_union
));
for
(
i
=
0
,
write_index
=
0
;
i
<
error
;
i
++
)
{
if
(
(
addresses
[
i
].
sin
.
sin_family
==
AF_INET6
)
&&
(
addresses
[
i
].
sin6
.
sin6_addr
.
__u6_addr
.
__u6_addr16
[
0
]
==
0x80fe
)
/*local link*/
&&
(
addresses
[
i
].
sin6
.
sin6_scope_id
==
0
)
)
{
char
ip
[
32
];
bctbx_sockaddr_to_printable_ip_address
((
struct
sockaddr
*
)
&
addresses
[
i
].
sin6
,
sizeof
(
struct
sockaddr
),
ip
,
sizeof
(
ip
));
belle_sip_error
(
"DNS entry [%s] cannot be used without scope id"
,
ip
);
}
else
{
memcpy
(
&
resconf
->
nameserver
[
write_index
++
],
&
addresses
[
i
],
sizeof
(
union
res_sockaddr_union
));
}
}
error
=
0
;
}
else
error
=-
1
;
...
...
@@ -7725,6 +7736,9 @@ exec:
||
error
==
DNS_ECONNRESET
||
error
==
EINVAL
||
error
==
DNS_EHOSTUNREACH
)
{
/* maybe even more case*/
char
remote_sock
[
64
];
bctbx_sockaddr_to_printable_ip_address
((
struct
sockaddr
*
)
&
R
->
so
.
remote
,
R
->
so
.
remote
.
ss_len
,
remote_sock
,
sizeof
(
remote_sock
));
belle_sip_error
(
"Cannot reach [%s] because [%s]"
,
remote_sock
,
strerror
(
error
));
dgoto
(
R
->
sp
,
DNS_R_FOREACH_A
);
}
else
goto
error
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment