Revision: 14796
Author: adrian.chadd
Date: Tue Sep  7 00:31:56 2010
Log: Migrate fwdState->src to an IPv6-aware setup.


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

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

=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/forward.c      Mon Sep  6 22:29:42 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/forward.c      Tue Sep  7 00:31:56 2010
@@ -126,6 +126,7 @@
        debug(17, 3) ("fwdStateFree: closing FD %d\n", sfd);
        comm_close(sfd);
     }
+    sqinet_done(&fwdState->src_ip);
     cbdataFree(fwdState);
 }

@@ -547,7 +548,10 @@

/* If tproxy then try with the tproxy details. If this fails then retry w/ non-tproxy */
     if (fwdState->request->flags.tproxy && do_tproxy) {
-        fd = comm_open(SOCK_STREAM, IPPROTO_TCP, fwdState->src.sin_addr, 0,
+       struct in_addr src;
+#warning IPv6-ify!
+       src = sqinet_get_v4_inaddr(&fwdState->src_ip, SQADDR_ASSERT_IS_V4);
+        fd = comm_open(SOCK_STREAM, IPPROTO_TCP, src, 0,
           COMM_NONBLOCKING | COMM_TPROXY_REM, tos, url);
     }
     if (fd == -1) {
@@ -919,6 +923,7 @@
     fwdState->request = requestLink(r);
     fwdState->start = squid_curtime;
     fwdState->orig_entry_flags = e->flags;
+    sqinet_init(&fwdState->src_ip);
     storeLockObject(e);
     if (!fwdState->request->flags.pinned)
        EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT);
@@ -993,7 +998,7 @@
     /* If we need to transparently proxy the request
      * then we need the client source address and port */
/* XXX should we only do this if the request has the tproxy flag set?! */ - fwdState->src = sqinet_get_v4_sockaddr(&r->client_address, SQADDR_ASSERT_IS_V4);
+    sqinet_copy(&fwdState->src_ip, &r->client_address);

     storeLockObject(e);
     if (!fwdState->request->flags.pinned)
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/structs.h      Mon Sep  6 22:29:42 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/structs.h      Tue Sep  7 00:31:56 2010
@@ -1897,7 +1897,7 @@
        unsigned int dont_retry:1;
        unsigned int ftp_pasv_failed:1;
     } flags;
-    struct sockaddr_in src;
+    sqaddr_t src_ip;
u_short orig_entry_flags; /* Hack to be able to reset the entry proper */
 };

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