forked from espressif/esp-modbus
modbus fix check of host name
This commit is contained in:
@@ -498,7 +498,7 @@ static BOOL xMBTCPPortMasterCheckHost(const CHAR *pcHostStr, ip_addr_t *pxHostAd
|
|||||||
if (pxHostAddr) {
|
if (pxHostAddr) {
|
||||||
*pxHostAddr = xTargetAddr;
|
*pxHostAddr = xTargetAddr;
|
||||||
}
|
}
|
||||||
ESP_LOGI(TAG, "Host[IP]: \"%s\"[%s]", pxAddrList->ai_canonname, pcStr);
|
ESP_LOGI(TAG, "Host[IP]: [%s]", pcStr);
|
||||||
freeaddrinfo(pxAddrList);
|
freeaddrinfo(pxAddrList);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -381,13 +381,7 @@ vMBTCPPortBindAddr(const CHAR* pcBindIp)
|
|||||||
xHint.ai_socktype = (xConfig.eMbProto == MB_PROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
|
xHint.ai_socktype = (xConfig.eMbProto == MB_PROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
|
||||||
// The LWIP has an issue when connection to IPv6 socket
|
// The LWIP has an issue when connection to IPv6 socket
|
||||||
xHint.ai_protocol = (xConfig.eMbProto == MB_PROTO_UDP) ? IPPROTO_UDP : IPPROTO_TCP;
|
xHint.ai_protocol = (xConfig.eMbProto == MB_PROTO_UDP) ? IPPROTO_UDP : IPPROTO_TCP;
|
||||||
xHint.ai_flags = AI_NUMERICSERV;
|
xHint.ai_flags = AI_NUMERICSERV | AI_PASSIVE | AI_CANONNAME;
|
||||||
|
|
||||||
if (pcBindIp == NULL) {
|
|
||||||
xHint.ai_flags |= AI_PASSIVE;
|
|
||||||
} else {
|
|
||||||
xHint.ai_flags |= AI_CANONNAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (asprintf(&pcStr, "%u", xConfig.usPort) == -1) {
|
if (asprintf(&pcStr, "%u", xConfig.usPort) == -1) {
|
||||||
abort();
|
abort();
|
||||||
|
Reference in New Issue
Block a user