I have a LAN/GPIB adapter that (stupidly) uses its MAC address as its hostname when getting an address from a DHCP server. I find that I can't use such an address with the ASYN vxi11Configure command:
The problem is that the aToIPAddr routine sees a number as the first part of an address and gives up. I think that the fix is to remove the first test after the first sscanf:
epicsShareFunc int epicsShareAPI
aToIPAddr(const char *pAddrString, unsigned short defaultPort, struct sockaddr_in *pIP)
{
int status;
unsigned short addr[4];
unsigned long rawAddr;
char hostName[512]; /* !! change n elements here requires change in format below !! */
unsigned short port;
struct in_addr ina;
/*
* dotted ip addresses
*/
status = sscanf (pAddrString, " %hu.%hu.%hu.%hu:%hu",
addr, addr+1u, addr+2u, addr+3u, &port);
if (status>0) { <<<<<< I THINK THAT THIS TEST SHOULD JUST BE REMOVED
if (status>=4) {
if ( addrArrayToUL ( addr, NELEMENTS ( addr ), &ina ) < 0 ) {
return -1;
}
if (status==4) {
port = defaultPort;
}
return initIPAddr (ina, port, pIP);
}
else { <<<<<<AND THESE LINES, TOO
return -1; <<<<<<AND THESE LINES, TOO
} <<<<<<AND THESE LINES, TOO
}