mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
Do not try to resolve DNS for OpenFlow controllers or netflow collectors.
Until now, setting a netflow collector to a DNS name would cause secchan to attempt to resolve that DNS name each time that the set of netflow collectors is re-set. For the vswitch, this is every time that the vswitch reconfigures itself. Unfortunately, DNS lookup within secchan cannot work as currently implemented, because it needs both an asynchronous DNS resolver library and in-band control updates. Currently we have neither. Attempting to look up DNS anyway just hangs. This commit disables DNS lookup entirely, and updates the documentation to change user expectations. DNS still won't work, but at least it won't hang. Bug #1609.
This commit is contained in:
@@ -72,25 +72,16 @@ get_max_fds(void)
|
||||
return max_fds;
|
||||
}
|
||||
|
||||
/* Translates 'host_name', which may be a DNS name or an IP address, into a
|
||||
* numeric IP address in '*addr'. Returns 0 if successful, otherwise a
|
||||
* positive errno value. */
|
||||
/* Translates 'host_name', which must be a string representation of an IP
|
||||
* address, into a numeric IP address in '*addr'. Returns 0 if successful,
|
||||
* otherwise a positive errno value. */
|
||||
int
|
||||
lookup_ip(const char *host_name, struct in_addr *addr)
|
||||
{
|
||||
if (!inet_aton(host_name, addr)) {
|
||||
struct hostent *he = gethostbyname(host_name);
|
||||
if (he == NULL) {
|
||||
struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
|
||||
VLOG_ERR_RL(&rl, "gethostbyname(%s): %s", host_name,
|
||||
(h_errno == HOST_NOT_FOUND ? "host not found"
|
||||
: h_errno == TRY_AGAIN ? "try again"
|
||||
: h_errno == NO_RECOVERY ? "non-recoverable error"
|
||||
: h_errno == NO_ADDRESS ? "no address"
|
||||
: "unknown error"));
|
||||
return ENOENT;
|
||||
}
|
||||
addr->s_addr = *(uint32_t *) he->h_addr;
|
||||
struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
|
||||
VLOG_ERR_RL(&rl, "\"%s\" is not a valid IP address", host_name);
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user