Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
873034c7
Commit
873034c7
authored
Oct 11, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Oct 12, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Set DNS servers in GetAdaptersAddresses when GAA_FLAG_SKIP_DNS_SERVER isn't specified.
parent
434cd6c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
1 deletion
+66
-1
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+66
-1
No files found.
dlls/iphlpapi/iphlpapi_main.c
View file @
873034c7
...
...
@@ -924,11 +924,55 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, DWORD index,
return
ERROR_SUCCESS
;
}
static
ULONG
get_dns_server_addresses
(
PIP_ADAPTER_DNS_SERVER_ADDRESS
address
,
ULONG
*
len
)
{
DWORD
size
;
initialise_resolver
();
/* FIXME: no support for IPv6 DNS server addresses. Doing so requires
* sizeof SOCKADDR_STORAGE instead, and using _res._u._ext.nsaddrs when
* available.
*/
size
=
_res
.
nscount
*
(
sizeof
(
IP_ADAPTER_DNS_SERVER_ADDRESS
)
+
sizeof
(
SOCKADDR
));
if
(
!
address
||
*
len
<
size
)
{
*
len
=
size
;
return
ERROR_BUFFER_OVERFLOW
;
}
*
len
=
size
;
if
(
_res
.
nscount
>
0
)
{
PIP_ADAPTER_DNS_SERVER_ADDRESS
addr
;
int
i
;
for
(
i
=
0
,
addr
=
address
;
i
<
_res
.
nscount
&&
addr
;
i
++
,
addr
=
addr
->
Next
)
{
SOCKADDR_IN
*
sin
;
addr
->
Address
.
iSockaddrLength
=
sizeof
(
SOCKADDR
);
addr
->
Address
.
lpSockaddr
=
(
LPSOCKADDR
)((
PBYTE
)
addr
+
sizeof
(
IP_ADAPTER_DNS_SERVER_ADDRESS
));
sin
=
(
SOCKADDR_IN
*
)
addr
->
Address
.
lpSockaddr
;
sin
->
sin_family
=
WS_AF_INET
;
sin
->
sin_port
=
_res
.
nsaddr_list
[
i
].
sin_port
;
memcpy
(
&
sin
->
sin_addr
,
&
_res
.
nsaddr_list
[
i
].
sin_addr
,
sizeof
(
sin
->
sin_addr
));
if
(
i
==
_res
.
nscount
-
1
)
addr
->
Next
=
NULL
;
else
addr
->
Next
=
(
PIP_ADAPTER_DNS_SERVER_ADDRESS
)((
PBYTE
)
addr
+
sizeof
(
IP_ADAPTER_DNS_SERVER_ADDRESS
)
+
sizeof
(
SOCKADDR
));
}
}
return
ERROR_SUCCESS
;
}
ULONG
WINAPI
GetAdaptersAddresses
(
ULONG
family
,
ULONG
flags
,
PVOID
reserved
,
PIP_ADAPTER_ADDRESSES
aa
,
PULONG
buflen
)
{
InterfaceIndexTable
*
table
;
ULONG
i
,
size
,
total_size
,
ret
=
ERROR_NO_DATA
;
ULONG
i
,
size
,
dns_server_size
,
total_size
,
ret
=
ERROR_NO_DATA
;
TRACE
(
"(%d, %08x, %p, %p, %p)
\n
"
,
family
,
flags
,
reserved
,
aa
,
buflen
);
...
...
@@ -951,9 +995,20 @@ ULONG WINAPI GetAdaptersAddresses(ULONG family, ULONG flags, PVOID reserved,
}
total_size
+=
size
;
}
if
(
!
(
flags
&
GAA_FLAG_SKIP_DNS_SERVER
))
{
/* Since DNS servers aren't really per adapter, get enough space for a
* single copy of them.
*/
get_dns_server_addresses
(
NULL
,
&
dns_server_size
);
total_size
+=
dns_server_size
;
}
if
(
aa
&&
*
buflen
>=
total_size
)
{
ULONG
bytes_left
=
size
=
total_size
;
PIP_ADAPTER_ADDRESSES
first_aa
=
aa
;
PIP_ADAPTER_DNS_SERVER_ADDRESS
firstDns
;
for
(
i
=
0
;
i
<
table
->
numIndexes
;
i
++
)
{
if
((
ret
=
adapterAddressesFromIndex
(
family
,
flags
,
table
->
indexes
[
i
],
aa
,
&
size
)))
...
...
@@ -968,6 +1023,16 @@ ULONG WINAPI GetAdaptersAddresses(ULONG family, ULONG flags, PVOID reserved,
size
=
bytes_left
-=
size
;
}
}
if
(
!
(
flags
&
GAA_FLAG_SKIP_DNS_SERVER
))
{
firstDns
=
(
PIP_ADAPTER_DNS_SERVER_ADDRESS
)((
BYTE
*
)
aa
+
total_size
-
dns_server_size
);
get_dns_server_addresses
(
firstDns
,
&
dns_server_size
);
for
(
aa
=
first_aa
;
aa
;
aa
=
aa
->
Next
)
{
if
(
aa
->
IfType
!=
IF_TYPE_SOFTWARE_LOOPBACK
&&
aa
->
OperStatus
==
IfOperStatusUp
)
aa
->
FirstDnsServerAddress
=
firstDns
;
}
}
ret
=
ERROR_SUCCESS
;
}
if
(
*
buflen
<
total_size
)
ret
=
ERROR_BUFFER_OVERFLOW
;
...
...
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