Revision: 14870
Author: adrian.chadd
Date: Sat Jul 9 02:12:20 2011
Log: Convert ipcacheCheckNumeric() to use sqaddr_aton(); this allows
it now
to handle IPv4 and IPv6 numeric addresses.
Note: getaddrinfo() doesn't at all like IPv6 addresses with []'s around
them;
so they have to be stripped off prior to calling sqinet_aton().
http://code.google.com/p/lusca-cache/source/detail?r=14870
Modified:
/playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.c
=======================================
--- /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.c Tue Jan 18 16:28:07 2011
+++ /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.c Sat Jul 9 02:12:20 2011
@@ -543,16 +543,20 @@
ipcache_addrs *
ipcacheCheckNumeric(const char *name)
{
- struct in_addr ip;
+ sqaddr_t s;
+ sqinet_init(&s);
/* check if it's already a IP address in text form. */
- if (!safe_inet_addr(name, &ip))
- return NULL;
+ if (! sqinet_aton(&s, name, SQATON_NONE)) {
+ sqinet_done(&s);
+ return NULL;
+ }
static_addrs.count = 1;
static_addrs.cur = 0;
sqinet_init(&static_addrs.in_addrs6[0]);
- sqinet_set_v4_inaddr(&static_addrs.in_addrs6[0], &ip);
+ sqinet_copy(&static_addrs.in_addrs6[0], &s);
static_addrs.bad_mask[0] = FALSE;
static_addrs.badcount = 0;
+ sqinet_done(&s);
return &static_addrs;
}
--
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en.