Revision: 14731
Author: adrian.chadd
Date: Sun Jul 11 03:07:35 2010
Log: IPv6: migrate the errorpage source address to be IPv6 aware.


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

Modified:
 /playpen/LUSCA_HEAD_ipv6/src/errorpage.c
 /playpen/LUSCA_HEAD_ipv6/src/structs.h

=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/errorpage.c    Sun Jul 11 02:16:20 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/errorpage.c    Sun Jul 11 03:07:35 2010
@@ -270,9 +270,10 @@
     err->page_id = type;    /* has to be reset manually if needed */
     err->type = type;
     err->http_status = status;
+    sqinet_init(&err->src_addr2);
     if (request != NULL) {
        err->request = requestLink(request);
-       err->src_addr = request->client_addr;
+        errorSetAddr4(err, request->client_addr);
     }
     return err;
 }
@@ -280,13 +281,13 @@
 void
 errorSetAddr(ErrorState *err, sqaddr_t *ip)
 {
-       err->src_addr = sqinet_get_v4_inaddr(ip, SQADDR_ASSERT_IS_V4);
+       sqinet_copy(&err->src_addr2, ip);
 }

 void
 errorSetAddr4(ErrorState *err, struct in_addr ip)
 {
-       err->src_addr = ip;
+       sqinet_set_v4_inaddr(&err->src_addr2, &ip);
 }

 /*
@@ -424,6 +425,7 @@
     if (err->auth_user_request)
        authenticateAuthUserRequestUnlock(err->auth_user_request);
     err->auth_user_request = NULL;
+    sqinet_done(&err->src_addr2);
     cbdataFree(err);
 }

@@ -466,6 +468,7 @@
     static MemBuf mb = MemBufNULL;
     const char *p = NULL;      /* takes priority over mb if set */
     int do_quote = 1;
+    LOCAL_ARRAY(char, buf, MAX_IPSTRLEN);

     memBufReset(&mb);
     switch (token) {
@@ -521,7 +524,8 @@
            p = "[unknown host]";
        break;
     case 'i':
-       memBufPrintf(&mb, "%s", inet_ntoa(err->src_addr));
+       (void) sqinet_ntoa(&err->src_addr2, buf, sizeof(buf), SQADDR_NONE);
+       memBufPrintf(&mb, "%s", buf);
        break;
     case 'I':
        if (r && r->hier.host) {
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/structs.h      Sun Jul 11 02:47:00 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/structs.h      Sun Jul 11 03:07:35 2010
@@ -1728,7 +1728,7 @@
     int xerrno;
     char *dnsserver_msg;
     time_t ttl;
-    struct in_addr src_addr;
+    sqaddr_t src_addr2;
     char *redirect_url;
     ERCB *callback;
     void *callback_data;

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