mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
windows: Incorrect check while fetching adapter addresses
Checking for ERROR_INSUFFICIENT_BUFFER is incorrect per MSFT documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx Also, the initial call to GetAdaptersAddresses was wrong. In the case of a successful return 'all_addr' was not allocated leading to a crash. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-by: Lior Baram <lior.baram@hpe.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
This commit is contained in:
committed by
Gurucharan Shetty
parent
d7039b9a68
commit
e83cb65878
@@ -425,16 +425,16 @@ netdev_windows_get_next_hop(const struct in_addr *host,
|
||||
{
|
||||
uint32_t ret_val = 0;
|
||||
/* The buffer length of all addresses */
|
||||
uint32_t buffer_length = 1000;
|
||||
uint32_t buffer_length = 0;
|
||||
PIP_ADAPTER_ADDRESSES all_addr = NULL;
|
||||
PIP_ADAPTER_ADDRESSES cur_addr = NULL;
|
||||
|
||||
ret_val = GetAdaptersAddresses(AF_INET,
|
||||
GAA_FLAG_INCLUDE_PREFIX |
|
||||
GAA_FLAG_INCLUDE_GATEWAYS,
|
||||
NULL, all_addr, &buffer_length);
|
||||
NULL, NULL, &buffer_length);
|
||||
|
||||
if (ret_val != ERROR_INSUFFICIENT_BUFFER ) {
|
||||
if (ret_val != ERROR_BUFFER_OVERFLOW ) {
|
||||
VLOG_ERR("Call to GetAdaptersAddresses failed with error: %s",
|
||||
ovs_format_message(ret_val));
|
||||
return ENXIO;
|
||||
|
||||
Reference in New Issue
Block a user