1 Index: squid/src/client_side.c
2 diff -c squid/src/client_side.c:1.561.2.77 squid/src/client_side.c:1.561.2.80
3 *** squid/src/client_side.c:1.561.2.77 Thu Jun 9 01:51:47 2005
4 --- squid/src/client_side.c Thu Jun 30 02:38:00 2005
9 + static time_t last_reported = 0;
10 natLookup.nl_inport = http->conn->me.sin_port;
11 natLookup.nl_outport = http->conn->peer.sin_port;
12 natLookup.nl_inip = http->conn->me.sin_addr;
13 @@ -2751,12 +2752,10 @@
17 - debug(50, 1) ("parseHttpRequest: NAT open failed: %s\n",
19 - dlinkDelete(&http->active, &ClientActiveRequests);
23 + if (squid_curtime - last_reported > 60) {
24 + debug(50, 1) ("parseHttpRequest: NAT open failed: %s\n", xstrerror());
25 + last_reported = squid_curtime;
29 * IP-Filter changed the type for SIOCGNATL between
30 @@ -2773,48 +2772,59 @@
34 - debug(50, 1) ("parseHttpRequest: NAT lookup failed: ioctl(SIOCGNATL)\n");
35 + if (squid_curtime - last_reported > 60) {
36 + debug(50, 1) ("parseHttpRequest: NAT lookup failed: ioctl(SIOCGNATL): %s\n", xstrerror());
37 + last_reported = squid_curtime;
41 - dlinkDelete(&http->active, &ClientActiveRequests);
47 conn->me.sin_port = natLookup.nl_realport;
48 - http->conn->me.sin_addr = natLookup.nl_realip;
49 + conn->me.sin_addr = natLookup.nl_realip;
53 + static time_t last_reported = 0;
55 pffd = open("/dev/pf", O_RDWR);
57 - debug(50, 1) ("parseHttpRequest: PF open failed: %s\n",
59 - return parseHttpRequestAbort(conn, "error:pf-open-failed");
61 - memset(&nl, 0, sizeof(struct pfioc_natlook));
62 - nl.saddr.v4.s_addr = http->conn->peer.sin_addr.s_addr;
63 - nl.sport = http->conn->peer.sin_port;
64 - nl.daddr.v4.s_addr = http->conn->me.sin_addr.s_addr;
65 - nl.dport = http->conn->me.sin_port;
67 - nl.proto = IPPROTO_TCP;
68 - nl.direction = PF_OUT;
69 - if (ioctl(pffd, DIOCNATLOOK, &nl)) {
70 - if (errno != ENOENT) {
71 - debug(50, 1) ("parseHttpRequest: PF lookup failed: ioctl(DIOCNATLOOK)\n");
74 + if (squid_curtime - last_reported > 60) {
75 + debug(50, 1) ("parseHttpRequest: PF open failed: %s\n", xstrerror());
76 + last_reported = squid_curtime;
79 - conn->me.sin_port = nl.rdport;
80 - http->conn->me.sin_addr = nl.rdaddr.v4;
81 + memset(&nl, 0, sizeof(struct pfioc_natlook));
82 + nl.saddr.v4.s_addr = http->conn->peer.sin_addr.s_addr;
83 + nl.sport = http->conn->peer.sin_port;
84 + nl.daddr.v4.s_addr = http->conn->me.sin_addr.s_addr;
85 + nl.dport = http->conn->me.sin_port;
87 + nl.proto = IPPROTO_TCP;
88 + nl.direction = PF_OUT;
89 + if (ioctl(pffd, DIOCNATLOOK, &nl)) {
90 + if (errno != ENOENT) {
91 + if (squid_curtime - last_reported > 60) {
92 + debug(50, 1) ("parseHttpRequest: PF lookup failed: ioctl(DIOCNATLOOK): %s\n", xstrerror());
93 + last_reported = squid_curtime;
99 + conn->me.sin_port = nl.rdport;
100 + conn->me.sin_addr = nl.rdaddr.v4;
103 #elif LINUX_NETFILTER
104 + static time_t last_reported = 0;
105 /* If the call fails the address structure will be unchanged */
106 - getsockopt(conn->fd, SOL_IP, SO_ORIGINAL_DST, &conn->me, &sock_sz);
107 + if (getsockopt(conn->fd, SOL_IP, SO_ORIGINAL_DST, &conn->me, &sock_sz) != 0) {
108 + if (squid_curtime - last_reported > 60) {
109 + debug(50, 1) ("parseHttpRequest: NF getsockopt(SO_ORIGINAL_DST) failed: %s\n", xstrerror());
110 + last_reported = squid_curtime;