Revision: 14802
Author: adrian.chadd
Date: Tue Sep  7 22:00:25 2010
Log: Merge r14788:14790 from /branches/LUSCA_HEAD_ipv6

Make the ASN code API "ipv6 aware" enough for initial hackery.


http://code.google.com/p/lusca-cache/source/detail?r=14802

Modified:
 /branches/LUSCA_HEAD/src/acl.c
 /branches/LUSCA_HEAD/src/asn.c
 /branches/LUSCA_HEAD/src/protos.h

=======================================
--- /branches/LUSCA_HEAD/src/acl.c      Sun May 23 05:26:34 2010
+++ /branches/LUSCA_HEAD/src/acl.c      Tue Sep  7 22:00:25 2010
@@ -2020,13 +2020,13 @@
        /* NOTREACHED */
 #endif
     case ACL_SRC_ASN:
-       return asnMatchIp(ae->data, checklist->src_addr);
+       return asnMatchIp4(ae->data, checklist->src_addr);
        /* NOTREACHED */
     case ACL_DST_ASN:
        ia = ipcache_gethostbyname(r->host, IP_LOOKUP_IF_MISS);
        if (ia) {
            for (k = 0; k < (int) ia->count; k++) {
-               if (asnMatchIp(ae->data, ia->in_addrs[k]))
+               if (asnMatchIp4(ae->data, ia->in_addrs[k]))
                    return 1;
            }
            return 0;
@@ -2035,7 +2035,7 @@
                ae->name, r->host);
            checklist->state[ACL_DST_ASN] = ACL_LOOKUP_NEEDED;
        } else {
-           return asnMatchIp(ae->data, no_addr);
+           return asnMatchIp4(ae->data, no_addr);
        }
        return 0;
        /* NOTREACHED */
=======================================
--- /branches/LUSCA_HEAD/src/asn.c      Sat Apr 17 21:14:22 2010
+++ /branches/LUSCA_HEAD/src/asn.c      Tue Sep  7 22:00:25 2010
@@ -80,8 +80,23 @@

 /* PUBLIC */

+
 int
-asnMatchIp(void *data, struct in_addr addr)
+asnMatchIp(void *data, sqaddr_t *v6addr)
+{
+       struct in_addr a;
+
+#warning ASN code needs to be made ipv6 aware
+
+    if (sqinet_get_family(v6addr) != AF_INET)
+        return 0;
+
+    a = sqinet_get_v4_inaddr(v6addr, SQADDR_ASSERT_IS_V4);
+    return asnMatchIp4(data, a);
+}
+
+int
+asnMatchIp4(void *data, struct in_addr addr)
 {
     as_info *e;
     intlist *a = NULL;
=======================================
--- /branches/LUSCA_HEAD/src/protos.h   Sun May 23 06:10:13 2010
+++ /branches/LUSCA_HEAD/src/protos.h   Tue Sep  7 22:00:25 2010
@@ -812,7 +812,8 @@
extern ErrorState *errorCon(err_type type, http_status, request_t * request);
 extern int errorPageId(const char *page_name);

-extern int asnMatchIp(void *, struct in_addr);
+extern int asnMatchIp(void *, sqaddr_t *);
+extern int asnMatchIp4(void *, struct in_addr);
 extern void asnInit(void);
 extern void asnFreeMemory(void);

--
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.

Reply via email to