[ovs-dev] Use set-controller command with DNS Name
Vishal Swarankar
vishal.swarnkar at gmail.com
Wed Dec 22 11:12:17 UTC 2010
Hi,
I want to use ovs-vsctl set-controller command with DNS name, so I made
following changes in the code. I hope, I don't need to do any another
change. Please tell me if you see anyother issue.
thnx
Vishal
--------------------------------------
lib/socket-util.c
int
lookup_ip(const char *host_name, struct in_addr *addr)
{
+ struct hostent* host_addr;
+if(atoi(host_name) > 0 ) {
if (!inet_aton(host_name, 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;
}
+}
+else {
+if((host_addr =gethostbyname(host_name)) == NULL) {
+ struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+ VLOG_ERR_RL(&rl, "\"%s\" is not a valid Host name", host_name);
+ return ENOENT;
+ }
+ bcopy(host_addr->h_addr, (char*)addr, sizeof(addr));
+}
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20101222/fcee1d1e/attachment-0003.html>
More information about the dev
mailing list