Revision: 14883
Author: adrian.chadd
Date: Sat Jul 9 19:10:58 2011
Log: Teach outgoing_address (and the "acl_address" type) about IPv6
addresses.
http://code.google.com/p/lusca-cache/source/detail?r=14883
Modified:
/playpen/LUSCA_HEAD_ipv6/src/cache_cf.c
/playpen/LUSCA_HEAD_ipv6/src/forward.c
/playpen/LUSCA_HEAD_ipv6/src/structs.h
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/cache_cf.c Tue Sep 7 02:24:46 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/cache_cf.c Sat Jul 9 19:10:58 2011
@@ -843,9 +843,12 @@
dump_acl_address(StoreEntry * entry, const char *name, acl_address * head)
{
acl_address *l;
+ char buf[MAX_IPSTRLEN];
+
for (l = head; l; l = l->next) {
- if (l->addr.s_addr != INADDR_ANY)
- storeAppendPrintf(entry, "%s %s", name, inet_ntoa(l->addr));
+ (void) sqinet_ntoa(&l->addr, buf, MAX_IPSTRLEN,
SQADDR_NO_BRACKET_V6);
+ if (! sqinet_is_anyaddr(&l->addr))
+ storeAppendPrintf(entry, "%s %s", name, buf);
else
storeAppendPrintf(entry, "%s autoselect", name);
dump_acl_list(entry, l->acl_list);
@@ -857,6 +860,7 @@
freed_acl_address(void *data)
{
acl_address *l = data;
+ sqinet_done(&l->addr);
aclDestroyAclList(&l->acl_list);
}
@@ -867,7 +871,8 @@
acl_address **tail = head; /* sane name below */
CBDATA_INIT_TYPE_FREECB(acl_address, freed_acl_address);
l = cbdataAlloc(acl_address);
- parse_address(&l->addr);
+ sqinet_init(&l->addr);
+ parse_address46(&l->addr);
aclParseAclList(&l->acl_list);
while (*tail)
tail = &(*tail)->next;
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/forward.c Sat Jul 9 19:02:23 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/forward.c Sat Jul 9 19:10:58 2011
@@ -497,8 +497,10 @@
struct in_addr addr;
aclChecklistCacheInit(ch);
for (l = head; l; l = l->next) {
- if (aclMatchAclList(l->acl_list, ch))
- return l->addr;
+ if (sqinet_get_family(&l->addr) == AF_INET &&
+ aclMatchAclList(l->acl_list, ch)) {
+ return sqinet_get_v4_inaddr(&l->addr, SQADDR_ASSERT_IS_V4);
+ }
}
addr.s_addr = INADDR_ANY;
return addr;
@@ -507,22 +509,20 @@
/*
* This is designed for IPv6 only, but eventually
* IPv4/IPv6 lookups should just use this function and
- * ACL map.
+ * ACL map (but call it separately for v4/v6 addresses.)
*/
static int
aclMapAddr6(acl_address * head, aclCheck_t * ch, sqaddr_t *a)
{
-#if 0
acl_address *l;
- struct in_addr addr;
aclChecklistCacheInit(ch);
for (l = head; l; l = l->next) {
- if (aclMatchAclList(l->acl_list, ch))
- return l->addr;
- }
- addr.s_addr = INADDR_ANY;
- return addr;
-#endif
+ if (sqinet_get_family(&l->addr) == AF_INET6 &&
+ aclMatchAclList(l->acl_list, ch)) {
+ sqinet_copy(a, &l->addr);
+ return 1;
+ }
+ }
sqinet_set_family(a, AF_INET6);
sqinet_set_anyaddr(a);
return 0;
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/structs.h Fri Jul 8 22:32:28 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/structs.h Sat Jul 9 19:10:58 2011
@@ -275,7 +275,7 @@
struct _acl_address {
acl_address *next;
acl_list *acl_list;
- struct in_addr addr;
+ sqaddr_t addr;
};
struct _acl_tos {
--
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.