Smith, Stan
2013-04-17 00:08:42 UTC
getaddrinfo("..localmachine", NULL, NULL, &res); used to return the IPv4 address bound to the local IPoIB; in preference to the IPv6 address.
Today, getaddrinfo() returns the IPv6 address, default IPv6 address in some cases.
Use 'hint' struct to qualify which local IPoIB address is desired (IPv4).
Signed-off-by: stan smith ***@intel.com<mailto:***@intel.com>
--- C:/Users/scsmith/AppData/Local/Temp/util.c-revBASE.svn000.tmp.c Tue Apr 24 10:35:27 2012
+++ C:/Users/scsmith/Documents/openIB-windows/ofw/gen1/trunk/ulp/dapl2/dapl/openib_common/util.c Tue Apr 16 15:14:55 2013
@@ -39,7 +39,7 @@
{
IWVProvider *prov;
WV_DEVICE_ADDRESS devaddr;
- struct addrinfo *res, *ai;
+ struct addrinfo *res, hint, *ai;
HRESULT hr;
int index;
@@ -54,10 +54,15 @@
return hr;
}
- hr = getaddrinfo("..localmachine", NULL, NULL, &res);
- if (hr) {
+ memset(&hint, 0, sizeof hint);
+ hint.ai_flags = AI_PASSIVE;
+ hint.ai_family = AF_INET;
+ hint.ai_socktype = SOCK_STREAM;
+ hint.ai_protocol = IPPROTO_TCP;
+
+ hr = getaddrinfo("..localmachine", NULL, &hint, &res);
+ if (hr)
goto release;
- }
for (ai = res; ai; ai = ai->ai_next) {
hr = prov->lpVtbl->TranslateAddress(prov, ai->ai_addr, &devaddr);
Today, getaddrinfo() returns the IPv6 address, default IPv6 address in some cases.
Use 'hint' struct to qualify which local IPoIB address is desired (IPv4).
Signed-off-by: stan smith ***@intel.com<mailto:***@intel.com>
--- C:/Users/scsmith/AppData/Local/Temp/util.c-revBASE.svn000.tmp.c Tue Apr 24 10:35:27 2012
+++ C:/Users/scsmith/Documents/openIB-windows/ofw/gen1/trunk/ulp/dapl2/dapl/openib_common/util.c Tue Apr 16 15:14:55 2013
@@ -39,7 +39,7 @@
{
IWVProvider *prov;
WV_DEVICE_ADDRESS devaddr;
- struct addrinfo *res, *ai;
+ struct addrinfo *res, hint, *ai;
HRESULT hr;
int index;
@@ -54,10 +54,15 @@
return hr;
}
- hr = getaddrinfo("..localmachine", NULL, NULL, &res);
- if (hr) {
+ memset(&hint, 0, sizeof hint);
+ hint.ai_flags = AI_PASSIVE;
+ hint.ai_family = AF_INET;
+ hint.ai_socktype = SOCK_STREAM;
+ hint.ai_protocol = IPPROTO_TCP;
+
+ hr = getaddrinfo("..localmachine", NULL, &hint, &res);
+ if (hr)
goto release;
- }
for (ai = res; ai; ai = ai->ai_next) {
hr = prov->lpVtbl->TranslateAddress(prov, ai->ai_addr, &devaddr);