diff -ruN squid-2.6.STABLE1/ChangeLog squid-2.6.STABLE2/ChangeLog --- squid-2.6.STABLE1/ChangeLog Sat Jul 1 12:41:21 2006 +++ squid-2.6.STABLE2/ChangeLog Sun Jul 30 20:53:23 2006 @@ -1,4 +1,82 @@ -Changes to squid-2.6 (1 Jul 2006) +Changes to squid-2.6.STABLE2 (31 Jul 2006) + + - WCCP2 doesn't update statCounter.syscalls.sock.sendtos counter. + - Releasenotes Table of contents should use relative links without + filename. + - Reject HTTP/0.9 formatted CONNECT requests. + - Cosmetic cleanup to use safe_free instead of xfree + manual + assign to NULL + - Bug #1650: transparent interception "Unable to forward this + request at this time" + - Bug #1658: Memory corruption when using client-side SSL certificates + - Add storeRecycle; a storeIO method to delete a StoreEntry w/out + deleting the underlying object. + - Many COSS fixes and new coss data dumper utility for diagnostics + - Bug #1669: SEGV in storeAddVaryReadOld + - Many fixes in debug sections and spelling of debug messages + - Don't keep client connection persistent if there was a mismatch in + the response size. + - Move eventCleanup debug messages to debug level 2 (was 0) + - Add the missing concurrency parameters to basic and digest auth + schemes + - Bug #1670: assertion failure: i->prefix_size > 0 in client_side.c:2509 + - Log SSL user id in the custom log User name format (%un) + - Bug #1653: Username info not logged into Cachemgr active_requests + statistics + - Added to the redirectors interface the support for SSL client + certificate + - squid.conf.default cleanup to remove references to old options + - Fix many filedescriptors in combination with TPROXY + - Fix connection pinning in transparently intercepted connections + - Bug #1679: LDFLAGS not honored in some programs. + - Minor cleanup of port numbers in transparent interception or + vhost + vport + - Bug #1671: transparent interception fails with FreeBSD ipfw or + Linux-2.2 ipchains + - Bug #1660: Accept-Encoding related memory corruption + - Bug #1651: Odd results if url_rewriter defined multiple times + - Bug #1655: Squid does not produce coredumps under linux when + started as root + - Bug #1673: cache digests not served to other caches + - Cleanup of Linux capability code used by tproxy + - Bug #1684: xstrdup: tried to dup a NULL pointer! + - Bug #1668: unchecked vsnprintf() return code could lead to log + corruption + - Bug #1688: Assertion failure in HttpHeader.c in some header_access + configurations + - Cygwin support fir --disable-internal-dns + - Silence those annoying sslReadServer: Connection reset by peer + errors. + - Bug #1693: persistent connections broken in transparent + interception mode + - Bug #1691: multicast peering issues + - Bug #1696: Correct WCCP2 processing of router capability info + segments + - Bug #1694: Assertion failure in mgr:config if using + access_log_format % - Squid 2.6.STABLE1 release notes + Squid 2.6 release notes -

Squid 2.6.STABLE1 release notes

+

Squid 2.6 release notes

-

Squid Developers

$Id: release-2.6.html,v 1.18 2006/06/30 21:21:37 hno Exp $ +

Squid Developers

$Id: release-2.6.html,v 1.27 2006/07/31 00:36:05 hno Exp $
This document contains the release notes for version 2.6 of Squid. Squid is a WWW Cache application developed by the Web Caching community.

-

1. Key changes from squid 2.5

+

1. Key changes from squid 2.5

-

2. Changes to squid.conf

+

2. Changes to squid.conf

-

3. Known issues

+

3. Known issues

-

4. Known limitations

+

4. Known limitations

-

5. Other issues

+

5. Other issues

-

6. Windows support

+

6. Windows support

+ +

+

7. Key changes squid-2.6.STABLE1 to 2.6.STABLE2


@@ -121,6 +124,7 @@
url_rewrite_concurrency

Activates a new and more efficient helper protocol. Requires changes in the helper.

location_rewrite_*

New helper hook for rewriting Location headers

auth_param basic blankpassword

New option to allow the use of blank passwords.

+
auth_param basic/digest concurrency

New option enabling a multiplexed helper protocol allowing the same helper to process multiple concurrent requests in an efficient manner. Requires support from the helper. (2.6.STABLE2 and later)

auth_param ntlm max_challenge_reuse / max_challenge_lifetime

No longer supported

auth_param ntlm use_ntlm_negotiate

Directive no longer supported. Use of NTLM negotiate packet is always on.

auth_param ntlm keep_alive

New option to fine-tune the use of HTTP keep-alive in combination with NTLM

@@ -143,6 +147,9 @@
error_map

New directive to allow dynamic rewrites of error pages

via

New directive to disable the use of the Via directive

wccp2_*

WCCP2 protocol support

+
minimum_expiry_time

tune the magic 60 seconds limit of what is considered cachable when the object doesn't have any cache validators. (2.6.STABLE2)

+
wccp2_rebuild_wait

make Squid delay registering with a WCCP router until store rebuild have finished. Default on. (2.6.STABLE2)

+

@@ -150,46 +157,31 @@

There is a few known issues in this version of Squid which we hope to correct in a later release

-

-
Bug -#1590

"ETag Loop" warnings in cache.log

-
Bug -#761

assertion failed: cbdata.c:249: "c->locks > 0" when using diskd

-
Bug -#1640

unstable if mixing coss cache_dir type with other cache_dir types (ufs/aufs/diskd).

-
Bug -#1602

Need to implement TCP fallback on truncated (large) DNS responses

-
+

4. Known limitations

In addition there is a set of limitations in this version of Squid which we hope to correct later

-

-
Bug -#1420

302 responses with an Expires header is always cached

-
Bug -#1584

WCCPv2 unable to register with more than one router on Linux

-
Bug -#1059

mime.conf and referenced icons must be within chroot

-
Bug -#692

tcp_outgoing_address using an ident ACL does not work

-
Bug -#581

acl max_user_ip and multiple authentication schemes

-
Bug -#528

miss_access fails on "slow" acl types such as dst.

-
Bug -#513

squid -F is starting server sockets to early

-
Bug -#457

does not handle swap.state corruption properly

-
Bug -#410

unstable if runs out of disk space

-
Bug -#355

diskd may appear slow on low loads

-
Bug -#219

delay_pools stops working on -k reconfigure

-
+

5. Other issues

@@ -319,6 +311,36 @@

+ + +

7. Key changes squid-2.6.STABLE1 to 2.6.STABLE2

+ +

+

+

+ diff -ruN squid-2.6.STABLE1/configure squid-2.6.STABLE2/configure --- squid-2.6.STABLE1/configure Sat Jul 1 12:42:47 2006 +++ squid-2.6.STABLE2/configure Sun Jul 30 20:53:51 2006 @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Revision: 1.384 . +# From configure.in Revision: 1.390 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE1. +# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE2. # # Report bugs to . # @@ -270,8 +270,8 @@ # Identity of this package. PACKAGE_NAME='Squid Web Proxy' PACKAGE_TARNAME='squid' -PACKAGE_VERSION='2.6.STABLE1' -PACKAGE_STRING='Squid Web Proxy 2.6.STABLE1' +PACKAGE_VERSION='2.6.STABLE2' +PACKAGE_STRING='Squid Web Proxy 2.6.STABLE2' PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/' ac_default_prefix=/usr/local/squid @@ -781,7 +781,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Squid Web Proxy 2.6.STABLE1 to adapt to many kinds of systems. +\`configure' configures Squid Web Proxy 2.6.STABLE2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -847,7 +847,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE1:";; + short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE2:";; esac cat <<\_ACEOF @@ -907,8 +907,6 @@ --enable-forw-via-db Enable Forw/Via database --enable-cache-digests Use Cache Digests see http://www.squid-cache.org/FAQ/FAQ-16.html - --enable-auth-on-acceleration - Enable authentication in accelerators --enable-default-err-language=lang Select default language for Error pages (see errors directory) @@ -1157,7 +1155,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Squid Web Proxy configure 2.6.STABLE1 +Squid Web Proxy configure 2.6.STABLE2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1171,7 +1169,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Squid Web Proxy $as_me 2.6.STABLE1, which was +It was created by Squid Web Proxy $as_me 2.6.STABLE2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1817,7 +1815,7 @@ # Define the identity of the package. PACKAGE='squid' - VERSION='2.6.STABLE1' + VERSION='2.6.STABLE2' cat >>confdefs.h <<_ACEOF @@ -4030,6 +4028,8 @@ ;; *-freebsd*) ;; + *-openbsd*) + ;; *-cygwin*) LIBS="$LIBS -liphlpapi" ;; @@ -4220,20 +4220,6 @@ fi; -# Check whether --enable-auth-on-acceleration or --disable-auth-on-acceleration was given. -if test "${enable_auth_on_acceleration+set}" = set; then - enableval="$enable_auth_on_acceleration" - if test "$enableval" = "yes" ; then - echo "AUTH_ON_ACCELERATION enabled" - -cat >>confdefs.h <<\_ACEOF -#define AUTH_ON_ACCELERATION 1 -_ACEOF - - fi - -fi; - # Check whether --enable-default-err-language or --disable-default-err-language was given. if test "${enable_default_err_language+set}" = set; then enableval="$enable_default_err_language" @@ -4646,6 +4632,11 @@ USE_DNSSERVER_FALSE= fi + case "$host_os" in + cygwin|cygwin32) + LIBS="$LIBS -lresolv" + ;; + esac fi # Check whether --enable-truncate or --disable-truncate was given. @@ -5613,7 +5604,7 @@ _ACEOF if test "$GCC" = "yes"; then - LDFLAGS="$CFLAGS -rdynamic" + LDFLAGS="$LDFLAGS -rdynamic" fi fi @@ -10639,9 +10630,9 @@ _ACEOF -echo "$as_me:$LINENO: checking size of __int64" >&5 -echo $ECHO_N "checking size of __int64... $ECHO_C" >&6 -if test "${ac_cv_sizeof___int64+set}" = set; then +echo "$as_me:$LINENO: checking size of int8_t" >&5 +echo $ECHO_N "checking size of int8_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int8_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -10676,7 +10667,7 @@ { FILE *f=fopen("conftestval", "w"); if (!f) return(1); - fprintf(f, "%d\n", (int)sizeof(__int64)); + fprintf(f, "%d\n", (int)sizeof(int8_t)); return(0); } @@ -10692,23 +10683,23 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sizeof___int64=`cat conftestval` + ac_cv_sizeof_int8_t=`cat conftestval` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -ac_cv_sizeof___int64=0 +ac_cv_sizeof_int8_t=0 fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof___int64" >&5 -echo "${ECHO_T}$ac_cv_sizeof___int64" >&6 +echo "$as_me:$LINENO: result: $ac_cv_sizeof_int8_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int8_t" >&6 cat >>confdefs.h <<_ACEOF -#define SIZEOF___INT64 $ac_cv_sizeof___int64 +#define SIZEOF_INT8_T $ac_cv_sizeof_int8_t _ACEOF @@ -11515,7 +11506,133 @@ _ACEOF +echo "$as_me:$LINENO: checking size of __int64" >&5 +echo $ECHO_N "checking size of __int64... $ECHO_C" >&6 +if test "${ac_cv_sizeof___int64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif +int main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) return(1); + fprintf(f, "%d\n", (int)sizeof(__int64)); + return(0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof___int64=`cat conftestval` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_sizeof___int64=0 +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof___int64" >&5 +echo "${ECHO_T}$ac_cv_sizeof___int64" >&6 + +cat >>confdefs.h <<_ACEOF +#define SIZEOF___INT64 $ac_cv_sizeof___int64 +_ACEOF + + + +if test "x$ac_cv_sizeof_char" = "x1"; then + echo "$as_me:$LINENO: checking for int8_t" >&5 +echo $ECHO_N "checking for int8_t... $ECHO_C" >&6 +if test "${ac_cv_type_int8_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])int8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_int8_t=yes +else + ac_cv_type_int8_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int8_t" >&5 +echo "${ECHO_T}$ac_cv_type_int8_t" >&6 +if test $ac_cv_type_int8_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define int8_t char +_ACEOF + +fi +fi if test "x$ac_cv_sizeof_uint8_t" = "x1"; then echo "$as_me:$LINENO: checking for u_int8_t" >&5 echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6 @@ -11621,6 +11738,111 @@ fi fi +if test "x$ac_cv_sizeof_u_int8_t" = "x1"; then + echo "$as_me:$LINENO: checking for uint8_t" >&5 +echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint8_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint8_t=yes +else + ac_cv_type_uint8_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint8_t" >&6 +if test $ac_cv_type_uint8_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint8_t u_int8_t +_ACEOF + +fi + +elif test "x$ac_cv_sizeof_char" = "x1"; then + echo "$as_me:$LINENO: checking for uint8_t" >&5 +echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint8_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint8_t=yes +else + ac_cv_type_uint8_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint8_t" >&6 +if test $ac_cv_type_uint8_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint8_t unsigned char +_ACEOF + +fi + +fi if test "x$ac_cv_sizeof_short" = "x2"; then echo "$as_me:$LINENO: checking for int16_t" >&5 echo $ECHO_N "checking for int16_t... $ECHO_C" >&6 @@ -11883,10 +12105,10 @@ fi fi -if test "x$ac_cv_sizeof_int" = "x4"; then - echo "$as_me:$LINENO: checking for int32_t" >&5 -echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 -if test "${ac_cv_type_int32_t+set}" = set; then +if test "x$ac_cv_sizeof_u_int16_t" = "x2"; then + echo "$as_me:$LINENO: checking for uint16_t" >&5 +echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11917,28 +12139,28 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - ac_cv_type_int32_t=yes + $EGREP "(^|[^a-zA-Z_0-9])uint16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint16_t=yes else - ac_cv_type_int32_t=no + ac_cv_type_uint16_t=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 -echo "${ECHO_T}$ac_cv_type_int32_t" >&6 -if test $ac_cv_type_int32_t = no; then +echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint16_t" >&6 +if test $ac_cv_type_uint16_t = no; then cat >>confdefs.h <<\_ACEOF -#define int32_t int +#define uint16_t u_int16_t _ACEOF fi -elif "x$ac_cv_sizeof_long" = "x4"; then - echo "$as_me:$LINENO: checking for int32_t" >&5 -echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 -if test "${ac_cv_type_int32_t+set}" = set; then +elif test "x$ac_cv_sizeof_short" = "x2"; then + echo "$as_me:$LINENO: checking for uint16_t" >&5 +echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11969,29 +12191,28 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - ac_cv_type_int32_t=yes + $EGREP "(^|[^a-zA-Z_0-9])uint16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint16_t=yes else - ac_cv_type_int32_t=no + ac_cv_type_uint16_t=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 -echo "${ECHO_T}$ac_cv_type_int32_t" >&6 -if test $ac_cv_type_int32_t = no; then +echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint16_t" >&6 +if test $ac_cv_type_uint16_t = no; then cat >>confdefs.h <<\_ACEOF -#define int32_t long +#define uint16_t unsigned short _ACEOF fi -fi -if test "x$ac_cv_sizeof_uint32_t" = "x4"; then - echo "$as_me:$LINENO: checking for u_int32_t" >&5 -echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 -if test "${ac_cv_type_u_int32_t+set}" = set; then +elif test "x$ac_cv_sizeof_int" = "x2"; then + echo "$as_me:$LINENO: checking for uint16_t" >&5 +echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -12022,25 +12243,183 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - ac_cv_type_u_int32_t=yes + $EGREP "(^|[^a-zA-Z_0-9])uint16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint16_t=yes else - ac_cv_type_u_int32_t=no + ac_cv_type_uint16_t=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 -echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 -if test $ac_cv_type_u_int32_t = no; then +echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint16_t" >&6 +if test $ac_cv_type_uint16_t = no; then cat >>confdefs.h <<\_ACEOF -#define u_int32_t uint32_t +#define uint16_t unsigned int _ACEOF fi -elif test "x$ac_cv_sizeof_int" = "x4"; then +fi +if test "x$ac_cv_sizeof_int" = "x4"; then + echo "$as_me:$LINENO: checking for int32_t" >&5 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_int32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_int32_t=yes +else + ac_cv_type_int32_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_int32_t" >&6 +if test $ac_cv_type_int32_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define int32_t int +_ACEOF + +fi + +elif "x$ac_cv_sizeof_long" = "x4"; then + echo "$as_me:$LINENO: checking for int32_t" >&5 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_int32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_int32_t=yes +else + ac_cv_type_int32_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_int32_t" >&6 +if test $ac_cv_type_int32_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define int32_t long +_ACEOF + +fi + +fi +if test "x$ac_cv_sizeof_uint32_t" = "x4"; then + echo "$as_me:$LINENO: checking for u_int32_t" >&5 +echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_u_int32_t=yes +else + ac_cv_type_u_int32_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 +if test $ac_cv_type_u_int32_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define u_int32_t uint32_t +_ACEOF + +fi + +elif test "x$ac_cv_sizeof_int" = "x4"; then echo "$as_me:$LINENO: checking for u_int32_t" >&5 echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 if test "${ac_cv_type_u_int32_t+set}" = set; then @@ -12145,6 +12524,163 @@ fi fi +if test "x$ac_cv_sizeof_u_int32_t" = "x4"; then + echo "$as_me:$LINENO: checking for uint32_t" >&5 +echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint32_t=yes +else + ac_cv_type_uint32_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint32_t" >&6 +if test $ac_cv_type_uint32_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint32_t u_int32_t +_ACEOF + +fi + +elif test "x$ac_cv_sizeof_int" = "x4"; then + echo "$as_me:$LINENO: checking for uint32_t" >&5 +echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint32_t=yes +else + ac_cv_type_uint32_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint32_t" >&6 +if test $ac_cv_type_uint32_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint32_t unsigned int +_ACEOF + +fi + +elif test "x$ac_cv_sizeof_long" = "x4"; then + echo "$as_me:$LINENO: checking for uint32_t" >&5 +echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint32_t=yes +else + ac_cv_type_uint32_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint32_t" >&6 +if test $ac_cv_type_uint32_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint32_t unsigned long +_ACEOF + +fi + +fi if test "x$ac_cv_sizeof_long" = "x8"; then echo "$as_me:$LINENO: checking for int64_t" >&5 echo $ECHO_N "checking for int64_t... $ECHO_C" >&6 @@ -12459,9 +12995,9 @@ fi elif test "x$ac_cv_sizeof___int64" = "x8"; then - echo "$as_me:$LINENO: checking for int64_t" >&5 -echo $ECHO_N "checking for int64_t... $ECHO_C" >&6 -if test "${ac_cv_type_int64_t+set}" = set; then + echo "$as_me:$LINENO: checking for u_int64_t" >&5 +echo $ECHO_N "checking for u_int64_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -12492,20 +13028,229 @@ _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "(^|[^a-zA-Z_0-9])int64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - ac_cv_type_int64_t=yes + $EGREP "(^|[^a-zA-Z_0-9])u_int64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_u_int64_t=yes else - ac_cv_type_int64_t=no + ac_cv_type_u_int64_t=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5 -echo "${ECHO_T}$ac_cv_type_int64_t" >&6 -if test $ac_cv_type_int64_t = no; then +echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6 +if test $ac_cv_type_u_int64_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define u_int64_t unsigned __int64 +_ACEOF + +fi + +fi +if test "x$ac_cv_sizeof_u_int64_t" = "x8"; then + echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint64_t=yes +else + ac_cv_type_uint64_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint64_t" >&6 +if test $ac_cv_type_uint64_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint64_t u_int64_t +_ACEOF + +fi + +elif test "x$ac_cv_sizeof_long" = "x8"; then + echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint64_t=yes +else + ac_cv_type_uint64_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint64_t" >&6 +if test $ac_cv_type_uint64_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint64_t unsigned long +_ACEOF + +fi + +elif test "x$ac_cv_sizeof_long_long" = "x8"; then + echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint64_t=yes +else + ac_cv_type_uint64_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint64_t" >&6 +if test $ac_cv_type_uint64_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uint64_t unsigned long long +_ACEOF + +fi + +elif test "x$ac_cv_sizeof___int64" = "x8"; then + echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6 +if test "${ac_cv_type_uint64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* What a mess.. many systems have added the (now standard) bit types + * in their own ways, so we need to scan a wide variety of headers to + * find them.. + */ +#include +#if STDC_HEADERS +#include +#include +#endif +#if HAVE_INTTYPES_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_BITYPES_H +#include +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "(^|[^a-zA-Z_0-9])uint64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + ac_cv_type_uint64_t=yes +else + ac_cv_type_uint64_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint64_t" >&6 +if test $ac_cv_type_uint64_t = no; then cat >>confdefs.h <<\_ACEOF -#define int64_t unsigned __int64 +#define uint64_t unsigned __int64 _ACEOF fi @@ -17418,7 +18163,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by Squid Web Proxy $as_me 2.6.STABLE1, which was +This file was extended by Squid Web Proxy $as_me 2.6.STABLE2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17481,7 +18226,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Squid Web Proxy config.status 2.6.STABLE1 +Squid Web Proxy config.status 2.6.STABLE2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff -ruN squid-2.6.STABLE1/configure.in squid-2.6.STABLE2/configure.in --- squid-2.6.STABLE1/configure.in Sat Jul 1 12:42:47 2006 +++ squid-2.6.STABLE2/configure.in Sun Jul 30 20:53:51 2006 @@ -1,16 +1,16 @@ dnl dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.384 2006/07/01 18:41:21 hno Exp $ +dnl $Id: configure.in,v 1.390 2006/07/31 02:38:45 hno Exp $ dnl dnl dnl -AC_INIT(Squid Web Proxy, 2.6.STABLE1, http://www.squid-cache.org/bugs/, squid) +AC_INIT(Squid Web Proxy, 2.6.STABLE2, http://www.squid-cache.org/bugs/, squid) AC_PREREQ(2.52) AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE -AC_REVISION($Revision: 1.384 $)dnl +AC_REVISION($Revision: 1.390 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -626,6 +626,8 @@ ;; *-freebsd*) ;; + *-openbsd*) + ;; *-cygwin*) LIBS="$LIBS -liphlpapi" ;; @@ -736,15 +738,6 @@ fi ]) -AC_ARG_ENABLE(auth-on-acceleration, -[ --enable-auth-on-acceleration - Enable authentication in accelerators], -[ if test "$enableval" = "yes" ; then - echo "AUTH_ON_ACCELERATION enabled" - AC_DEFINE(AUTH_ON_ACCELERATION, 1, [Enable authentication support in accelerators]) - fi -]) - dnl Select Default Error language AC_ARG_ENABLE(default-err-language, [ --enable-default-err-language=lang @@ -1107,6 +1100,12 @@ AC_DEFINE(USE_DNSSERVERS, 1, [If --disable-internal-dns was given to configure, then we'll use the dnsserver processes instead.]) AM_CONDITIONAL(USE_DNSSERVER, true) + dnl Cygwin needs -lresolv when using --disable-internal-dns + case "$host_os" in + cygwin|cygwin32) + LIBS="$LIBS -lresolv" + ;; + esac fi AC_ARG_ENABLE(truncate, @@ -1416,7 +1415,7 @@ echo "Enabling automatic stack backtraces on fatal errors" AC_DEFINE(PRINT_STACK_TRACE, 1, [Print stacktraces on fatal errors]) if test "$GCC" = "yes"; then - LDFLAGS="$CFLAGS -rdynamic" + LDFLAGS="$LDFLAGS -rdynamic" fi fi ]) @@ -1781,7 +1780,7 @@ AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) -AC_CHECK_SIZEOF_SYSTYPE(__int64) +AC_CHECK_SIZEOF_SYSTYPE(int8_t) AC_CHECK_SIZEOF_SYSTYPE(uint8_t) AC_CHECK_SIZEOF_SYSTYPE(u_int8_t) AC_CHECK_SIZEOF_SYSTYPE(int16_t) @@ -1793,20 +1792,31 @@ AC_CHECK_SIZEOF_SYSTYPE(int64_t) AC_CHECK_SIZEOF_SYSTYPE(uint64_t) AC_CHECK_SIZEOF_SYSTYPE(u_int64_t) +AC_CHECK_SIZEOF_SYSTYPE(__int64) +dnl int8_t +if test "x$ac_cv_sizeof_char" = "x1"; then + AC_CHECK_SYSTYPE(int8_t,char) +fi dnl u_int8_t if test "x$ac_cv_sizeof_uint8_t" = "x1"; then AC_CHECK_SYSTYPE(u_int8_t,uint8_t) elif test "x$ac_cv_sizeof_char" = "x1"; then AC_CHECK_SYSTYPE(u_int8_t,unsigned char) fi +dnl uint8_t +if test "x$ac_cv_sizeof_u_int8_t" = "x1"; then + AC_CHECK_SYSTYPE(uint8_t,u_int8_t) +elif test "x$ac_cv_sizeof_char" = "x1"; then + AC_CHECK_SYSTYPE(uint8_t,unsigned char) +fi dnl int16_t if test "x$ac_cv_sizeof_short" = "x2"; then AC_CHECK_SYSTYPE(int16_t,short) elif test "x$ac_cv_sizeof_int" = "x2"; then AC_CHECK_SYSTYPE(int16_t,int) fi -dnl u_int16t_t +dnl u_int16_t if test "x$ac_cv_sizeof_uint16_t" = "x2"; then AC_CHECK_SYSTYPE(u_int16_t,uint16_t) elif test "x$ac_cv_sizeof_short" = "x2"; then @@ -1814,6 +1824,14 @@ elif test "x$ac_cv_sizeof_int" = "x2"; then AC_CHECK_SYSTYPE(u_int16_t,unsigned int) fi +dnl uint16_t +if test "x$ac_cv_sizeof_u_int16_t" = "x2"; then + AC_CHECK_SYSTYPE(uint16_t,u_int16_t) +elif test "x$ac_cv_sizeof_short" = "x2"; then + AC_CHECK_SYSTYPE(uint16_t,unsigned short) +elif test "x$ac_cv_sizeof_int" = "x2"; then + AC_CHECK_SYSTYPE(uint16_t,unsigned int) +fi dnl int32_t if test "x$ac_cv_sizeof_int" = "x4"; then AC_CHECK_SYSTYPE(int32_t,int) @@ -1828,6 +1846,14 @@ elif test "x$ac_cv_sizeof_long" = "x4"; then AC_CHECK_SYSTYPE(u_int32_t,unsigned long) fi +dnl uint32_t +if test "x$ac_cv_sizeof_u_int32_t" = "x4"; then + AC_CHECK_SYSTYPE(uint32_t,u_int32_t) +elif test "x$ac_cv_sizeof_int" = "x4"; then + AC_CHECK_SYSTYPE(uint32_t,unsigned int) +elif test "x$ac_cv_sizeof_long" = "x4"; then + AC_CHECK_SYSTYPE(uint32_t,unsigned long) +fi dnl int64_t if test "x$ac_cv_sizeof_long" = "x8"; then AC_CHECK_SYSTYPE(int64_t,long) @@ -1844,7 +1870,17 @@ elif test "x$ac_cv_sizeof_long_long" = "x8"; then AC_CHECK_SYSTYPE(u_int64_t,unsigned long long) elif test "x$ac_cv_sizeof___int64" = "x8"; then - AC_CHECK_SYSTYPE(int64_t,unsigned __int64) + AC_CHECK_SYSTYPE(u_int64_t,unsigned __int64) +fi +dnl uint64_t +if test "x$ac_cv_sizeof_u_int64_t" = "x8"; then + AC_CHECK_SYSTYPE(uint64_t,u_int64_t) +elif test "x$ac_cv_sizeof_long" = "x8"; then + AC_CHECK_SYSTYPE(uint64_t,unsigned long) +elif test "x$ac_cv_sizeof_long_long" = "x8"; then + AC_CHECK_SYSTYPE(uint64_t,unsigned long long) +elif test "x$ac_cv_sizeof___int64" = "x8"; then + AC_CHECK_SYSTYPE(uint64_t,unsigned __int64) fi AC_CHECK_SYSTYPE(pid_t, int) diff -ruN squid-2.6.STABLE1/helpers/external_acl/mswin_lm_group/win32_check_group.c squid-2.6.STABLE2/helpers/external_acl/mswin_lm_group/win32_check_group.c --- squid-2.6.STABLE1/helpers/external_acl/mswin_lm_group/win32_check_group.c Sat May 27 02:58:29 2006 +++ squid-2.6.STABLE2/helpers/external_acl/mswin_lm_group/win32_check_group.c Wed Jul 5 09:22:56 2006 @@ -38,6 +38,10 @@ * Version 1.21 * 23-04-2005 Guido Serassio * Added -D option for specify default user's domain. + * Version 1.20.1 + * 15-08-2004 Guido Serassio + * Helper protocol changed to use URL escaped strings in Squid-3.0 + * (Original work of Henrik Nordstrom) * Version 1.20 * 13-06-2004 Guido Serassio * Added support for running on a Domain Controller. @@ -101,51 +105,6 @@ #include "win32_check_group.h" -char * -strwordtok(char *buf, char **t) -{ - unsigned char *word = NULL; - unsigned char *p = (unsigned char *) buf; - unsigned char *d; - unsigned char ch; - int quoted = 0; - if (!p) - p = (unsigned char *) *t; - if (!p) - goto error; - while (*p && isspace(*p)) - p++; - if (!*p) - goto error; - word = d = p; - while ((ch = *p)) { - switch (ch) { - case '\\': - p++; - *d++ = ch = *p; - if (ch) - p++; - break; - case '"': - quoted = !quoted; - p++; - break; - default: - if (!quoted && isspace(*p)) { - p++; - goto done; - } - *d++ = *p++; - break; - } - } - done: - *d++ = '\0'; - error: - *t = (char *) p; - return (char *) word; -} - char * AllocStrFromLSAStr(LSA_UNICODE_STRING LsaStr) @@ -555,7 +514,7 @@ int main(int argc, char *argv[]) { - char *p, *t; + char *p; char buf[BUFSIZE]; char *username; char *group; @@ -619,15 +578,19 @@ fprintf(stderr, "Invalid Request\n"); goto error; } - username = strwordtok(buf, &t); - for (n = 0; (group = strwordtok(NULL, &t)) != NULL; n++) + username = strtok(buf, " "); + for (n = 0; (group = strtok(NULL, " ")) != NULL; n++) { + rfc1738_unescape(group); groups[n] = group; + } groups[n] = NULL; if (NULL == username) { fprintf(stderr, "Invalid Request\n"); goto error; } + rfc1738_unescape(username); + if ((use_global ? Valid_Global_Groups(username, groups) : Valid_Local_Groups(username, groups))) { printf("OK\n"); } else { diff -ruN squid-2.6.STABLE1/include/autoconf.h.in squid-2.6.STABLE2/include/autoconf.h.in --- squid-2.6.STABLE1/include/autoconf.h.in Wed Jun 21 14:33:46 2006 +++ squid-2.6.STABLE2/include/autoconf.h.in Wed Jul 12 09:00:31 2006 @@ -3,9 +3,6 @@ /* Defines how many threads aufs uses for I/O */ #undef AUFS_IO_THREADS -/* Enable authentication support in accelerators */ -#undef AUTH_ON_ACCELERATION - /* If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname() */ #undef CACHEMGR_HOSTNAME @@ -666,6 +663,9 @@ /* Size of SIZEOF_INT64_T */ #undef SIZEOF_INT64_T +/* Size of SIZEOF_INT8_T */ +#undef SIZEOF_INT8_T + /* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG @@ -867,9 +867,12 @@ /* Have long datatype */ #undef int32_t -/* Have unsigned __int64 datatype */ +/* Have __int64 datatype */ #undef int64_t +/* Have char datatype */ +#undef int8_t + /* Have unsigned short datatype */ #undef mode_t @@ -899,8 +902,20 @@ /* Have unsigned long datatype */ #undef u_int32_t -/* Have unsigned long long datatype */ +/* Have unsigned __int64 datatype */ #undef u_int64_t /* Have unsigned char datatype */ #undef u_int8_t + +/* Have unsigned int datatype */ +#undef uint16_t + +/* Have unsigned long datatype */ +#undef uint32_t + +/* Have unsigned __int64 datatype */ +#undef uint64_t + +/* Have unsigned char datatype */ +#undef uint8_t diff -ruN squid-2.6.STABLE1/include/version.h squid-2.6.STABLE2/include/version.h --- squid-2.6.STABLE1/include/version.h Sat Jul 1 12:42:47 2006 +++ squid-2.6.STABLE2/include/version.h Sun Jul 30 20:53:51 2006 @@ -9,5 +9,5 @@ */ #ifndef SQUID_RELEASE_TIME -#define SQUID_RELEASE_TIME 1151779363 +#define SQUID_RELEASE_TIME 1154314429 #endif diff -ruN squid-2.6.STABLE1/src/CacheDigest.c squid-2.6.STABLE2/src/CacheDigest.c --- squid-2.6.STABLE1/src/CacheDigest.c Wed Jun 28 04:31:56 2006 +++ squid-2.6.STABLE2/src/CacheDigest.c Tue Jul 4 15:45:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: CacheDigest.c,v 1.35 2006/06/28 10:31:56 hno Exp $ + * $Id: CacheDigest.c,v 1.36 2006/07/04 21:45:24 hno Exp $ * * DEBUG: section 70 Cache Digest * AUTHOR: Alex Rousskov @@ -79,8 +79,7 @@ cacheDigestClean(CacheDigest * cd) { assert(cd); - xfree(cd->mask); - cd->mask = NULL; + safe_free(cd->mask); } void diff -ruN squid-2.6.STABLE1/src/HttpHeader.c squid-2.6.STABLE2/src/HttpHeader.c --- squid-2.6.STABLE1/src/HttpHeader.c Thu May 25 05:59:29 2006 +++ squid-2.6.STABLE2/src/HttpHeader.c Wed Jul 19 10:05:11 2006 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.c,v 1.88 2006/05/25 11:59:29 hno Exp $ + * $Id: HttpHeader.c,v 1.89 2006/07/19 16:05:11 hno Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -134,6 +134,7 @@ {"X-Error-URL", HDR_X_ERROR_URL, ftStr}, {"X-Error-Status", HDR_X_ERROR_STATUS, ftInt}, {"Front-End-Https", HDR_FRONT_END_HTTPS, ftStr}, + {"Keep-Alive", HDR_KEEP_ALIVE, ftStr}, {"Other:", HDR_OTHER, ftStr} /* ':' will not allow matches */ }; static HttpHeaderFieldInfo *Headers = NULL; @@ -389,7 +390,10 @@ /* deny bad guys (ok to check for HDR_OTHER) here */ if (denied_mask && CBIT_TEST(*denied_mask, e->id)) continue; - httpHeaderDelByName(old, strBuf(e->name)); + if (e->id != HDR_OTHER) + httpHeaderDelById(old, e->id); + else + httpHeaderDelByName(old, strBuf(e->name)); httpHeaderAddEntry(old, httpHeaderEntryClone(e)); } } @@ -650,6 +654,8 @@ /* * deletes an entry at pos and leaves a gap; leaving a gap makes it * possible to iterate(search) and delete fields at the same time + * WARNING: Doesn't update the header mask. Call httpHeaderRefreshMask + * when done with the delete operations. */ void httpHeaderDelAt(HttpHeader * hdr, HttpHeaderPos pos) @@ -663,6 +669,22 @@ assert(hdr->len >= 0); httpHeaderEntryDestroy(e); } + +/* + * Refreshes the header mask. Useful after httpHeaderDelAt constructs + */ +void +httpHeaderRefreshMask(HttpHeader * hdr) +{ + HttpHeaderPos pos = HttpHeaderInitPos; + HttpHeaderEntry *e; + httpHeaderMaskInit(&hdr->mask, 0); + debug(55, 7) ("refreshing the mask in hdr %p\n", hdr); + while ((e = httpHeaderGetEntry(hdr, &pos))) { + CBIT_SET(hdr->mask, e->id); + } +} + /* appends an entry; diff -ruN squid-2.6.STABLE1/src/HttpHeaderTools.c squid-2.6.STABLE2/src/HttpHeaderTools.c --- squid-2.6.STABLE1/src/HttpHeaderTools.c Fri Apr 28 04:17:18 2006 +++ squid-2.6.STABLE2/src/HttpHeaderTools.c Wed Jul 26 14:09:33 2006 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.c,v 1.35 2006/04/28 10:17:18 hno Exp $ + * $Id: HttpHeaderTools.c,v 1.37 2006/07/26 20:09:33 hno Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -232,6 +232,14 @@ stringAppend(str, item, strlen(item)); } +/* appends an item to the list if not already there */ +void +strListAddUnique(String * str, const char *item, char del) +{ + if (!strListIsMember(str, item, del)) + strListAdd(str, item, del); +} + /* * iterates through a 0-terminated string of items separated by 'del's. * white space around 'del' is considered to be a part of 'del' @@ -468,7 +476,13 @@ { HttpHeaderEntry *e; HttpHeaderPos p = HttpHeaderInitPos; - while ((e = httpHeaderGetEntry(l, &p))) - if (0 == httpHdrMangle(e, request)) + int removed_headers = 0; + while ((e = httpHeaderGetEntry(l, &p))) { + if (0 == httpHdrMangle(e, request)) { httpHeaderDelAt(l, p); + removed_headers++; + } + } + if (removed_headers) + httpHeaderRefreshMask(l); } diff -ruN squid-2.6.STABLE1/src/HttpRequest.c squid-2.6.STABLE2/src/HttpRequest.c --- squid-2.6.STABLE1/src/HttpRequest.c Mon Jun 5 23:57:55 2006 +++ squid-2.6.STABLE2/src/HttpRequest.c Sun Jul 16 20:31:59 2006 @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.c,v 1.40 2006/06/06 05:57:55 hno Exp $ + * $Id: HttpRequest.c,v 1.41 2006/07/17 02:31:59 hno Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -62,6 +62,7 @@ safe_free(req->canonical); safe_free(req->vary_hdr); safe_free(req->vary_headers); + stringClean(&req->vary_encoding); safe_free(req->urlgroup); safe_free(req->extacl_user); safe_free(req->extacl_passwd); diff -ruN squid-2.6.STABLE1/src/Makefile.am squid-2.6.STABLE2/src/Makefile.am --- squid-2.6.STABLE1/src/Makefile.am Sun Jun 11 11:06:25 2006 +++ squid-2.6.STABLE2/src/Makefile.am Sun Jul 30 02:55:22 2006 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.51 2006/06/11 17:06:25 serassio Exp $ +# $Id: Makefile.am,v 1.52 2006/07/30 08:55:22 serassio Exp $ # # Uncomment and customize the following to suit your needs: # @@ -307,7 +307,7 @@ DEFAULT_SWAP_DIR = $(localstatedir)/cache DEFAULT_PINGER = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'` DEFAULT_UNLINKD = $(libexecdir)/`echo unlinkd | sed '$(transform);s/$$/$(EXEEXT)/'` -DEFAULT_DISKD = $(libexecdir)/`echo diskd_daemon | sed '$(transform);s/$$/$(EXEEXT)/'` +DEFAULT_DISKD = $(libexecdir)/`echo diskd-daemon | sed '$(transform);s/$$/$(EXEEXT)/'` DEFAULT_ICON_DIR = $(datadir)/icons DEFAULT_ERROR_DIR = $(datadir)/errors/@ERR_DEFAULT_LANGUAGE@ DEFAULT_MIB_PATH = $(datadir)/mib.txt diff -ruN squid-2.6.STABLE1/src/Makefile.in squid-2.6.STABLE2/src/Makefile.in --- squid-2.6.STABLE1/src/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE2/src/Makefile.in Sun Jul 30 02:56:18 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.272 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.273 2006/07/30 08:56:18 serassio Exp $ # # Uncomment and customize the following to suit your needs: # @@ -594,7 +594,7 @@ DEFAULT_SWAP_DIR = $(localstatedir)/cache DEFAULT_PINGER = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'` DEFAULT_UNLINKD = $(libexecdir)/`echo unlinkd | sed '$(transform);s/$$/$(EXEEXT)/'` -DEFAULT_DISKD = $(libexecdir)/`echo diskd_daemon | sed '$(transform);s/$$/$(EXEEXT)/'` +DEFAULT_DISKD = $(libexecdir)/`echo diskd-daemon | sed '$(transform);s/$$/$(EXEEXT)/'` DEFAULT_ICON_DIR = $(datadir)/icons DEFAULT_ERROR_DIR = $(datadir)/errors/@ERR_DEFAULT_LANGUAGE@ DEFAULT_MIB_PATH = $(datadir)/mib.txt diff -ruN squid-2.6.STABLE1/src/access_log.c squid-2.6.STABLE2/src/access_log.c --- squid-2.6.STABLE1/src/access_log.c Sun Jun 25 13:28:28 2006 +++ squid-2.6.STABLE2/src/access_log.c Wed Jul 26 14:21:16 2006 @@ -1,6 +1,6 @@ /* - * $Id: access_log.c,v 1.82 2006/06/25 19:28:28 hno Exp $ + * $Id: access_log.c,v 1.85 2006/07/26 20:21:16 hno Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -305,9 +305,11 @@ LFT_USER_NAME, LFT_USER_LOGIN, - LFT_USER_IDENT, /*LFT_USER_REALM, */ /*LFT_USER_SCHEME, */ + LFT_USER_IDENT, + LFT_USER_EXT, + LFT_USER_SSL, LFT_HTTP_CODE, /*LFT_HTTP_STATUS, */ @@ -335,9 +337,7 @@ /*LFT_REPLY_SIZE_BODY, */ /*LFT_REPLY_SIZE_BODY_NO_TE, */ -#ifdef HAVE_EXTACL_LOG LFT_EXT_LOG, -#endif LFT_PERCENT /* special string cases for escaped chars */ } logformat_bcode_t; @@ -398,7 +398,9 @@ {"tr", LFT_TIME_TO_HANDLE_REQUEST}, {">h", LFT_REQUEST_HEADER}, + {">h", LFT_REQUEST_ALL_HEADERS}, {"cache.authuser ? - al->cache.authuser : al->cache.rfc931); - dofree = 1; + { + char *user = accessLogFormatName(al->cache.authuser); + if (!user) + user = accessLogFormatName(al->cache.rfc931); +#if USE_SSL + if (!user) + user = accessLogFormatName(al->cache.ssluser); +#endif + dofree = 1; + } break; case LFT_USER_LOGIN: @@ -591,6 +598,19 @@ /* case LFT_USER_REALM: */ /* case LFT_USER_SCHEME: */ +#if USE_SSL + case LFT_USER_SSL: + out = accessLogFormatName(al->cache.ssluser); + dofree = 1; + break; +#endif + + case LFT_USER_EXT: + if (al->request) + out = accessLogFormatName(strBuf(al->request->extacl_log)); + dofree = 1; + break; + case LFT_HTTP_CODE: outint = al->http.code; doint = 1; @@ -647,14 +667,12 @@ /*case LFT_REPLY_SIZE_BODY: */ /*case LFT_REPLY_SIZE_BODY_NO_TE: */ -#ifdef HAVE_EXTACL_LOG case LFT_EXT_LOG: if (al->request) out = strBuf(al->request->extacl_log); quote = 1; break; -#endif case LFT_PERCENT: out = "%"; @@ -976,8 +994,8 @@ assert(te->config != NULL); } } + storeAppend(entry, "\n", 1); } - storeAppend(entry, "\n", 1); } void diff -ruN squid-2.6.STABLE1/src/acl.c squid-2.6.STABLE2/src/acl.c --- squid-2.6.STABLE1/src/acl.c Sat Jun 17 17:31:03 2006 +++ squid-2.6.STABLE2/src/acl.c Sat Jul 29 07:44:44 2006 @@ -1,6 +1,6 @@ /* - * $Id: acl.c,v 1.303 2006/06/17 23:31:03 hno Exp $ + * $Id: acl.c,v 1.307 2006/07/29 13:44:44 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -400,6 +400,10 @@ type->accelerated = 1; continue; } + if (strcmp(t, "transparent") == 0) { + type->transparent = 1; + continue; + } if (strcmp(t, "internal") == 0) { type->internal = 1; continue; @@ -941,6 +945,10 @@ debug(28, 0) ("aclParseAclLine: missing ACL name.\n"); self_destruct(); } + if (strlen(t) >= ACL_NAME_SZ) { + debug(28, 0) ("aclParseAclLine: ACL name '%s' too long. Max %d characters allowed\n", t, ACL_NAME_SZ - 1); + self_destruct(); + } xstrncpy(aclname, t, ACL_NAME_SZ); /* snarf the ACL type */ if ((t = strtok(NULL, w_space)) == NULL) { @@ -1679,6 +1687,8 @@ { if (type->accelerated && request->flags.accelerated) return 1; + if (type->transparent && request->flags.transparent) + return 1; if (type->internal && request->flags.internal) return 1; return 0; @@ -1691,20 +1701,15 @@ http_hdr_type headertype; if (NULL == r) { return -1; - } else if (!r->flags.accelerated) { - /* Proxy authorization on proxy requests */ - headertype = HDR_PROXY_AUTHORIZATION; - } else if (r->flags.internal) { - /* WWW authorization on accelerated internal requests */ - headertype = HDR_AUTHORIZATION; - } else { -#if AUTH_ON_ACCELERATION + } else if (r->flags.accelerated) { /* WWW authorization on accelerated requests */ headertype = HDR_AUTHORIZATION; -#else - debug(28, 1) ("aclAuthenticated: authentication not applicable on accelerated requests.\n"); + } else if (r->flags.transparent) { + debug(28, 1) ("aclAuthenticated: authentication not applicable on transparently intercepted requests.\n"); return -1; -#endif + } else { + /* Proxy authorization on proxy requests */ + headertype = HDR_PROXY_AUTHORIZATION; } /* get authed here */ /* Note: this fills in checklist->auth_user_request when applicable (auth incomplete) */ @@ -2911,6 +2916,8 @@ wordlistAdd(&W, "accelerated"); if (type->internal) wordlistAdd(&W, "internal"); + if (type->transparent) + wordlistAdd(&W, "transparent"); return W; } @@ -3059,6 +3066,19 @@ #ifdef _SQUID_SOLARIS_ #include #else +/* SG - 25 Jul 2006 + * Workaround needed to allow the build of ARP acl on OpenBSD. + * + * Some defines, like + * #define free + + * are used in squid.h to block misuse of standard malloc routines + * where the Squid versions should be used. This pollutes the C/C++ + * token namespace crashing any structures or classes having members + * of the same names. + */ +#ifdef _SQUID_OPENBSD_ +#undef free +#endif #include #endif #ifdef _SQUID_LINUX_ @@ -3069,7 +3089,7 @@ #include #endif #include -#ifdef _SQUID_FREEBSD_ +#if defined(_SQUID_FREEBSD_) || defined(_SQUID_OPENBSD_) #include #endif #if HAVE_NETINET_IF_ETHER_H @@ -3289,7 +3309,8 @@ inet_ntoa(c), splayLastResult ? "NOT found" : "found"); return (0 == splayLastResult); } -#elif defined(_SQUID_FREEBSD_) +#elif defined(_SQUID_FREEBSD_) || defined(_SQUID_OPENBSD_) + struct arpreq arpReq; struct sockaddr_in ipAddr; splayNode **Top = dataptr; @@ -3368,6 +3389,7 @@ splayNode **Top = dataptr; struct arpreq arpReq; + memset(&arpReq, '\0', sizeof(arpReq)); /* Get size of Windows ARP table */ if (GetIpNetTable(NetTable, &ipNetTableLen, FALSE) != ERROR_INSUFFICIENT_BUFFER) { debug(28, 0) ("Can't estimate ARP table size!\n"); @@ -3388,7 +3410,7 @@ for (i = 0; i < NetTable->dwNumEntries; i++) { if ((c.s_addr == NetTable->table[i].dwAddr) && (NetTable->table[i].dwType > 2)) { arpReq.arp_ha.sa_family = AF_UNSPEC; - memcpy(arpReq.arp_ha.sa_data, NetTable->table[i].bPhysAddr, NetTable[i].table->dwPhysAddrLen); + memcpy(arpReq.arp_ha.sa_data, NetTable->table[i].bPhysAddr, NetTable->table[i].dwPhysAddrLen); } } xfree(NetTable); @@ -3444,7 +3466,7 @@ return (d1[4] > d2[4]) ? 1 : -1; if (d1[5] != d2[5]) return (d1[5] > d2[5]) ? 1 : -1; -#elif defined(_SQUID_FREEBSD_) +#elif defined(_SQUID_FREEBSD_) || defined(_SQUID_OPENBSD_) const unsigned char *d1 = a; const unsigned char *d2 = b; if (d1[0] != d2[0]) diff -ruN squid-2.6.STABLE1/src/auth/basic/auth_basic.c squid-2.6.STABLE2/src/auth/basic/auth_basic.c --- squid-2.6.STABLE1/src/auth/basic/auth_basic.c Sun May 21 18:37:23 2006 +++ squid-2.6.STABLE2/src/auth/basic/auth_basic.c Sun Jul 30 17:27:04 2006 @@ -1,5 +1,5 @@ /* - * $Id: auth_basic.c,v 1.22 2006/05/22 00:37:23 hno Exp $ + * $Id: auth_basic.c,v 1.25 2006/07/30 23:27:04 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -64,6 +64,7 @@ static AUTHSFREE authenticateBasicFreeUser; static AUTHSFREECONFIG authBasicFreeConfig; static AUTHSPARSE authBasicParse; +static AUTHSCHECKCONFIG authBasicCheckConfig; static AUTHSINIT authBasicInit; static AUTHSSTART authenticateBasicStart; static AUTHSSTATS authenticateBasicStats; @@ -92,6 +93,7 @@ assert(!authbasic_initialised); authscheme->Active = authenticateBasicActive; authscheme->parse = authBasicParse; + authscheme->checkconfig = authBasicCheckConfig; authscheme->dump = authBasicCfgDump; authscheme->init = authBasicInit; authscheme->authAuthenticate = authenticateBasicAuthenticateUser; @@ -313,13 +315,12 @@ storeAppendPrintf(entry, " %s", list->key); list = list->next; } - storeAppendPrintf(entry, "\n%s %s realm %s\n%s %s children %d\n%s %s credentialsttl %d seconds\n%s %s casesensitive %s\n%s %s blankpassword %s\n", - name, "basic", config->basicAuthRealm, - name, "basic", config->authenticateChildren, - name, "basic", (int) config->credentialsTTL, - name, "basic", config->casesensitive ? "on" : "off", - name, "basic", config->blankpassword ? "on" : "off"); - + storeAppendPrintf(entry, "\n%s %s realm %s\n", name, "basic", config->basicAuthRealm); + storeAppendPrintf(entry, "%s %s children %d\n", name, "basic", config->authenticateChildren); + storeAppendPrintf(entry, "%s %s concurrency %d\n", name, "basic", config->authenticateConcurrency); + storeAppendPrintf(entry, "%s %s credentialsttl %d seconds\n", name, "basic", (int) config->credentialsTTL); + storeAppendPrintf(entry, "%s %s casesensitive %s\n", name, "basic", config->casesensitive ? "on" : "off"); + storeAppendPrintf(entry, "%s %s blankpassword %s\n", name, "basic", config->blankpassword ? "on" : "off"); } static void @@ -340,9 +341,10 @@ if (basicConfig->authenticate) wordlistDestroy(&basicConfig->authenticate); parse_wordlist(&basicConfig->authenticate); - requirePathnameExists("authparam basic program", basicConfig->authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&basicConfig->authenticateChildren); + } else if (strcasecmp(param_str, "concurrency") == 0) { + parse_int(&basicConfig->authenticateConcurrency); } else if (strcasecmp(param_str, "realm") == 0) { parse_eol(&basicConfig->basicAuthRealm); } else if (strcasecmp(param_str, "credentialsttl") == 0) { @@ -352,11 +354,18 @@ } else if (strcasecmp(param_str, "blankpassword") == 0) { parse_onoff(&basicConfig->blankpassword); } else { - debug(28, 0) ("unrecognised basic auth scheme parameter '%s'\n", param_str); + debug(29, 0) ("unrecognised basic auth scheme parameter '%s'\n", param_str); } } static void +authBasicCheckConfig(authScheme * scheme) +{ + auth_basic_config *config = scheme->scheme_data; + requirePathnameExists("auth_param basic program", config->authenticate->key); +} + +static void authenticateBasicStats(StoreEntry * sentry) { storeAppendPrintf(sentry, "Basic Authenticator Statistics:\n"); @@ -564,6 +573,7 @@ basicauthenticators = helperCreate("basicauthenticator"); basicauthenticators->cmdline = basicConfig->authenticate; basicauthenticators->n_to_start = basicConfig->authenticateChildren; + basicauthenticators->concurrency = basicConfig->authenticateConcurrency; basicauthenticators->ipc_type = IPC_STREAM; helperOpenServers(basicauthenticators); if (!init) { diff -ruN squid-2.6.STABLE1/src/auth/basic/auth_basic.h squid-2.6.STABLE2/src/auth/basic/auth_basic.h --- squid-2.6.STABLE1/src/auth/basic/auth_basic.h Sun May 21 18:37:23 2006 +++ squid-2.6.STABLE2/src/auth/basic/auth_basic.h Sat Jul 8 07:26:26 2006 @@ -38,6 +38,7 @@ /* configuration runtime data */ struct _auth_basic_config { int authenticateChildren; + int authenticateConcurrency; char *basicAuthRealm; wordlist *authenticate; time_t credentialsTTL; diff -ruN squid-2.6.STABLE1/src/auth/digest/auth_digest.c squid-2.6.STABLE2/src/auth/digest/auth_digest.c --- squid-2.6.STABLE1/src/auth/digest/auth_digest.c Mon May 15 19:12:36 2006 +++ squid-2.6.STABLE2/src/auth/digest/auth_digest.c Sun Jul 30 17:27:04 2006 @@ -1,6 +1,6 @@ /* - * $Id: auth_digest.c,v 1.18 2006/05/16 01:12:36 hno Exp $ + * $Id: auth_digest.c,v 1.21 2006/07/30 23:27:04 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -73,6 +73,7 @@ static AUTHSFREECONFIG authDigestFreeConfig; static AUTHSINIT authDigestInit; static AUTHSPARSE authDigestParse; +static AUTHSCHECKCONFIG authDigestCheckConfig; static AUTHSREQFREE authDigestAURequestFree; static AUTHSSTART authenticateDigestStart; static AUTHSSTATS authenticateDigestStats; @@ -592,12 +593,12 @@ storeAppendPrintf(entry, " %s", list->key); list = list->next; } - storeAppendPrintf(entry, "\n%s %s realm %s\n%s %s children %d\n%s %s nonce_max_count %d\n%s %s nonce_max_duration %d seconds\n%s %s nonce_garbage_interval %d seconds\n", - name, "digest", config->digestAuthRealm, - name, "digest", config->authenticateChildren, - name, "digest", config->noncemaxuses, - name, "digest", (int) config->noncemaxduration, - name, "digest", (int) config->nonceGCInterval); + storeAppendPrintf(entry, "\n%s %s realm %s\n", name, "digest", config->digestAuthRealm); + storeAppendPrintf(entry, "%s %s children %d\n", name, "digest", config->authenticateChildren); + storeAppendPrintf(entry, "%s %s concurrency %d\n", name, "digest", config->authenticateConcurrency); + storeAppendPrintf(entry, "%s %s nonce_max_count %d\n", name, "digest", config->noncemaxuses); + storeAppendPrintf(entry, "%s %s nonce_max_duration %d seconds\n", name, "digest", (int) config->noncemaxduration); + storeAppendPrintf(entry, "%s %s nonce_garbage_interval %d seconds\n", name, "digest", (int) config->nonceGCInterval); } void @@ -607,6 +608,7 @@ authscheme->Active = authenticateDigestActive; authscheme->configured = authDigestConfigured; authscheme->parse = authDigestParse; + authscheme->checkconfig = authDigestCheckConfig; authscheme->freeconfig = authDigestFreeConfig; authscheme->dump = authDigestCfgDump; authscheme->init = authDigestInit; @@ -938,6 +940,7 @@ digestauthenticators = helperCreate("digestauthenticator"); digestauthenticators->cmdline = digestConfig->authenticate; digestauthenticators->n_to_start = digestConfig->authenticateChildren; + digestauthenticators->concurrency = digestConfig->authenticateConcurrency; digestauthenticators->ipc_type = IPC_STREAM; helperOpenServers(digestauthenticators); if (!init) { @@ -994,9 +997,10 @@ if (digestConfig->authenticate) wordlistDestroy(&digestConfig->authenticate); parse_wordlist(&digestConfig->authenticate); - requirePathnameExists("authparam digest program", digestConfig->authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&digestConfig->authenticateChildren); + } else if (strcasecmp(param_str, "concurrency") == 0) { + parse_int(&digestConfig->authenticateConcurrency); } else if (strcasecmp(param_str, "realm") == 0) { parse_eol(&digestConfig->digestAuthRealm); } else if (strcasecmp(param_str, "nonce_garbage_interval") == 0) { @@ -1012,10 +1016,16 @@ } else if (strcasecmp(param_str, "post_workaround") == 0) { parse_onoff(&digestConfig->PostWorkaround); } else { - debug(28, 0) ("unrecognised digest auth scheme parameter '%s'\n", param_str); + debug(29, 0) ("unrecognised digest auth scheme parameter '%s'\n", param_str); } } +static void +authDigestCheckConfig(authScheme * scheme) +{ + auth_digest_config *config = scheme->scheme_data; + requirePathnameExists("authparam digest program", config->authenticate->key); +} static void authenticateDigestStats(StoreEntry * sentry) diff -ruN squid-2.6.STABLE1/src/auth/digest/auth_digest.h squid-2.6.STABLE2/src/auth/digest/auth_digest.h --- squid-2.6.STABLE1/src/auth/digest/auth_digest.h Tue May 17 10:56:41 2005 +++ squid-2.6.STABLE2/src/auth/digest/auth_digest.h Sat Jul 8 07:26:26 2006 @@ -77,6 +77,7 @@ /* configuration runtime data */ struct _auth_digest_config { int authenticateChildren; + int authenticateConcurrency; char *digestAuthRealm; wordlist *authenticate; time_t nonceGCInterval; diff -ruN squid-2.6.STABLE1/src/auth/negotiate/auth_negotiate.c squid-2.6.STABLE2/src/auth/negotiate/auth_negotiate.c --- squid-2.6.STABLE1/src/auth/negotiate/auth_negotiate.c Mon May 15 19:12:36 2006 +++ squid-2.6.STABLE2/src/auth/negotiate/auth_negotiate.c Sun Jul 30 17:27:04 2006 @@ -1,6 +1,6 @@ /* - * $Id: auth_negotiate.c,v 1.2 2006/05/16 01:12:36 hno Exp $ + * $Id: auth_negotiate.c,v 1.5 2006/07/30 23:27:04 hno Exp $ * * DEBUG: section 29 Negotiate Authenticator * AUTHOR: Robert Collins @@ -69,6 +69,7 @@ static AUTHSUSERNAME authenticateNegotiateUsername; static AUTHSREQFREE authNegotiateAURequestFree; static AUTHSPARSE authNegotiateParse; +static AUTHSCHECKCONFIG authNegotiateCheckConfig; static AUTHSSTART authenticateNegotiateStart; static AUTHSSTATS authenticateNegotiateStats; static AUTHSSHUTDOWN authNegotiateDone; @@ -160,16 +161,21 @@ if (negotiateConfig->authenticate) wordlistDestroy(&negotiateConfig->authenticate); parse_wordlist(&negotiateConfig->authenticate); - requirePathnameExists("authparam negotiate program", negotiateConfig->authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&negotiateConfig->authenticateChildren); } else if (strcasecmp(param_str, "keep_alive") == 0) { parse_onoff(&negotiateConfig->keep_alive); } else { - debug(28, 0) ("unrecognised negotiate auth scheme parameter '%s'\n", param_str); + debug(29, 0) ("unrecognised negotiate auth scheme parameter '%s'\n", param_str); } } +static void +authNegotiateCheckConfig(authScheme * scheme) +{ + auth_negotiate_config *config = scheme->scheme_data; + requirePathnameExists("authparam negotiate program", config->authenticate->key); +} void authSchemeSetup_negotiate(authscheme_entry_t * authscheme) @@ -178,6 +184,7 @@ authscheme->Active = authenticateNegotiateActive; authscheme->configured = authNegotiateConfigured; authscheme->parse = authNegotiateParse; + authscheme->checkconfig = authNegotiateCheckConfig; authscheme->dump = authNegotiateCfgDump; authscheme->requestFree = authNegotiateAURequestFree; authscheme->freeconfig = authNegotiateFreeConfig; @@ -212,7 +219,7 @@ * test, but that can wait for the modular parser to be integrated. */ if (negotiateConfig->authenticate && Config.onoff.pipeline_prefetch != 0) { - debug(28, 1) ("pipeline prefetching incompatile with Negotiate authentication. Disabling pipeline_prefetch\n"); + debug(29, 1) ("pipeline prefetching incompatile with Negotiate authentication. Disabling pipeline_prefetch\n"); Config.onoff.pipeline_prefetch = 0; } if (!negotiate_user_pool) @@ -426,6 +433,12 @@ valid = cbdataValid(r->data); if (!valid) { debug(29, 2) ("AuthenticateNegotiateHandleReply: invalid callback data. Releasing helper '%p'.\n", srv); + negotiate_request = r->auth_user_request->scheme_data; + if (negotiate_request != NULL) { + if (negotiate_request->authserver == NULL) + negotiate_request->authserver = srv; + authenticateNegotiateReleaseServer(negotiate_request); + } cbdataUnlock(r->data); authenticateStateFree(r); return; diff -ruN squid-2.6.STABLE1/src/auth/ntlm/auth_ntlm.c squid-2.6.STABLE2/src/auth/ntlm/auth_ntlm.c --- squid-2.6.STABLE1/src/auth/ntlm/auth_ntlm.c Thu Jun 15 16:13:33 2006 +++ squid-2.6.STABLE2/src/auth/ntlm/auth_ntlm.c Sun Jul 30 17:27:04 2006 @@ -1,6 +1,6 @@ /* - * $Id: auth_ntlm.c,v 1.32 2006/06/15 22:13:33 hno Exp $ + * $Id: auth_ntlm.c,v 1.35 2006/07/30 23:27:04 hno Exp $ * * DEBUG: section 29 NTLM Authenticator * AUTHOR: Robert Collins @@ -68,6 +68,7 @@ static AUTHSUSERNAME authenticateNTLMUsername; static AUTHSREQFREE authNTLMAURequestFree; static AUTHSPARSE authNTLMParse; +static AUTHSCHECKCONFIG authNTLMCheckConfig; static AUTHSSTART authenticateNTLMStart; static AUTHSSTATS authenticateNTLMStats; static AUTHSSHUTDOWN authNTLMDone; @@ -157,16 +158,21 @@ if (ntlmConfig->authenticate) wordlistDestroy(&ntlmConfig->authenticate); parse_wordlist(&ntlmConfig->authenticate); - requirePathnameExists("authparam ntlm program", ntlmConfig->authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&ntlmConfig->authenticateChildren); } else if (strcasecmp(param_str, "keep_alive") == 0) { parse_onoff(&ntlmConfig->keep_alive); } else { - debug(28, 0) ("unrecognised ntlm auth scheme parameter '%s'\n", param_str); + debug(29, 0) ("unrecognised ntlm auth scheme parameter '%s'\n", param_str); } } +static void +authNTLMCheckConfig(authScheme * scheme) +{ + auth_ntlm_config *config = scheme->scheme_data; + requirePathnameExists("authparam ntlm program", config->authenticate->key); +} void authSchemeSetup_ntlm(authscheme_entry_t * authscheme) @@ -175,6 +181,7 @@ authscheme->Active = authenticateNTLMActive; authscheme->configured = authNTLMConfigured; authscheme->parse = authNTLMParse; + authscheme->checkconfig = authNTLMCheckConfig; authscheme->dump = authNTLMCfgDump; authscheme->requestFree = authNTLMAURequestFree; authscheme->freeconfig = authNTLMFreeConfig; @@ -207,7 +214,7 @@ * state will be preserved. */ if (ntlmConfig->authenticate && Config.onoff.pipeline_prefetch != 0) { - debug(28, 1) ("pipeline prefetching incompatile with NTLM authentication. Disabling pipeline_prefetch\n"); + debug(29, 1) ("pipeline prefetching incompatile with NTLM authentication. Disabling pipeline_prefetch\n"); Config.onoff.pipeline_prefetch = 0; } if (!ntlm_user_pool) @@ -395,6 +402,12 @@ valid = cbdataValid(r->data); if (!valid) { debug(29, 2) ("AuthenticateNTLMHandleReply: invalid callback data. Releasing helper '%p'.\n", srv); + ntlm_request = r->auth_user_request->scheme_data; + if (ntlm_request != NULL) { + if (ntlm_request->authserver == NULL) + ntlm_request->authserver = srv; + authenticateNTLMReleaseServer(ntlm_request); + } cbdataUnlock(r->data); authenticateStateFree(r); return; @@ -433,7 +446,7 @@ ntlm_request->server_blob = xstrdup(blob); ntlm_request->auth_state = AUTHENTICATE_STATE_NEGOTIATE; safe_free(auth_user_request->message); - auth_user_request->message = xstrdup("Authenication in progress"); + auth_user_request->message = xstrdup("Authentication in progress"); debug(29, 4) ("authenticateNTLMHandleReply: Need to challenge the client with a server blob '%s'\n", blob); } else if (strncasecmp(reply, "AF ", 3) == 0) { /* we're finished, release the helper */ diff -ruN squid-2.6.STABLE1/src/authenticate.c squid-2.6.STABLE2/src/authenticate.c --- squid-2.6.STABLE1/src/authenticate.c Mon May 15 16:06:48 2006 +++ squid-2.6.STABLE2/src/authenticate.c Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.c,v 1.46 2006/05/15 22:06:48 hno Exp $ + * $Id: authenticate.c,v 1.48 2006/07/30 23:27:03 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -457,7 +457,7 @@ /* no header or authentication failed/got corrupted - restart */ if (conn) conn->auth_type = AUTH_UNKNOWN; - debug(28, 4) ("authenticateAuthenticate: broken auth or no proxy_auth header. Requesting auth header.\n"); + debug(29, 4) ("authenticateAuthenticate: broken auth or no proxy_auth header. Requesting auth header.\n"); /* something wrong with the AUTH credentials. Force a new attempt */ if (conn && conn->auth_user_request) { authenticateAuthUserRequestUnlock(conn->auth_user_request); @@ -479,7 +479,7 @@ if (proxy_auth && conn && conn->auth_user_request && authenticateUserAuthenticated(conn->auth_user_request) && strcmp(proxy_auth, authscheme_list[conn->auth_user_request->auth_user->auth_module - 1].authConnLastHeader(conn->auth_user_request))) { - debug(28, 2) ("authenticateAuthenticate: DUPLICATE AUTH - authentication header on already authenticated connection!. AU %p, Current user '%s' proxy_auth %s\n", conn->auth_user_request, authenticateUserRequestUsername(conn->auth_user_request), proxy_auth); + debug(29, 2) ("authenticateAuthenticate: DUPLICATE AUTH - authentication header on already authenticated connection!. AU %p, Current user '%s' proxy_auth %s\n", conn->auth_user_request, authenticateUserRequestUsername(conn->auth_user_request), proxy_auth); /* remove this request struct - the link is already authed and it can't be to * reauth. */ @@ -498,14 +498,14 @@ #endif /* we have a proxy auth header and as far as we know this connection has * not had bungled connection oriented authentication happen on it. */ - debug(28, 9) ("authenticateAuthenticate: header %s.\n", proxy_auth ? proxy_auth : NULL); + debug(29, 9) ("authenticateAuthenticate: header %s.\n", proxy_auth ? proxy_auth : NULL); if (*auth_user_request == NULL) { - debug(28, 9) ("authenticateAuthenticate: This is a new checklist test on FD:%d\n", + debug(29, 9) ("authenticateAuthenticate: This is a new checklist test on FD:%d\n", conn ? conn->fd : -1); if (proxy_auth && !request->auth_user_request && conn && conn->auth_user_request) { int id = authenticateAuthSchemeId(proxy_auth) + 1; if (!conn->auth_user_request->auth_user || conn->auth_user_request->auth_user->auth_module != id) { - debug(28, 1) ("authenticateAuthenticate: Unexpected change of authentication scheme from '%s' to '%s' (client %s)\n", + debug(29, 1) ("authenticateAuthenticate: Unexpected change of authentication scheme from '%s' to '%s' (client %s)\n", authscheme_list[conn->auth_user_request->auth_user->auth_module - 1].typestr, proxy_auth, inet_ntoa(src_addr)); authenticateAuthUserRequestUnlock(conn->auth_user_request); conn->auth_user_request = NULL; @@ -515,7 +515,7 @@ if ((!request->auth_user_request) && (!conn || conn->auth_type == AUTH_UNKNOWN)) { /* beginning of a new request check */ - debug(28, 4) ("authenticateAuthenticate: no connection authentication type\n"); + debug(29, 4) ("authenticateAuthenticate: no connection authentication type\n"); if (!authenticateValidateUser(*auth_user_request = authenticateGetAuthUser(proxy_auth))) { /* the decode might have left a username for logging, or a message to @@ -543,7 +543,7 @@ authenticateAuthUserRequestLock(*auth_user_request); } else { /* failed connection based authentication */ - debug(28, 4) ("authenticateAuthenticate: Auth user request %p conn-auth user request %p conn type %d authentication failed.\n", + debug(29, 4) ("authenticateAuthenticate: Auth user request %p conn-auth user request %p conn type %d authentication failed.\n", *auth_user_request, conn->auth_user_request, conn->auth_type); authenticateAuthUserRequestUnlock(*auth_user_request); *auth_user_request = NULL; @@ -698,6 +698,19 @@ authenticateSchemeInit(void) { authSchemeSetup(); +} + +void +authenticateConfigure(authConfig * config) +{ + int i; + authScheme *scheme; + for (i = 0; i < config->n_configured; i++) { + scheme = config->schemes + i; + if (authscheme_list[scheme->Id].checkconfig && authscheme_list[scheme->Id].configured()) { + authscheme_list[scheme->Id].checkconfig(scheme); + } + } } void diff -ruN squid-2.6.STABLE1/src/cache_cf.c squid-2.6.STABLE2/src/cache_cf.c --- squid-2.6.STABLE1/src/cache_cf.c Fri Jun 30 15:23:04 2006 +++ squid-2.6.STABLE2/src/cache_cf.c Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.449 2006/06/30 21:23:04 hno Exp $ + * $Id: cache_cf.c,v 1.452 2006/07/30 23:27:03 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -124,6 +124,9 @@ static int check_null_https_port_list(const https_port_list *); #endif #endif /* USE_SSL */ +static void parse_programline(wordlist **); +static void free_programline(wordlist **); +static void dump_programline(StoreEntry *, const char *, const wordlist *); void self_destruct(void) @@ -451,6 +454,8 @@ requirePathnameExists("location_rewrite_program", Config.Program.location_rewrite.command->key); requirePathnameExists("Icon Directory", Config.icons.directory); requirePathnameExists("Error Directory", Config.errorDirectory); + authenticateConfigure(&Config.authConfig); + externalAclConfigure(); #if HTTP_VIOLATIONS { const refresh_t *R; @@ -2404,7 +2409,7 @@ } static void -dump_wordlist(StoreEntry * entry, const char *name, wordlist * list) +dump_wordlist(StoreEntry * entry, const char *name, const wordlist * list) { while (list != NULL) { storeAppendPrintf(entry, "%s %s\n", name, list->key); @@ -2482,8 +2487,7 @@ return; free_string(&(*settings)->type); free_wordlist(&(*settings)->args); - xfree(*settings); - *settings = NULL; + safe_free(*settings); } static void @@ -2962,7 +2966,7 @@ path = pathbuf; } if (stat(path, &sb) < 0) { - if (opt_send_signal == -1 || opt_send_signal == SIGHUP) + if ((opt_send_signal == -1 || opt_send_signal == SIGHUP) && !opt_parse_cfg_only) fatalf("%s %s: %s", name, path, xstrerror()); else fprintf(stderr, "WARNING: %s %s: %s\n", name, path, xstrerror()); @@ -3169,4 +3173,24 @@ safe_free(log->filename); xfree(log); } +} + +static void +parse_programline(wordlist ** line) +{ + if (*line) + self_destruct(); + parse_wordlist(line); +} + +static void +free_programline(wordlist ** line) +{ + free_wordlist(line); +} + +static void +dump_programline(StoreEntry * entry, const char *name, const wordlist * line) +{ + dump_wordlist(entry, name, line); } diff -ruN squid-2.6.STABLE1/src/cf.data.pre squid-2.6.STABLE2/src/cf.data.pre --- squid-2.6.STABLE1/src/cf.data.pre Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE2/src/cf.data.pre Sun Jul 30 19:31:18 2006 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.355 2006/06/30 21:23:05 hno Exp $ +# $Id: cf.data.pre,v 1.362 2006/07/31 01:31:18 hno Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1199,6 +1199,8 @@ un User name ul User login ui User ident + us User SSL + ue User external acl Hs HTTP status code Ss Squid request status (TCP_MISS etc) Sh Squid hierarchy status (DEFAULT_PARENT etc) @@ -1643,7 +1645,7 @@ NAME: url_rewrite_program redirect_program -TYPE: wordlist +TYPE: programline LOC: Config.Program.url_rewrite.command DEFAULT: none DOC_START @@ -1713,7 +1715,7 @@ DOC_END NAME: location_rewrite_program -TYPE: wordlist +TYPE: programline LOC: Config.Program.location_rewrite.command DEFAULT: none DOC_START @@ -1833,6 +1835,13 @@ authenticator processes. auth_param basic children 5 + "concurrency" numberofconcurrentrequests + The number of concurrent requests/channels the helper supports. + Changes the protocol used to include a channel number first on + the request/response line, allowing multiple requests to be sent + to the same helper in parallell without wating for the response. + Must not be set unless it's known the helper supports this. + "realm" realmstring Specifies the realm name which is to be reported to the client for the basic proxy authentication scheme (part of the text the user @@ -1894,6 +1903,13 @@ authenticator processes. auth_param digest children 5 + "concurrency" numberofconcurrentrequests + The number of concurrent requests/channels the helper supports. + Changes the protocol used to include a channel number first on + the request/response line, allowing multiple requests to be sent + to the same helper in parallell without wating for the response. + Must not be set unless it's known the helper supports this. + "realm" realmstring Specifies the realm name which is to be reported to the client for the digest proxy authentication scheme (part of the text the user will see @@ -2001,7 +2017,6 @@ #auth_param negotiate keep_alive on #auth_param ntlm program #auth_param ntlm children 5 -#auth_param ntlm use_ntlm_negotiate on #auth_param ntlm keep_alive on #auth_param digest program #auth_param digest children 5 @@ -4191,6 +4206,16 @@ do not specify this parameter. DOC_END +NAME: wccp2_rebuild_wait +TYPE: onoff +LOC: Config.Wccp2.rebuildwait +DEFAULT: on +IFDEF: USE_WCCPv2 +DOC_START + If this is enabled Squid will wait for the cache dir rebuild to finish + before sending the first wccp2 HereIAm packet +DOC_END + NAME: wccp2_forwarding_method TYPE: int LOC: Config.Wccp2.forwarding_method @@ -4980,6 +5005,20 @@ processes, these sleep delays will add up and your Squid will not service requests for some amount of time until all the child processes have been started. +DOC_END + +NAME: minimum_expiry_time +COMMENT: (seconds) +TYPE: time_t +LOC: Config.minimum_expiry_time +DEFAULT: 60 seconds +DOC_START + The minimum caching time according to (Expires - Date) + Headers Squid honors if the object can't be revalidated + defaults to 60 seconds. In reverse proxy enorinments it + might be desirable to honor shorter object lifetimes. It + is most likely better to make your server return a + meaningful Last-Modified header however. DOC_END NAME: relaxed_header_parser diff -ruN squid-2.6.STABLE1/src/client_side.c squid-2.6.STABLE2/src/client_side.c --- squid-2.6.STABLE1/src/client_side.c Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE2/src/client_side.c Sun Jul 23 15:44:22 2006 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.656 2006/06/30 21:23:05 hno Exp $ + * $Id: client_side.c,v 1.666 2006/07/23 21:44:22 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -673,15 +673,8 @@ clientHandleETagMiss(clientHttpRequest * http) { StoreEntry *entry = http->entry; - MemObject *mem = entry->mem_obj; request_t *request = http->request; - if (mem->reply) { - const char *etag = httpHeaderGetStr(&mem->reply->header, HDR_ETAG); - if (etag) { - storeAddVary(mem->url, mem->log_url, mem->method, NULL, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), request->vary_hdr, request->vary_headers, strBuf(request->vary_encoding)); - } - } request->done_etag = 1; if (request->vary) { storeLocateVaryDone(request->vary); @@ -745,11 +738,26 @@ if (HTTP_NOT_MODIFIED == mem->reply->sline.status) { /* Remember the ETag and restart */ memFree(buf, MEM_CLIENT_SOCK_BUF); + if (mem->reply) { + request_t *request = http->request; + const char *etag = httpHeaderGetStr(&mem->reply->header, HDR_ETAG); + const char *vary = request->vary_headers; + int has_vary = httpHeaderHas(&entry->mem_obj->reply->header, HDR_VARY); +#if X_ACCELERATOR_VARY + has_vary |= httpHeaderHas(&entry->mem_obj->reply->header, HDR_X_ACCELERATOR_VARY); +#endif + if (has_vary) + vary = httpMakeVaryMark(request, mem->reply); + + if (etag && vary) { + storeAddVary(mem->url, mem->log_url, mem->method, NULL, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), request->vary_hdr, request->vary_headers, strBuf(request->vary_encoding)); + } + } clientHandleETagMiss(http); return; } /* Send the new object to the client */ - clientSendMoreData(data, buf, size); + clientSendMoreHeaderData(data, buf, size); return; } @@ -1847,14 +1855,9 @@ { HttpHeader *hdr = &rep->header; request_t *request = http->request; -#if DONT_FILTER_THESE - /* but you might want to if you run Squid as an HTTP accelerator */ - /* httpHeaderDelById(hdr, HDR_ACCEPT_RANGES); */ - httpHeaderDelById(hdr, HDR_ETAG); -#endif httpHeaderDelById(hdr, HDR_PROXY_CONNECTION); /* here: Keep-Alive is a field-name, not a connection directive! */ - httpHeaderDelByName(hdr, "Keep-Alive"); + httpHeaderDelById(hdr, HDR_KEEP_ALIVE); /* remove Set-Cookie if a hit */ if (http->flags.hit) httpHeaderDelById(hdr, HDR_SET_COOKIE); @@ -1864,18 +1867,21 @@ String strConnection = httpHeaderGetList(hdr, HDR_CONNECTION); const HttpHeaderEntry *e; HttpHeaderPos pos = HttpHeaderInitPos; + int headers_deleted = 0; /* * think: on-average-best nesting of the two loops (hdrEntry * and strListItem) @?@ */ - /* - * maybe we should delete standard stuff ("keep-alive","close") - * from strConnection first? - */ while ((e = httpHeaderGetEntry(hdr, &pos))) { - if (strListIsMember(&strConnection, strBuf(e->name), ',')) + if (e->id == HDR_KEEP_ALIVE) + continue; /* Common, and already taken care of above */ + if (strListIsMember(&strConnection, strBuf(e->name), ',')) { httpHeaderDelAt(hdr, pos); + headers_deleted++; + } } + if (headers_deleted) + httpHeaderRefreshMask(hdr); httpHeaderDelById(hdr, HDR_CONNECTION); stringClean(&strConnection); } @@ -1919,6 +1925,7 @@ (httpHeaderHas(hdr, HDR_WWW_AUTHENTICATE))) { HttpHeaderPos pos = HttpHeaderInitPos; HttpHeaderEntry *e; + int connection_auth_blocked = 0; while ((e = httpHeaderGetEntry(hdr, &pos))) { if (e->id == HDR_WWW_AUTHENTICATE) { const char *value = strBuf(e->value); @@ -1932,10 +1939,11 @@ (value[8] == '\0' || value[8] == ' '))) { if (request->flags.no_connection_auth) { httpHeaderDelAt(hdr, pos); + connection_auth_blocked = 1; continue; } request->flags.must_keepalive = 1; - if (!request->flags.accelerated) { + if (!request->flags.accelerated && !request->flags.transparent) { httpHeaderPutStr(hdr, HDR_PROXY_SUPPORT, "Session-Based-Authentication"); httpHeaderPutStr(hdr, HDR_CONNECTION, "Proxy-support"); } @@ -1943,32 +1951,8 @@ } } } - } - /* Filter unproxyable authentication types */ - if (http->log_type != LOG_TCP_DENIED && - (httpHeaderHas(hdr, HDR_PROXY_AUTHENTICATE))) { - HttpHeaderPos pos = HttpHeaderInitPos; - HttpHeaderEntry *e; - while ((e = httpHeaderGetEntry(hdr, &pos))) { - if (e->id == HDR_PROXY_AUTHENTICATE) { - const char *value = strBuf(e->value); - if ((strncasecmp(value, "NTLM", 4) == 0 && - (value[4] == '\0' || value[4] == ' ')) - || - (strncasecmp(value, "Negotiate", 9) == 0 && - (value[9] == '\0' || value[9] == ' ')) - || - (strncasecmp(value, "Kerberos", 8) == 0 && - (value[8] == '\0' || value[8] == ' '))) { - if (request->flags.no_connection_auth) { - httpHeaderDelAt(hdr, pos); - continue; - } - request->flags.must_keepalive = 1; - break; - } - } - } + if (connection_auth_blocked) + httpHeaderRefreshMask(hdr); } /* Handle authentication headers */ if (request->auth_user_request) @@ -2014,7 +1998,7 @@ } /* Signal keep-alive if needed */ httpHeaderPutStr(hdr, - http->flags.accel ? HDR_CONNECTION : HDR_PROXY_CONNECTION, + (http->flags.accel || http->flags.transparent) ? HDR_CONNECTION : HDR_PROXY_CONNECTION, request->flags.proxy_keepalive ? "keep-alive" : "close"); #if ADD_X_REQUEST_URI /* @@ -3482,7 +3466,7 @@ /* * Deny loops when running in accelerator/transproxy mode. */ - if (http->flags.accel && r->flags.loopdetect) { + if (r->flags.loopdetect && (http->flags.accel || http->flags.transparent)) { http->al.http.code = HTTP_FORBIDDEN; err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN); err->request = requestLink(http->orig_request); @@ -3681,23 +3665,41 @@ #endif /* handle "accelerated" objects (and internal) */ - if (method == METHOD_CONNECT); /* Nothing to do */ - else if (*url == '/') + if (method == METHOD_CONNECT) { + if (http_ver.major < 1) + goto invalid_request; + if (conn->port->accel) + goto invalid_request; + } else if (*url == '/') accel:{ int vhost = conn->port->vhost || conn->port->transparent; - int vport = conn->port->vport || conn->transparent; + int vport = conn->port->vport; + int accel = conn->port->accel; + if (!vport && conn->transparent) + vport = ntohs(conn->me.sin_port); if (Config.onoff.global_internal_static && conn->port->accel && internalCheck(url)) { /* prepend our name & port */ http->uri = xstrdup(internalStoreUri("", url)); http->flags.internal = 1; - http->flags.accel = 1; debug(33, 5) ("INTERNAL REWRITE: '%s'\n", http->uri); } else if (vhost && (t = mime_get_header(req_hdr, "Host"))) { + char *portstr = strchr(t, ':'); + int port = 0; + if (portstr) { + *portstr++ = '\0'; + port = atoi(portstr); + } + if (vport && !port) + port = vport; url_sz = strlen(url) + 32 + Config.appendDomainLen + strlen(t); http->uri = xcalloc(url_sz, 1); - snprintf(http->uri, url_sz, "%s://%s%s", - conn->port->protocol, t, url); + if (vport) + snprintf(http->uri, url_sz, "%s://%s:%d%s", + conn->port->protocol, t, port, url); + else + snprintf(http->uri, url_sz, "%s://%s%s", + conn->port->protocol, t, url); debug(33, 5) ("VHOST REWRITE: '%s'\n", http->uri); } else if (conn->port->defaultsite) { url_sz = strlen(url) + 32 + Config.appendDomainLen + @@ -3722,14 +3724,14 @@ /* prepend our name & port */ http->uri = xstrdup(internalStoreUri("", url)); http->flags.internal = 1; - http->flags.accel = 1; debug(33, 5) ("INTERNAL REWRITE: '%s'\n", http->uri); } else { goto invalid_request; } - http->flags.accel = 1; - } else if (conn->transparent) { - http->flags.accel = 1; + if (accel) + http->flags.accel = 1; + else if (conn->port->transparent) + http->flags.transparent = 1; } else if (conn->port->accel) { http->flags.accel = 1; if (!conn->port->vhost) { @@ -3741,9 +3743,6 @@ url = (char *) "/"; goto accel; } - } else { - /* Proxy request */ - http->flags.accel = 0; } if (!http->uri) { /* No special rewrites have been applied above, use the @@ -3751,7 +3750,6 @@ url_sz = strlen(url) + Config.appendDomainLen + 5; http->uri = xcalloc(url_sz, 1); strcpy(http->uri, url); - http->flags.accel = 0; } if (!stringHasCntl(http->uri)) http->log_uri = xstrndup(http->uri, MAX_URL); @@ -3987,6 +3985,7 @@ request->flags.tproxy = conn->port->tproxy; #endif request->flags.accelerated = http->flags.accel; + request->flags.transparent = http->flags.transparent; /* * cache the Content-length value in request_t. */ @@ -4494,12 +4493,12 @@ static int inline clientNatLookup(ConnStateData * conn) { - static time_t last_reported = 0; - if (squid_curtime - last_reported > 60) { - debug(33, 1) ("WARNING: transparent proxying not supported\n"); - last_reported = squid_curtime; + static int reported = 0; + if (!reported) { + debug(33, 1) ("NOTICE: no explicit transparent proxy support. Assuming getsockname works\n"); + reported = 1; } - return -1; + return 0; } #endif @@ -4815,7 +4814,7 @@ squid_off_t cl = httpReplyBodySize(http->request->method, http->entry->mem_obj->reply); int hs = http->entry->mem_obj->reply->hdr_sz; assert(cl >= 0); - if (http->out.offset < cl + hs) + if (http->out.offset != cl + hs) return 1; return 0; } diff -ruN squid-2.6.STABLE1/src/comm_poll.c squid-2.6.STABLE2/src/comm_poll.c --- squid-2.6.STABLE1/src/comm_poll.c Sun Jun 25 09:53:14 2006 +++ squid-2.6.STABLE2/src/comm_poll.c Wed Jul 19 09:56:39 2006 @@ -1,6 +1,6 @@ /* - * $Id: comm_poll.c,v 1.18 2006/06/25 15:53:14 serassio Exp $ + * $Id: comm_poll.c,v 1.19 2006/07/19 15:56:39 hno Exp $ * * DEBUG: section 5 Socket Functions * @@ -41,15 +41,6 @@ #endif static int MAX_POLL_TIME = 1000; /* see also comm_quick_poll_required() */ - -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif -#ifndef NBBY -#define NBBY 8 -#endif -#define FD_MASK_BYTES sizeof(fd_mask) -#define FD_MASK_BITS (FD_MASK_BYTES*NBBY) /* STATIC */ static int fdIsHttp(int fd); diff -ruN squid-2.6.STABLE1/src/debug.c squid-2.6.STABLE2/src/debug.c --- squid-2.6.STABLE1/src/debug.c Wed May 24 23:39:26 2006 +++ squid-2.6.STABLE2/src/debug.c Tue Jul 4 15:45:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: debug.c,v 1.89 2006/05/25 05:39:26 hno Exp $ + * $Id: debug.c,v 1.90 2006/07/04 21:45:24 hno Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -174,8 +174,7 @@ debug_log = stderr; return; } - if (debug_log_file) - xfree(debug_log_file); + safe_free(debug_log_file); debug_log_file = xstrdup(logfile); /* keep a static copy */ if (debug_log && debug_log != stderr) fclose(debug_log); diff -ruN squid-2.6.STABLE1/src/enums.h squid-2.6.STABLE2/src/enums.h --- squid-2.6.STABLE1/src/enums.h Thu Jun 22 15:52:29 2006 +++ squid-2.6.STABLE2/src/enums.h Wed Jul 19 10:05:11 2006 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.233 2006/06/22 21:52:29 hno Exp $ + * $Id: enums.h,v 1.234 2006/07/19 16:05:11 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -257,6 +257,7 @@ HDR_X_ERROR_STATUS, /* errormap, received HTTP status line */ HDR_FRONT_END_HTTPS, HDR_PROXY_SUPPORT, + HDR_KEEP_ALIVE, HDR_OTHER, HDR_ENUM_END } http_hdr_type; diff -ruN squid-2.6.STABLE1/src/errorpage.c squid-2.6.STABLE2/src/errorpage.c --- squid-2.6.STABLE1/src/errorpage.c Mon Jun 5 14:36:20 2006 +++ squid-2.6.STABLE2/src/errorpage.c Tue Jul 4 15:45:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.c,v 1.185 2006/06/05 20:36:20 hno Exp $ + * $Id: errorpage.c,v 1.186 2006/07/04 21:45:24 hno Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -192,8 +192,7 @@ if (FD_READ_METHOD(fd, text, (int) sb.st_size) != sb.st_size) { debug(4, 0) ("errorTryLoadText: failed to fully read: '%s': %s\n", path, xstrerror()); - xfree(text); - text = NULL; + safe_free(text); } file_close(fd); if (text && strstr(text, "%s") == NULL) diff -ruN squid-2.6.STABLE1/src/event.c squid-2.6.STABLE2/src/event.c --- squid-2.6.STABLE1/src/event.c Thu May 25 03:27:09 2006 +++ squid-2.6.STABLE2/src/event.c Sat Jul 8 05:32:04 2006 @@ -1,6 +1,6 @@ /* - * $Id: event.c,v 1.36 2006/05/25 09:27:09 hno Exp $ + * $Id: event.c,v 1.37 2006/07/08 11:32:04 hno Exp $ * * DEBUG: section 41 Event Processing * AUTHOR: Henrik Nordstrom @@ -156,12 +156,12 @@ { struct ev_entry **p = &tasks; - debug(41, 0) ("eventCleanup\n"); + debug(41, 2) ("eventCleanup\n"); while (*p) { struct ev_entry *event = *p; if (!cbdataValid(event->arg)) { - debug(41, 0) ("eventCleanup: cleaning '%s'\n", event->name); + debug(41, 2) ("eventCleanup: cleaning '%s'\n", event->name); *p = event->next; cbdataUnlock(event->arg); memFree(event, MEM_EVENT); diff -ruN squid-2.6.STABLE1/src/external_acl.c squid-2.6.STABLE2/src/external_acl.c --- squid-2.6.STABLE1/src/external_acl.c Wed May 24 14:48:38 2006 +++ squid-2.6.STABLE2/src/external_acl.c Sun Jul 30 20:04:55 2006 @@ -1,6 +1,6 @@ /* - * $Id: external_acl.c,v 1.26 2006/05/24 20:48:38 serassio Exp $ + * $Id: external_acl.c,v 1.28 2006/07/31 02:04:55 hno Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -57,6 +57,7 @@ static int external_acl_entry_expired(external_acl * def, external_acl_entry * entry); static int external_acl_grace_expired(external_acl * def, external_acl_entry * entry); static void external_acl_cache_touch(external_acl * def, external_acl_entry * entry); +static int external_acl_is_pending(external_acl * def, const char *key); /******************************************************************* * external_acl cache entry @@ -529,8 +530,18 @@ } } if (!entry) { + int lookup_needed = 1; entry = hash_lookup(acl->def->cache, key); - if (!entry || external_acl_grace_expired(acl->def, entry)) { + if (entry && !external_acl_entry_expired(acl->def, entry)) { + lookup_needed = external_acl_grace_expired(acl->def, entry); + /* Don't make graceful lookups if already pending */ + if (lookup_needed && external_acl_is_pending(acl->def, key)) + lookup_needed = 0; + /* Don't make graceful lookups when under high load */ + if (acl->def->helper->stats.queue_size > acl->def->helper->n_running * 2 / 3) + lookup_needed = 0; + } + if (lookup_needed) { debug(82, 2) ("aclMatchExternal: %s(\"%s\") = lookup needed\n", acl->def->name, key); if (acl->def->helper->stats.queue_size <= acl->def->helper->n_running) { ch->state[ACL_EXTERNAL] = ACL_LOOKUP_NEEDED; @@ -974,6 +985,20 @@ return entry->message; } +static int +external_acl_is_pending(external_acl * def, const char *key) +{ + /* Check for a pending lookup */ + dlink_node *node; + for (node = def->queue.head; node; node = node->next) { + externalAclState *oldstatetmp = node->data; + if (strcmp(key, oldstatetmp->key) == 0) { + return 1; + } + } + return 0; +} + void externalAclLookup(aclCheck_t * ch, void *acl_data, EAH * callback, void *callback_data) { @@ -1026,11 +1051,6 @@ graceful = 1; } } - if (!graceful && entry && !external_acl_grace_expired(def, entry)) { - /* Should not really happen, but why not.. */ - callback(callback_data, entry); - return; - } /* No pending lookup found. Sumbit to helper */ state = cbdataAlloc(externalAclState); state->def = def; @@ -1064,6 +1084,8 @@ /* No need to wait during grace period */ callback(callback_data, entry); return; + } else { + ch->state[ACL_EXTERNAL] = ACL_LOOKUP_PENDING; } } @@ -1084,6 +1106,15 @@ storeAppendPrintf(sentry, "Cache size: %d\n", p->cache->count); helperStats(sentry, p->helper); storeAppendPrintf(sentry, "\n"); + } +} + +void +externalAclConfigure(void) +{ + external_acl *p; + for (p = Config.externalAclHelperList; p; p = p->next) { + requirePathnameExists("external_acl_type", p->cmdline->key); } } diff -ruN squid-2.6.STABLE1/src/fs/aufs/aiops.c squid-2.6.STABLE2/src/fs/aufs/aiops.c --- squid-2.6.STABLE1/src/fs/aufs/aiops.c Sun May 28 19:53:23 2006 +++ squid-2.6.STABLE2/src/fs/aufs/aiops.c Sat Jul 29 11:37:18 2006 @@ -1,5 +1,5 @@ /* - * $Id: aiops.c,v 1.28 2006/05/29 01:53:23 hno Exp $ + * $Id: aiops.c,v 1.29 2006/07/29 17:37:18 hno Exp $ * * DEBUG: section 43 AIOPS * AUTHOR: Stewart Forster @@ -327,7 +327,16 @@ if (j < 4) j = 4; } +#if COSS_USE_AUFSOPS + j = 6; + for (i = 0; i < n_coss_dirs; i++) { + squidaio_nthreads += j; + j = 3; + } +#endif } + if (squidaio_nthreads == 0) + squidaio_nthreads = 16; squidaio_magic1 = squidaio_nthreads * MAGIC1_FACTOR; squidaio_magic2 = squidaio_nthreads * MAGIC2_FACTOR; for (i = 0; i < squidaio_nthreads; i++) { diff -ruN squid-2.6.STABLE1/src/fs/aufs/async_io.h squid-2.6.STABLE2/src/fs/aufs/async_io.h --- squid-2.6.STABLE1/src/fs/aufs/async_io.h Thu May 18 18:16:14 2006 +++ squid-2.6.STABLE2/src/fs/aufs/async_io.h Sat Jul 29 11:37:18 2006 @@ -8,6 +8,7 @@ #define __ASYNC_IO_H__ extern int n_asyncufs_dirs; +extern int n_coss_dirs; extern int squidaio_nthreads; extern int squidaio_magic1; extern int squidaio_magic2; diff -ruN squid-2.6.STABLE1/src/fs/aufs/store_asyncufs.h squid-2.6.STABLE2/src/fs/aufs/store_asyncufs.h --- squid-2.6.STABLE1/src/fs/aufs/store_asyncufs.h Thu May 18 18:16:14 2006 +++ squid-2.6.STABLE2/src/fs/aufs/store_asyncufs.h Wed Jul 5 00:52:12 2006 @@ -79,5 +79,6 @@ extern STOBJREAD storeAufsRead; extern STOBJWRITE storeAufsWrite; extern STOBJUNLINK storeAufsUnlink; +extern STOBJRECYCLE storeAufsRecycle; #endif diff -ruN squid-2.6.STABLE1/src/fs/aufs/store_dir_aufs.c squid-2.6.STABLE2/src/fs/aufs/store_dir_aufs.c --- squid-2.6.STABLE1/src/fs/aufs/store_dir_aufs.c Sat Jun 3 20:01:38 2006 +++ squid-2.6.STABLE2/src/fs/aufs/store_dir_aufs.c Sun Jul 30 17:27:04 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.c,v 1.57 2006/06/04 02:01:38 hno Exp $ + * $Id: store_dir_aufs.c,v 1.59 2006/07/30 23:27:04 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -347,6 +347,14 @@ } static void +storeAufsCheckConfig(SwapDir * sd) +{ + if (!opt_create_swap_dirs) + requirePathnameExists("cache_dir", sd->path); +} + + +static void storeAufsDirInit(SwapDir * sd) { static int started_clean_event = 0; @@ -595,15 +603,7 @@ * because adding to store_swap_size happens in * the cleanup procedure. */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeAufsDirReplRemove(e); - storeAufsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.objcount--; rb->counts.cancelcount++; } @@ -683,16 +683,7 @@ } else if (e) { /* key already exists, this swapfile not being used */ /* junk old, load new */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeAufsDirReplRemove(e); - /* Make sure we don't actually unlink the file */ - storeAufsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.dupcount++; } else { /* URL doesnt exist, swapfile not in use */ @@ -763,15 +754,7 @@ * because adding to store_swap_size happens in * the cleanup procedure. */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeAufsDirReplRemove(e); - storeAufsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.objcount--; rb->counts.cancelcount++; } @@ -851,16 +834,7 @@ } else if (e) { /* key already exists, this swapfile not being used */ /* junk old, load new */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeAufsDirReplRemove(e); - /* Make sure we don't actually unlink the file */ - storeAufsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.dupcount++; } else { /* URL doesnt exist, swapfile not in use */ @@ -1902,6 +1876,7 @@ aioinfo->swaplog_fd = -1; aioinfo->map = NULL; /* Debugging purposes */ aioinfo->suggest = 0; + sd->checkconfig = storeAufsCheckConfig; sd->init = storeAufsDirInit; sd->newfs = storeAufsDirNewfs; sd->dump = storeAufsDirDump; @@ -1921,6 +1896,7 @@ sd->obj.read = storeAufsRead; sd->obj.write = storeAufsWrite; sd->obj.unlink = storeAufsUnlink; + sd->obj.recycle = storeAufsRecycle; sd->log.open = storeAufsDirOpenSwapLog; sd->log.close = storeAufsDirCloseSwapLog; sd->log.write = storeAufsDirSwapLog; diff -ruN squid-2.6.STABLE1/src/fs/aufs/store_io_aufs.c squid-2.6.STABLE2/src/fs/aufs/store_io_aufs.c --- squid-2.6.STABLE1/src/fs/aufs/store_io_aufs.c Wed Jun 7 16:55:45 2006 +++ squid-2.6.STABLE2/src/fs/aufs/store_io_aufs.c Wed Jul 5 00:52:12 2006 @@ -246,6 +246,23 @@ statCounter.syscalls.disk.unlinks++; } +void +storeAufsRecycle(SwapDir * SD, StoreEntry * e) +{ + debug(79, 3) ("storeAufsUnlink: fileno %08X\n", e->swap_filen); + + /* Release the object without releasing the underlying physical object */ + storeExpireNow(e); + storeReleaseRequest(e); + if (e->swap_filen > -1) { + storeAufsDirReplRemove(e); + storeAufsDirMapBitReset(SD, e->swap_filen); + e->swap_filen = -1; + e->swap_dirn = -1; + } + storeRelease(e); +} + /* === STATIC =========================================================== */ static int diff -ruN squid-2.6.STABLE1/src/fs/coss/store_coss.h squid-2.6.STABLE2/src/fs/coss/store_coss.h --- squid-2.6.STABLE1/src/fs/coss/store_coss.h Sun Jun 11 14:59:09 2006 +++ squid-2.6.STABLE2/src/fs/coss/store_coss.h Wed Jul 5 00:52:12 2006 @@ -189,6 +189,7 @@ extern STOBJREAD storeCossRead; extern STOBJWRITE storeCossWrite; extern STOBJUNLINK storeCossUnlink; +extern STOBJRECYCLE storeCossRecycle; extern STSYNC storeCossSync; extern void storeCossAdd(SwapDir * sd, StoreEntry * e, int curstripe); diff -ruN squid-2.6.STABLE1/src/fs/coss/store_dir_coss.c squid-2.6.STABLE2/src/fs/coss/store_dir_coss.c --- squid-2.6.STABLE1/src/fs/coss/store_dir_coss.c Thu Jun 22 16:05:00 2006 +++ squid-2.6.STABLE2/src/fs/coss/store_dir_coss.c Sat Jul 15 03:38:37 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.c,v 1.47 2006/06/22 22:05:00 adrian Exp $ + * $Id: store_dir_coss.c,v 1.50 2006/07/15 09:38:37 serassio Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -209,6 +209,10 @@ debug(1, 1) ("storeCossRemove: %x: %d/%d\n", e, (int) e->swap_dirn, (e) e->swap_filen); #endif CossIndexNode *coss_node = e->repl.data; + /* Do what the LRU and HEAP repl policies do.. */ + if (e->repl.data == NULL) { + return; + } assert(sd->index == e->swap_dirn); assert(e->swap_filen >= 0); e->repl.data = NULL; @@ -693,6 +697,7 @@ sd->obj.read = storeCossRead; sd->obj.write = storeCossWrite; sd->obj.unlink = storeCossUnlink; + sd->obj.recycle = storeCossRecycle; sd->log.open = storeCossDirOpenSwapLog; sd->log.close = storeCossDirCloseSwapLog; @@ -984,9 +989,9 @@ } #if USE_AUFSOPS /* XXX this should be a prime candidate to use a modified aioRead which doesn't malloc a damned buffer */ - aioRead(cs->fd, cs->rebuild.curstripe * COSS_MEMBUF_SZ, COSS_MEMBUF_SZ, storeDirCoss_ReadStripeComplete, rb); + aioRead(cs->fd, (off_t) cs->rebuild.curstripe * COSS_MEMBUF_SZ, COSS_MEMBUF_SZ, storeDirCoss_ReadStripeComplete, rb); #else - a_file_read(&cs->aq, cs->fd, cs->rebuild.buf, COSS_MEMBUF_SZ, cs->rebuild.curstripe * COSS_MEMBUF_SZ, storeDirCoss_ReadStripeComplete, rb); + a_file_read(&cs->aq, cs->fd, cs->rebuild.buf, COSS_MEMBUF_SZ, (off_t) cs->rebuild.curstripe * COSS_MEMBUF_SZ, storeDirCoss_ReadStripeComplete, rb); #endif } @@ -1191,13 +1196,10 @@ storeCoss_DeleteStoreEntry(RebuildState * rb, const cache_key * key, StoreEntry * e) { assert(rb->counts.objcount >= 0); + /* XXX are these counters even correct, considering e could be a different storedir? */ rb->counts.objcount--; assert(e->swap_dirn >= 0); - storeCossRemove(INDEXSD(e->swap_dirn), e); - e->swap_filen = -1; - storeExpireNow(e); - storeReleaseRequest(e); - storeRelease(e); + storeRecycle(e); } /* diff -ruN squid-2.6.STABLE1/src/fs/coss/store_io_coss.c squid-2.6.STABLE2/src/fs/coss/store_io_coss.c --- squid-2.6.STABLE1/src/fs/coss/store_io_coss.c Mon May 22 04:56:16 2006 +++ squid-2.6.STABLE2/src/fs/coss/store_io_coss.c Sun Jul 16 19:33:38 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_io_coss.c,v 1.22 2006/05/22 10:56:16 adrian Exp $ + * $Id: store_io_coss.c,v 1.25 2006/07/17 01:33:38 hno Exp $ * * DEBUG: section 79 Storage Manager COSS Interface * AUTHOR: Eric Stern @@ -176,6 +176,14 @@ storeCossRemove(SD, e); } +void +storeCossRecycle(SwapDir * SD, StoreEntry * e) +{ + debug(79, 3) ("storeCossRecycle: %s: offset %d\n", SD->path, e->swap_filen); + storeCossUnlink(SD, e); +} + + storeIOState * storeCossCreate(SwapDir * SD, StoreEntry * e, STFNCB * file_callback, STIOCB * callback, void *callback_data) @@ -703,7 +711,7 @@ if (curfn > -1 && curfn == e->swap_filen) *collision = 1; /* Mark an object alloc collision */ assert((o >= newmb->diskstart) && (o < newmb->diskend)); - debug(79, 5) ("check: %s: stripe %d, releasing %p\n", SD->path, stripe, e); + debug(79, 3) ("COSS: %s: stripe %d, releasing filen %d (offset %" PRINTF_OFF_T ")\n", SD->path, stripe, e->swap_filen, (squid_off_t) o); storeRelease(e); numreleased++; m = n; @@ -948,6 +956,7 @@ /* Fill in details */ op->type = COSS_OP_READ; op->sio = sio; + cbdataLock(op->sio); op->requestlen = cstate->requestlen; op->requestoffset = cstate->requestoffset; op->reqdiskoffset = cstate->reqdiskoffset; @@ -962,8 +971,8 @@ storeCossCompleteReadOp(CossInfo * cs, CossReadOp * op, int error) { storeIOState *sio = op->sio; - STRCB *callback = sio->read.callback; - void *callback_data = sio->read.callback_data; + STRCB *callback = NULL; + void *callback_data = NULL; CossState *cstate = sio->fsstate; ssize_t rlen = -1; char *p; @@ -971,13 +980,15 @@ debug(79, 3) ("storeCossCompleteReadOp: op %p, op dependencies satisfied, completing\n", op); - assert(callback); - assert(callback_data); assert(storeCossGetPendingReloc(cs, sio->swap_filen) == NULL); /* and make sure we aren't on a pending op list! */ assert(op->pr == NULL); /* Is the callback still valid? If so; copy the data and callback */ - if (cbdataValid(callback_data) && cbdataValid(sio)) { + if (cbdataValid(sio) && cbdataValid(sio->read.callback_data)) { + callback = sio->read.callback; + callback_data = sio->read.callback_data; + assert(callback); + assert(callback_data); sio->read.callback = NULL; sio->read.callback_data = NULL; if (error == 0) { @@ -993,6 +1004,8 @@ } callback(callback_data, cstate->requestbuf, rlen); } + cbdataUnlock(sio); /* sio could have been freed here */ + op->sio = NULL; /* Remove from the operation list */ dlinkDelete(&op->node, &cs->pending_ops); diff -ruN squid-2.6.STABLE1/src/fs/diskd/store_dir_diskd.c squid-2.6.STABLE2/src/fs/diskd/store_dir_diskd.c --- squid-2.6.STABLE1/src/fs/diskd/store_dir_diskd.c Sat Jun 3 20:01:39 2006 +++ squid-2.6.STABLE2/src/fs/diskd/store_dir_diskd.c Sun Jul 30 17:47:14 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.c,v 1.78 2006/06/04 02:01:39 hno Exp $ + * $Id: store_dir_diskd.c,v 1.81 2006/07/30 23:47:14 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -99,6 +99,7 @@ static FILE *storeDiskdDirOpenTmpSwapLog(SwapDir *, int *, int *); static STLOGOPEN storeDiskdDirOpenSwapLog; static STINIT storeDiskdDirInit; +static STCHECKCONFIG storeDiskdCheckConfig; static STFREE storeDiskdDirFree; static STLOGCLEANSTART storeDiskdDirWriteCleanStart; static STLOGCLEANNEXTENTRY storeDiskdDirCleanLogNextEntry; @@ -357,12 +358,25 @@ } static void +storeDiskdCheckConfig(SwapDir * sd) +{ + requirePathnameExists("diskd_program", Config.Program.diskd); + if (!opt_create_swap_dirs) + requirePathnameExists("cache_dir", sd->path); +} + +static void +diskdExited(int fd, void *unused) +{ + fatal("diskd exited unexpectedly"); +} + +static void storeDiskdDirInit(SwapDir * sd) { static int started_clean_event = 0; int x; int i; - int rfd; int ikey; const char *args[5]; char skey1[32]; @@ -416,15 +430,13 @@ Config.Program.diskd, args, "diskd", - &rfd, + &diskdinfo->rfd, &diskdinfo->wfd); if (x < 0) fatalf("execl: %s", Config.Program.diskd); - if (rfd != diskdinfo->wfd) - comm_close(rfd); - fd_note(diskdinfo->wfd, "squid -> diskd"); - commSetTimeout(diskdinfo->wfd, -1, NULL, NULL); - commSetNonBlocking(diskdinfo->wfd); + fd_note(diskdinfo->rfd, "diskd -> squid health monitor"); + fd_note(diskdinfo->wfd, "squid -> diskd health monitor"); + commSetSelect(diskdinfo->rfd, COMM_SELECT_READ, diskdExited, NULL, 0); storeDiskdDirInitBitmap(sd); if (storeDiskdDirVerifyCacheDirs(sd) < 0) fatal(errmsg); @@ -785,15 +797,7 @@ * because adding to store_swap_size happens in * the cleanup procedure. */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeDiskdDirReplRemove(e); - storeDiskdDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.objcount--; rb->counts.cancelcount++; } @@ -873,16 +877,7 @@ } else if (e) { /* key already exists, this swapfile not being used */ /* junk old, load new */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeDiskdDirReplRemove(e); - /* Make sure we don't actually unlink the file */ - storeDiskdDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.dupcount++; } else { /* URL doesnt exist, swapfile not in use */ @@ -978,15 +973,7 @@ * because adding to store_swap_size happens in * the cleanup procedure. */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeDiskdDirReplRemove(e); - storeDiskdDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.objcount--; rb->counts.cancelcount++; } @@ -1066,16 +1053,7 @@ } else if (e) { /* key already exists, this swapfile not being used */ /* junk old, load new */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeDiskdDirReplRemove(e); - /* Make sure we don't actually unlink the file */ - storeDiskdDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.dupcount++; } else { /* URL doesnt exist, swapfile not in use */ @@ -2237,6 +2215,7 @@ diskdinfo->suggest = 0; diskdinfo->magic1 = 64; diskdinfo->magic2 = 72; + sd->checkconfig = storeDiskdCheckConfig; sd->init = storeDiskdDirInit; sd->newfs = storeDiskdDirNewfs; sd->dump = storeDiskdDirDump; @@ -2256,6 +2235,7 @@ sd->obj.read = storeDiskdRead; sd->obj.write = storeDiskdWrite; sd->obj.unlink = storeDiskdUnlink; + sd->obj.recycle = storeDiskdRecycle; sd->log.open = storeDiskdDirOpenSwapLog; sd->log.close = storeDiskdDirCloseSwapLog; sd->log.write = storeDiskdDirSwapLog; diff -ruN squid-2.6.STABLE1/src/fs/diskd/store_diskd.h squid-2.6.STABLE2/src/fs/diskd/store_diskd.h --- squid-2.6.STABLE1/src/fs/diskd/store_diskd.h Wed May 24 21:20:38 2006 +++ squid-2.6.STABLE2/src/fs/diskd/store_diskd.h Sun Jul 30 17:47:14 2006 @@ -23,6 +23,7 @@ int suggest; int smsgid; int rmsgid; + int rfd; int wfd; int away; struct { @@ -111,6 +112,7 @@ extern STOBJREAD storeDiskdRead; extern STOBJWRITE storeDiskdWrite; extern STOBJUNLINK storeDiskdUnlink; +extern STOBJRECYCLE storeDiskdRecycle; #define SHMBUF_BLKSZ SM_PAGE_SIZE diff -ruN squid-2.6.STABLE1/src/fs/diskd/store_io_diskd.c squid-2.6.STABLE2/src/fs/diskd/store_io_diskd.c --- squid-2.6.STABLE1/src/fs/diskd/store_io_diskd.c Wed Jun 7 16:55:45 2006 +++ squid-2.6.STABLE2/src/fs/diskd/store_io_diskd.c Wed Jul 5 00:52:13 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_io_diskd.c,v 1.31 2006/06/07 22:55:45 hno Exp $ + * $Id: store_io_diskd.c,v 1.32 2006/07/05 06:52:13 adrian Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -299,6 +299,24 @@ diskd_stats.unlink.ops++; } +void +storeDiskdRecycle(SwapDir * SD, StoreEntry * e) +{ + debug(79, 3) ("storeDiskdUnlink: fileno %08X\n", e->swap_filen); + + /* Release the object without releasing the underlying physical object */ + storeExpireNow(e); + storeReleaseRequest(e); + if (e->swap_filen > -1) { + storeDiskdDirReplRemove(e); + storeDiskdDirMapBitReset(SD, e->swap_filen); + e->swap_filen = -1; + e->swap_dirn = -1; + } + storeRelease(e); +} + + /* === STATIC =========================================================== */ @@ -454,7 +472,7 @@ storeDiskdIOCallback(storeIOState * sio, int errflag) { int valid = cbdataValid(sio->callback_data); - debug(79, 3) ("storeUfsIOCallback: errflag=%d\n", errflag); + debug(79, 3) ("storeDiskdIOCallback: errflag=%d\n", errflag); cbdataUnlock(sio->callback_data); if (valid) sio->callback(sio->callback_data, errflag, sio); diff -ruN squid-2.6.STABLE1/src/fs/ufs/store_dir_ufs.c squid-2.6.STABLE2/src/fs/ufs/store_dir_ufs.c --- squid-2.6.STABLE1/src/fs/ufs/store_dir_ufs.c Sat Jun 3 20:01:40 2006 +++ squid-2.6.STABLE2/src/fs/ufs/store_dir_ufs.c Sun Jul 30 17:27:05 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.c,v 1.57 2006/06/04 02:01:40 hno Exp $ + * $Id: store_dir_ufs.c,v 1.59 2006/07/30 23:27:05 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -358,6 +358,13 @@ } static void +storeUfsCheckConfig(SwapDir * sd) +{ + if (!opt_create_swap_dirs) + requirePathnameExists("cache_dir", sd->path); +} + +static void storeUfsDirInit(SwapDir * sd) { static int started_clean_event = 0; @@ -605,15 +612,11 @@ * because adding to store_swap_size happens in * the cleanup procedure. */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeUfsDirReplRemove(e); - storeUfsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); + /* + * XXX considering we might've canceled an object from another store; + * XXX what should happen with these stats? + */ rb->counts.objcount--; rb->counts.cancelcount++; } @@ -693,16 +696,7 @@ } else if (e) { /* key already exists, this swapfile not being used */ /* junk old, load new */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeUfsDirReplRemove(e); - /* Make sure we don't actually unlink the file */ - storeUfsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.dupcount++; } else { /* URL doesnt exist, swapfile not in use */ @@ -773,15 +767,8 @@ * because adding to store_swap_size happens in * the cleanup procedure. */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeUfsDirReplRemove(e); - storeUfsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); + /* XXX are these counters valid since e could be from another swapfs? */ rb->counts.objcount--; rb->counts.cancelcount++; } @@ -861,16 +848,7 @@ } else if (e) { /* key already exists, this swapfile not being used */ /* junk old, load new */ - storeExpireNow(e); - storeReleaseRequest(e); - if (e->swap_filen > -1) { - storeUfsDirReplRemove(e); - /* Make sure we don't actually unlink the file */ - storeUfsDirMapBitReset(SD, e->swap_filen); - e->swap_filen = -1; - e->swap_dirn = -1; - } - storeRelease(e); + storeRecycle(e); rb->counts.dupcount++; } else { /* URL doesnt exist, swapfile not in use */ @@ -1933,6 +1911,7 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->open_files = 0; + sd->checkconfig = storeUfsCheckConfig; sd->init = storeUfsDirInit; sd->newfs = storeUfsDirNewfs; sd->dump = storeUfsDirDump; @@ -1952,6 +1931,7 @@ sd->obj.read = storeUfsRead; sd->obj.write = storeUfsWrite; sd->obj.unlink = storeUfsUnlink; + sd->obj.recycle = storeUfsRecycle; sd->log.open = storeUfsDirOpenSwapLog; sd->log.close = storeUfsDirCloseSwapLog; sd->log.write = storeUfsDirSwapLog; diff -ruN squid-2.6.STABLE1/src/fs/ufs/store_io_ufs.c squid-2.6.STABLE2/src/fs/ufs/store_io_ufs.c --- squid-2.6.STABLE1/src/fs/ufs/store_io_ufs.c Wed Jun 7 16:55:45 2006 +++ squid-2.6.STABLE2/src/fs/ufs/store_io_ufs.c Wed Jul 5 00:52:14 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_io_ufs.c,v 1.14 2006/06/07 22:55:45 hno Exp $ + * $Id: store_io_ufs.c,v 1.15 2006/07/05 06:52:14 adrian Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -193,6 +193,23 @@ storeUfsDirReplRemove(e); storeUfsDirMapBitReset(SD, e->swap_filen); storeUfsDirUnlinkFile(SD, e->swap_filen); +} + +void +storeUfsRecycle(SwapDir * SD, StoreEntry * e) +{ + debug(79, 3) ("storeUfsUnlink: fileno %08X\n", e->swap_filen); + + /* Release the object without releasing the underlying physical object */ + storeExpireNow(e); + storeReleaseRequest(e); + if (e->swap_filen > -1) { + storeUfsDirReplRemove(e); + storeUfsDirMapBitReset(SD, e->swap_filen); + e->swap_filen = -1; + e->swap_dirn = -1; + } + storeRelease(e); } /* === STATIC =========================================================== */ diff -ruN squid-2.6.STABLE1/src/fs/ufs/store_ufs.h squid-2.6.STABLE2/src/fs/ufs/store_ufs.h --- squid-2.6.STABLE1/src/fs/ufs/store_ufs.h Tue May 17 10:56:43 2005 +++ squid-2.6.STABLE2/src/fs/ufs/store_ufs.h Wed Jul 5 00:52:14 2006 @@ -47,5 +47,6 @@ extern STOBJREAD storeUfsRead; extern STOBJWRITE storeUfsWrite; extern STOBJUNLINK storeUfsUnlink; +extern STOBJRECYCLE storeUfsRecycle; #endif diff -ruN squid-2.6.STABLE1/src/globals.h squid-2.6.STABLE2/src/globals.h --- squid-2.6.STABLE1/src/globals.h Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE2/src/globals.h Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.120 2006/06/30 21:23:05 hno Exp $ + * $Id: globals.h,v 1.121 2006/07/30 23:27:03 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -176,5 +176,6 @@ #if LINUX_TPROXY extern int need_linux_tproxy; /* 0 */ #endif +extern int opt_parse_cfg_only; /* 0 */ #endif /* SQUID_GLOBALS_H */ diff -ruN squid-2.6.STABLE1/src/helper.c squid-2.6.STABLE2/src/helper.c --- squid-2.6.STABLE1/src/helper.c Sat Jun 24 03:46:38 2006 +++ squid-2.6.STABLE2/src/helper.c Sun Jul 9 09:44:32 2006 @@ -1,6 +1,6 @@ /* - * $Id: helper.c,v 1.60 2006/06/24 09:46:38 serassio Exp $ + * $Id: helper.c,v 1.61 2006/07/09 15:44:32 serassio Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -255,7 +255,7 @@ if (!srv) srv = helperStatefulGetServer(hlp); if (srv) { - debug(84, 5) ("helperStatefulSubmit: sever %p, buf '%s'.\n", srv, buf ? buf : "NULL"); + debug(84, 5) ("helperStatefulSubmit: server %p, buf '%s'.\n", srv, buf ? buf : "NULL"); assert(!srv->request); assert(!srv->flags.busy); helperStatefulDispatch(srv, r); diff -ruN squid-2.6.STABLE1/src/htcp.c squid-2.6.STABLE2/src/htcp.c --- squid-2.6.STABLE1/src/htcp.c Mon Jun 12 11:44:41 2006 +++ squid-2.6.STABLE2/src/htcp.c Sat Jul 29 11:35:31 2006 @@ -1,6 +1,6 @@ /* - * $Id: htcp.c,v 1.52 2006/06/12 17:44:41 hno Exp $ + * $Id: htcp.c,v 1.53 2006/07/29 17:35:31 serassio Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -448,6 +448,8 @@ len); if (x < 0) debug(31, 1) ("htcpSend: FD %d sendto: %s\n", htcpOutSocket, xstrerror()); + else + statCounter.htcp.pkts_sent++; } /* @@ -1094,6 +1096,8 @@ len = recvfrom(fd, buf, sizeof(buf) - 1, 0, (struct sockaddr *) &from, &flen); debug(31, 3) ("htcpRecv: FD %d, %d bytes from %s:%d\n", fd, len, inet_ntoa(from.sin_addr), ntohs(from.sin_port)); + if (len) + statCounter.htcp.pkts_recv++; htcpHandle(buf, len, &from); commSetSelect(fd, COMM_SELECT_READ, htcpRecv, NULL, 0); } diff -ruN squid-2.6.STABLE1/src/http.c squid-2.6.STABLE2/src/http.c --- squid-2.6.STABLE1/src/http.c Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE2/src/http.c Wed Jul 26 14:09:33 2006 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.415 2006/06/30 21:23:05 hno Exp $ + * $Id: http.c,v 1.416 2006/07/26 20:09:33 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -923,17 +923,24 @@ const HttpHeaderEntry *e; String strFwd; HttpHeaderPos pos = HttpHeaderInitPos; + String etags = StringNull; + httpHeaderInit(hdr_out, hoRequest); /* append our IMS header */ if (request->lastmod > -1) httpHeaderPutTime(hdr_out, HDR_IF_MODIFIED_SINCE, request->lastmod); - if (request->etag) - httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, request->etag); - else if (request->etags) { + if (request->etag) { + etags = httpHeaderGetList(hdr_in, HDR_IF_NONE_MATCH); + strListAddUnique(&etags, request->etag, ','); + } else if (request->etags) { int i; + etags = httpHeaderGetList(hdr_in, HDR_IF_NONE_MATCH); for (i = 0; i < request->etags->count; i++) - httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, request->etags->items[i]); + strListAddUnique(&etags, request->etags->items[i], ','); } + if (strLen(etags)) + httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, strBuf(etags)); + stringClean(&etags); /* decide if we want to do Ranges ourselves * (and fetch the whole object now) * We want to handle Ranges ourselves iff @@ -1020,6 +1027,12 @@ /* append unless we added our own; * note: at most one client's ims header can pass through */ if (!httpHeaderHas(hdr_out, HDR_IF_MODIFIED_SINCE)) + httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e)); + break; + case HDR_IF_NONE_MATCH: + /* append unless we added our own; + * note: at most one client's ims header can pass through */ + if (!httpHeaderHas(hdr_out, HDR_IF_NONE_MATCH)) httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e)); break; case HDR_MAX_FORWARDS: diff -ruN squid-2.6.STABLE1/src/ipc.c squid-2.6.STABLE2/src/ipc.c --- squid-2.6.STABLE1/src/ipc.c Sat Jun 24 03:41:36 2006 +++ squid-2.6.STABLE2/src/ipc.c Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: ipc.c,v 1.37 2006/06/24 09:41:36 serassio Exp $ + * $Id: ipc.c,v 1.38 2006/07/30 23:27:03 hno Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -77,6 +77,8 @@ #if HAVE_POLL && defined(_SQUID_OSF_) assert(type != IPC_FIFO); #endif + + requirePathnameExists(name, prog); if (rfd) *rfd = -1; diff -ruN squid-2.6.STABLE1/src/logfile.c squid-2.6.STABLE2/src/logfile.c --- squid-2.6.STABLE1/src/logfile.c Mon Jun 5 15:06:34 2006 +++ squid-2.6.STABLE2/src/logfile.c Tue Jul 18 16:29:07 2006 @@ -1,5 +1,5 @@ /* - * $Id: logfile.c,v 1.16 2006/06/05 21:06:34 serassio Exp $ + * $Id: logfile.c,v 1.17 2006/07/18 22:29:07 hno Exp $ * * DEBUG: section 50 Log file handling * AUTHOR: Duane Wessels @@ -270,7 +270,10 @@ if (fmt[strlen(fmt) - 1] == '\n') buf[8191] = '\n'; } - logfileWrite(lf, buf, (size_t) s); + if (s > 0) + logfileWrite(lf, buf, (size_t) s); + else + debug(50, 1) ("Failed to format log data for %s\n", lf->path); va_end(args); } diff -ruN squid-2.6.STABLE1/src/main.c squid-2.6.STABLE2/src/main.c --- squid-2.6.STABLE1/src/main.c Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE2/src/main.c Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.384 2006/06/30 21:23:05 hno Exp $ + * $Id: main.c,v 1.387 2006/07/30 23:27:03 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -34,10 +34,6 @@ */ #include "squid.h" -#ifdef LINUX_TPROXY -#include -#include -#endif #if defined(USE_WIN32_SERVICE) && defined(_SQUID_WIN32_) #include @@ -53,7 +49,6 @@ /* for error reporting from xmalloc and friends */ extern void (*failure_notify) (const char *); -static int opt_parse_cfg_only = 0; static char *opt_syslog_facility = NULL; static int icpPortNumOverride = 1; /* Want to detect "-u 0" */ static int configured_once = 0; @@ -480,13 +475,7 @@ static void setEffectiveUser(void) { -#if LINUX_TPROXY - if (need_linux_tproxy) { - if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) { - debug(0, 1) ("Error - tproxy support requires capability setting which has failed. Continuing without tproxy support\n"); - } - } -#endif + keepCapabilities(); leave_suid(); /* Run as non privilegied user */ #ifdef _SQUID_OS2_ return; diff -ruN squid-2.6.STABLE1/src/neighbors.c squid-2.6.STABLE2/src/neighbors.c --- squid-2.6.STABLE1/src/neighbors.c Thu Jun 22 15:52:29 2006 +++ squid-2.6.STABLE2/src/neighbors.c Tue Jul 25 12:11:44 2006 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.c,v 1.309 2006/06/22 21:52:29 hno Exp $ + * $Id: neighbors.c,v 1.310 2006/07/25 18:11:44 hno Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -1165,6 +1165,7 @@ psstate->entry = fake; psstate->callback = NULL; psstate->callback_data = p; + cbdataLock(psstate->callback_data); psstate->ping.start = current_time; mem = fake->mem_obj; mem->request = requestLink(psstate->request); @@ -1184,7 +1185,7 @@ eventAdd("peerCountMcastPeersDone", peerCountMcastPeersDone, psstate, - (double) Config.Timeout.mcast_icp_query, 1); + Config.Timeout.mcast_icp_query / 1000.0, 1); p->mcast.flags.counting = 1; peerCountMcastPeersSchedule(p, MCAST_COUNT_RATE); } @@ -1195,17 +1196,20 @@ ps_state *psstate = data; peer *p = psstate->callback_data; StoreEntry *fake = psstate->entry; - p->mcast.flags.counting = 0; - p->mcast.avg_n_members = doubleAverage(p->mcast.avg_n_members, - (double) psstate->ping.n_recv, - ++p->mcast.n_times_counted, - 10); - debug(15, 1) ("Group %s: %d replies, %4.1f average, RTT %d\n", - p->host, - psstate->ping.n_recv, - p->mcast.avg_n_members, - p->stats.rtt); - p->mcast.n_replies_expected = (int) p->mcast.avg_n_members; + if (cbdataValid(p)) { + p->mcast.flags.counting = 0; + p->mcast.avg_n_members = doubleAverage(p->mcast.avg_n_members, + (double) psstate->ping.n_recv, + ++p->mcast.n_times_counted, + 10); + debug(15, 1) ("Group %s: %d replies, %4.1f average, RTT %d\n", + p->host, + psstate->ping.n_recv, + p->mcast.avg_n_members, + p->stats.rtt); + p->mcast.n_replies_expected = (int) p->mcast.avg_n_members; + } + cbdataUnlock(p); EBIT_SET(fake->flags, ENTRY_ABORTED); requestUnlink(fake->mem_obj->request); fake->mem_obj->request = NULL; diff -ruN squid-2.6.STABLE1/src/protos.h squid-2.6.STABLE2/src/protos.h --- squid-2.6.STABLE1/src/protos.h Wed Jun 28 04:31:57 2006 +++ squid-2.6.STABLE2/src/protos.h Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.502 2006/06/28 10:31:57 hno Exp $ + * $Id: protos.h,v 1.507 2006/07/30 23:27:03 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -391,6 +391,7 @@ extern int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive); extern void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, squid_off_t); extern void strListAdd(String * str, const char *item, char del); +extern void strListAddUnique(String * str, const char *item, char del); extern int strListIsMember(const String * str, const char *item, char del); extern int strListIsSubstr(const String * list, const char *s, char del); extern int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos); @@ -448,6 +449,7 @@ extern int httpHeaderDelByName(HttpHeader * hdr, const char *name); extern int httpHeaderDelById(HttpHeader * hdr, http_hdr_type id); extern void httpHeaderDelAt(HttpHeader * hdr, HttpHeaderPos pos); +extern void httpHeaderRefreshMask(HttpHeader * hdr); /* avoid using these low level routines */ extern HttpHeaderEntry *httpHeaderGetEntry(const HttpHeader * hdr, HttpHeaderPos * pos); extern HttpHeaderEntry *httpHeaderFindEntry(const HttpHeader * hdr, http_hdr_type id); @@ -744,6 +746,7 @@ extern int authenticateAuthSchemeId(const char *typestr); extern void authenticateStart(auth_user_request_t *, RH *, void *); extern void authenticateSchemeInit(void); +extern void authenticateConfigure(authConfig *); extern void authenticateInit(authConfig *); extern void authenticateShutdown(void); extern void authenticateFixHeader(HttpReply *, auth_user_request_t *, request_t *, int, int); @@ -957,6 +960,7 @@ extern void storeRead(storeIOState *, char *, size_t, squid_off_t, STRCB *, void *); extern void storeWrite(storeIOState *, char *, size_t, FREE *); extern void storeUnlink(StoreEntry *); +extern void storeRecycle(StoreEntry *); extern squid_off_t storeOffset(storeIOState *); /* @@ -1006,7 +1010,6 @@ extern const char *storeSwapPath(int); extern int storeDirWriteCleanLogs(int reopen); extern STDIRSELECT *storeDirSelectSwapDir; -extern int storeVerifySwapDirs(void); extern void storeCreateSwapDirectories(void); extern void storeDirCloseSwapLogs(void); extern void storeDirCloseTmpSwapLog(int dirn); @@ -1187,6 +1190,7 @@ void setUmask(mode_t mask); int xusleep(unsigned int usec); +void keepCapabilities(void); #if USE_HTCP extern void htcpInit(void); @@ -1373,6 +1377,7 @@ extern wordlist *aclDumpExternal(void *dataptr); typedef void EAH(void *data, void *result); extern void externalAclLookup(aclCheck_t * ch, void *acl_data, EAH * handler, void *data); +extern void externalAclConfigure(void); extern void externalAclInit(void); extern void externalAclShutdown(void); extern int externalAclRequiresAuth(void *acl_data); diff -ruN squid-2.6.STABLE1/src/redirect.c squid-2.6.STABLE2/src/redirect.c --- squid-2.6.STABLE1/src/redirect.c Mon May 15 20:18:33 2006 +++ squid-2.6.STABLE2/src/redirect.c Sat Jul 8 10:01:12 2006 @@ -1,6 +1,6 @@ /* - * $Id: redirect.c,v 1.95 2006/05/16 02:18:33 hno Exp $ + * $Id: redirect.c,v 1.96 2006/07/08 16:01:12 serassio Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -110,13 +110,20 @@ r = cbdataAlloc(redirectStateData); r->orig_url = xstrdup(http->uri); r->client_addr = conn->log_addr; + r->client_ident = NULL; if (http->request->auth_user_request) r->client_ident = authenticateUserRequestUsername(http->request->auth_user_request); - else if (conn->rfc931[0]) { + else if (http->request->extacl_user) { + r->client_ident = http->request->extacl_user; + } + if (!r->client_ident && conn->rfc931[0]) r->client_ident = conn->rfc931; - } else { +#if USE_SSL + if (!r->client_ident) + r->client_ident = sslGetUserEmail(fd_table[conn->fd].ssl); +#endif + if (!r->client_ident) r->client_ident = dash_str; - } r->method_s = RequestMethodStr[http->request->method]; r->handler = handler; r->data = data; diff -ruN squid-2.6.STABLE1/src/refresh.c squid-2.6.STABLE2/src/refresh.c --- squid-2.6.STABLE1/src/refresh.c Wed Jun 7 07:03:41 2006 +++ squid-2.6.STABLE2/src/refresh.c Fri Jul 28 14:49:09 2006 @@ -1,6 +1,6 @@ /* - * $Id: refresh.c,v 1.60 2006/06/07 13:03:41 hno Exp $ + * $Id: refresh.c,v 1.61 2006/07/28 20:49:09 hno Exp $ * * DEBUG: section 22 Refresh Calculation * AUTHOR: Harvest Derived @@ -330,7 +330,7 @@ * 60 seconds delta, to avoid objects which expire almost * immediately, and which can't be refreshed. */ - int reason = refreshCheck(entry, NULL, 60); + int reason = refreshCheck(entry, NULL, Config.minimum_expiry_time); refreshCounts[rcStore].total++; refreshCounts[rcStore].status[reason]++; if (reason < 200) diff -ruN squid-2.6.STABLE1/src/snmp_core.c squid-2.6.STABLE2/src/snmp_core.c --- squid-2.6.STABLE1/src/snmp_core.c Mon May 15 19:08:30 2006 +++ squid-2.6.STABLE2/src/snmp_core.c Sat Jul 29 14:38:59 2006 @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.c,v 1.59 2006/05/16 01:08:30 hno Exp $ + * $Id: snmp_core.c,v 1.60 2006/07/29 20:38:59 serassio Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -577,7 +577,7 @@ snmp_free_pdu(rq->PDU); if (RespPDU != NULL) { snmp_build(&rq->session, RespPDU, rq->outbuf, &rq->outlen); - sendto(rq->sock, rq->outbuf, rq->outlen, 0, (struct sockaddr *) &rq->from, sizeof(rq->from)); + comm_udp_sendto(rq->sock, &rq->from, sizeof(rq->from), rq->outbuf, rq->outlen); snmp_free_pdu(RespPDU); } } diff -ruN squid-2.6.STABLE1/src/ssl.c squid-2.6.STABLE2/src/ssl.c --- squid-2.6.STABLE1/src/ssl.c Thu Jun 1 18:07:40 2006 +++ squid-2.6.STABLE2/src/ssl.c Sun Jul 23 15:27:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: ssl.c,v 1.132 2006/06/02 00:07:40 hno Exp $ + * $Id: ssl.c,v 1.133 2006/07/23 21:27:07 hno Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -230,8 +230,14 @@ } cbdataLock(sslState); if (len < 0) { - debug(50, ignoreErrno(errno) ? 3 : 1) - ("sslReadServer: FD %d: read failure: %s\n", fd, xstrerror()); + int level = 1; +#ifdef ECONNRESET + if (errno == ECONNRESET) + level = 2; +#endif + if (ignoreErrno(errno)) + level = 3; + debug(50, level) ("sslReadServer: FD %d: read failure: %s\n", fd, xstrerror()); if (!ignoreErrno(errno)) comm_close(fd); } else if (len == 0) { diff -ruN squid-2.6.STABLE1/src/ssl_support.c squid-2.6.STABLE2/src/ssl_support.c --- squid-2.6.STABLE1/src/ssl_support.c Mon Jun 26 09:01:59 2006 +++ squid-2.6.STABLE2/src/ssl_support.c Tue Jul 4 15:55:55 2006 @@ -1,6 +1,6 @@ /* - * $Id: ssl_support.c,v 1.10 2006/06/26 15:01:59 hno Exp $ + * $Id: ssl_support.c,v 1.11 2006/07/04 21:55:55 hno Exp $ * * AUTHOR: Benno Rice * DEBUG: section 83 SSL accelerator support @@ -887,7 +887,6 @@ ret = ssl_get_attribute(name, attribute_name); X509_free(cert); - CRYPTO_free(name); return ret; } @@ -911,7 +910,6 @@ ret = ssl_get_attribute(name, attribute_name); X509_free(cert); - CRYPTO_free(name); return ret; } @@ -943,7 +941,7 @@ const char * sslGetUserEmail(SSL * ssl) { - return sslGetUserAttribute(ssl, "Email"); + return sslGetUserAttribute(ssl, "emailAddress"); } const char * diff -ruN squid-2.6.STABLE1/src/stat.c squid-2.6.STABLE2/src/stat.c --- squid-2.6.STABLE1/src/stat.c Mon Jun 5 17:20:24 2006 +++ squid-2.6.STABLE2/src/stat.c Sat Jul 29 11:35:31 2006 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.371 2006/06/05 23:20:24 hno Exp $ + * $Id: stat.c,v 1.373 2006/07/29 17:35:31 serassio Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -508,6 +508,12 @@ statCounter.icp.pkts_sent); storeAppendPrintf(sentry, "\tNumber of queued ICP replies:\t%u\n", statCounter.icp.replies_queued); +#if USE_HTCP + storeAppendPrintf(sentry, "\tNumber of HTCP messages received:\t%u\n", + statCounter.htcp.pkts_recv); + storeAppendPrintf(sentry, "\tNumber of HTCP messages sent:\t%u\n", + statCounter.htcp.pkts_sent); +#endif storeAppendPrintf(sentry, "\tRequest failure ratio:\t%5.2f\n", request_failure_ratio); @@ -1447,6 +1453,7 @@ StoreEntry *e; int fd; for (i = ClientActiveRequests.head; i; i = i->next) { + const char *p = NULL; http = i->data; assert(http); conn = http->conn; @@ -1482,16 +1489,20 @@ (long int) http->start.tv_sec, (int) http->start.tv_usec, tvSubDsec(http->start, current_time)); - if (http->request->auth_user_request) { - const char *p = NULL; - + if (http->request->auth_user_request) p = authenticateUserRequestUsername(http->request->auth_user_request); - - if (!p) - p = "-"; - - storeAppendPrintf(s, "username %s\n", p); + else if (http->request->extacl_user) { + p = http->request->extacl_user; } + if (!p && conn->rfc931[0]) + p = conn->rfc931; +#if USE_SSL + if (!p) + p = sslGetUserEmail(fd_table[conn->fd].ssl); +#endif + if (!p) + p = dash_str; + storeAppendPrintf(s, "username %s\n", p); #if DELAY_POOLS storeAppendPrintf(s, "delay_pool %d\n", delayClient(http) >> 16); #endif diff -ruN squid-2.6.STABLE1/src/store.c squid-2.6.STABLE2/src/store.c --- squid-2.6.STABLE1/src/store.c Fri Jun 30 09:05:38 2006 +++ squid-2.6.STABLE2/src/store.c Sun Jul 16 20:32:00 2006 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.561 2006/06/30 15:05:38 hno Exp $ + * $Id: store.c,v 1.565 2006/07/17 02:32:00 hno Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -553,9 +553,9 @@ cbdataFree(state); return; } - hdr_sz = state->e->mem_obj->reply->hdr_sz; - state->seen_offset = state->e->mem_obj->reply->hdr_sz; - if (l >= state->e->mem_obj->reply->hdr_sz) { + hdr_sz = state->oe->mem_obj->reply->hdr_sz; + state->seen_offset = hdr_sz; + if (l >= hdr_sz) { state->seen_offset = l; l -= hdr_sz; p += hdr_sz; @@ -586,6 +586,10 @@ state->current.this_key = 1; } debug(11, 3) ("storeAddVaryReadOld: Key: %s%s\n", state->current.key, state->current.this_key ? " (THIS)" : ""); +#if 0 /* This condition is not correct here.. current.key is always null */ + } else if (!state->current.key) { + debug(11, 1) ("storeAddVaryReadOld: Unexpected data '%s'\n", p); +#endif } else if (strmatchbeg(p, "ETag: ", l) == 0) { /* etag field */ p2 = p + 6; @@ -600,6 +604,7 @@ } else if (!state->key) { state->current.this_key = 1; } else if (!state->current.this_key) { + /* XXX This could use a bit of protection from corrupted entries where Key had not been seen before ETag.. */ const cache_key *oldkey = storeKeyScan(state->current.key); StoreEntry *old_e = storeGet(oldkey); if (old_e) @@ -838,6 +843,12 @@ debug(11, 3) ("storeLocateVaryRead: Key: %s\n", state->current.key); } else if (state->current.ignore) { /* Skip this entry */ + } else if (!state->current.key) { + char *t1 = xstrndup(p, e - p); + char *t2 = xstrndup(state->buf, size + state->buf_offset); + debug(11, 1) ("storeLocateVaryRead: Unexpected data '%s' in '%s'", t1, t2); + safe_free(t2); + safe_free(t1); } else if (strmatchbeg(p, "ETag: ", l) == 0) { /* etag field */ char *etag; @@ -917,7 +928,6 @@ if (strBuf(accept_encoding)) state->accept_encoding = xstrdup(strBuf(accept_encoding)); state->data = memPoolAlloc(VaryData_pool); - stringClean(&accept_encoding); state->e = e; storeLockObject(state->e); state->callback_data = cbdata; diff -ruN squid-2.6.STABLE1/src/store_digest.c squid-2.6.STABLE2/src/store_digest.c --- squid-2.6.STABLE1/src/store_digest.c Tue May 17 10:56:38 2005 +++ squid-2.6.STABLE2/src/store_digest.c Mon Jul 17 08:09:57 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_digest.c,v 1.52 2005/05/17 16:56:38 hno Exp $ + * $Id: store_digest.c,v 1.53 2006/07/17 14:09:57 hno Exp $ * * DEBUG: section 71 Store Digest Manager * AUTHOR: Alex Rousskov @@ -347,7 +347,7 @@ } debug(71, 2) ("storeDigestRewrite: start rewrite #%d\n", sd_state.rewrite_count + 1); /* make new store entry */ - url = internalLocalUri("/squid-internal-periodic/", StoreDigestFileName); + url = internalStoreUri("/squid-internal-periodic/", StoreDigestFileName); flags = null_request_flags; flags.cachable = 1; e = storeCreateEntry(url, url, flags, METHOD_GET); diff -ruN squid-2.6.STABLE1/src/store_dir.c squid-2.6.STABLE2/src/store_dir.c --- squid-2.6.STABLE1/src/store_dir.c Sat Jun 3 20:01:38 2006 +++ squid-2.6.STABLE2/src/store_dir.c Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.c,v 1.141 2006/06/04 02:01:38 hno Exp $ + * $Id: store_dir.c,v 1.142 2006/07/30 23:27:03 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -353,6 +353,8 @@ Config.Swap.maxSize += SD->max_size; SD->low_size = (int) (((float) SD->max_size * (float) Config.Swap.lowWaterMark) / 100.0); + if (SD->checkconfig) + SD->checkconfig(SD); } } diff -ruN squid-2.6.STABLE1/src/store_io.c squid-2.6.STABLE2/src/store_io.c --- squid-2.6.STABLE1/src/store_io.c Sat May 27 09:50:16 2006 +++ squid-2.6.STABLE2/src/store_io.c Wed Jul 5 00:52:12 2006 @@ -119,6 +119,13 @@ SD->obj.unlink(SD, e); } +void +storeRecycle(StoreEntry * e) +{ + SwapDir *SD = INDEXSD(e->swap_dirn); + SD->obj.recycle(SD, e); +} + squid_off_t storeOffset(storeIOState * sio) { diff -ruN squid-2.6.STABLE1/src/store_rebuild.c squid-2.6.STABLE2/src/store_rebuild.c --- squid-2.6.STABLE1/src/store_rebuild.c Tue May 17 10:56:38 2005 +++ squid-2.6.STABLE2/src/store_rebuild.c Tue Jul 4 15:45:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_rebuild.c,v 1.78 2005/05/17 16:56:38 hno Exp $ + * $Id: store_rebuild.c,v 1.79 2006/07/04 21:45:24 hno Exp $ * * DEBUG: section 20 Store Rebuild Routines * AUTHOR: Duane Wessels @@ -145,8 +145,7 @@ (double) counts.objcount / (dt > 0.0 ? dt : 1.0)); debug(20, 1) ("Beginning Validation Procedure\n"); eventAdd("storeCleanup", storeCleanup, NULL, 0.0, 1); - xfree(RebuildProgress); - RebuildProgress = NULL; + safe_free(RebuildProgress); } /* diff -ruN squid-2.6.STABLE1/src/store_swapmeta.c squid-2.6.STABLE2/src/store_swapmeta.c --- squid-2.6.STABLE1/src/store_swapmeta.c Sat May 20 07:05:58 2006 +++ squid-2.6.STABLE2/src/store_swapmeta.c Sat Jul 29 08:44:49 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_swapmeta.c,v 1.20 2006/05/20 13:05:58 hno Exp $ + * $Id: store_swapmeta.c,v 1.21 2006/07/29 14:44:49 hno Exp $ * * DEBUG: section 20 Storage Manager Swapfile Metadata * AUTHOR: Kostas Anagnostakis @@ -120,7 +120,7 @@ tlv * storeSwapMetaUnpack(const char *buf, int *hdr_len) { - tlv *TLV; /* we'll return this */ + tlv *TLV = NULL; /* we'll return this */ tlv **T = &TLV; char type; int length; diff -ruN squid-2.6.STABLE1/src/structs.h squid-2.6.STABLE2/src/structs.h --- squid-2.6.STABLE1/src/structs.h Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE2/src/structs.h Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.489 2006/06/30 21:23:05 hno Exp $ + * $Id: structs.h,v 1.496 2006/07/30 23:27:03 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -182,6 +182,7 @@ AUTHSDECODE *decodeauth; AUTHSDIRECTION *getdirection; AUTHSPARSE *parse; + AUTHSCHECKCONFIG *checkconfig; AUTHSINIT *init; AUTHSREQFREE *requestFree; AUTHSSHUTDOWN *donefunc; @@ -346,6 +347,7 @@ struct _acl_request_type { unsigned int accelerated:1; + unsigned int transparent:1; unsigned int internal:1; }; @@ -505,6 +507,7 @@ struct in_addr address; int forwarding_method; int return_method; + int rebuildwait; void *info; } Wccp2; #endif @@ -786,6 +789,7 @@ } warnings; char *store_dir_select_algorithm; int sleep_after_fork; /* microseconds */ + time_t minimum_expiry_time; /* seconds */ external_acl *externalAclHelperList; errormap *errorMapList; #if USE_SSL @@ -1190,6 +1194,7 @@ AccessLogEntry al; struct { unsigned int accel:1; + unsigned int transparent:1; unsigned int internal:1; unsigned int done_copying:1; unsigned int purging:1; @@ -1728,6 +1733,7 @@ unsigned int read_only:1; } flags; STINIT *init; /* Initialise the fs */ + STCHECKCONFIG *checkconfig; /* Verify configuration */ STNEWFS *newfs; /* Create a new fs */ STDUMP *dump; /* Dump fs config snippet */ STFREE *freefs; /* Free the fs data */ @@ -1748,6 +1754,7 @@ STOBJREAD *read; STOBJWRITE *write; STOBJUNLINK *unlink; + STOBJRECYCLE *recycle; } obj; struct { STLOGOPEN *open; @@ -1785,6 +1792,7 @@ unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */ #endif unsigned int accelerated:1; + unsigned int transparent:1; unsigned int internal:1; unsigned int body_sent:1; unsigned int reset_tcp:1; @@ -1867,7 +1875,6 @@ char *peer_domain; /* Configured peer forceddomain */ BODY_HANDLER *body_reader; void *body_reader_data; -#define HAVE_EXTACL_LOG 1 String extacl_log; /* String to be used for access.log purposes */ const char *extacl_user; /* User name returned by extacl lookup */ const char *extacl_passwd; /* Password returned by extacl lookup */ @@ -2005,6 +2012,10 @@ int query_timeouts; int times_used; } icp; + struct { + int pkts_sent; + int pkts_recv; + } htcp; struct { int requests; } unlink; diff -ruN squid-2.6.STABLE1/src/tools.c squid-2.6.STABLE2/src/tools.c --- squid-2.6.STABLE1/src/tools.c Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE2/src/tools.c Mon Jul 17 18:22:20 2006 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.242 2006/06/30 21:23:05 hno Exp $ + * $Id: tools.c,v 1.244 2006/07/18 00:22:20 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -37,6 +37,10 @@ #if LINUX_TPROXY #undef _POSIX_SOURCE +/* Ugly glue to get around linux header madness colliding with glibc */ +#define _LINUX_TYPES_H +#define _LINUX_FS_H +typedef uint32_t __u32; #include #endif @@ -571,7 +575,7 @@ if (strcmp(Config.coredump_dir, "none") == 0) return; -#if HAVE_PRCTL && defined(PR_SET_DUMPABLE) && 0 +#if HAVE_PRCTL && defined(PR_SET_DUMPABLE) /* Set Linux DUMPABLE flag */ if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) != 0) debug(50, 2) ("prctl: %s\n", xstrerror()); @@ -674,7 +678,7 @@ uid_t uid; leave_suid(); uid = geteuid(); - debug(21, 3) ("leave_suid: PID %d giving up root priveleges forever\n", (int) getpid()); + debug(21, 3) ("no_suid: PID %d giving up root priveleges forever\n", (int) getpid()); #if HAVE_SETRESUID if (setresuid(uid, uid, uid) < 0) debug(50, 1) ("no_suid: setresuid: %s\n", xstrerror()); @@ -1291,4 +1295,16 @@ sl.tv_sec = usec / 1000000; sl.tv_usec = usec % 1000000; return select(0, NULL, NULL, NULL, &sl); +} + +void +keepCapabilities(void) +{ +#if LINUX_TPROXY + if (need_linux_tproxy) { + if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) { + debug(1, 1) ("Error - tproxy support requires capability setting which has failed. Continuing without tproxy support\n"); + } + } +#endif } diff -ruN squid-2.6.STABLE1/src/typedefs.h squid-2.6.STABLE2/src/typedefs.h --- squid-2.6.STABLE1/src/typedefs.h Sat Jun 3 20:50:05 2006 +++ squid-2.6.STABLE2/src/typedefs.h Sun Jul 30 17:27:03 2006 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.147 2006/06/04 02:50:05 hno Exp $ + * $Id: typedefs.h,v 1.149 2006/07/30 23:27:03 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -289,6 +289,7 @@ typedef void IDNSCB(void *, rfc1035_rr *, int, const char *); typedef void STINIT(SwapDir *); +typedef void STCHECKCONFIG(SwapDir *); typedef void STNEWFS(SwapDir *); typedef void STDUMP(StoreEntry *, SwapDir *); typedef void STFREE(SwapDir *); @@ -310,6 +311,7 @@ typedef void STOBJREAD(SwapDir *, storeIOState *, char *, size_t, squid_off_t, STRCB *, void *); typedef void STOBJWRITE(SwapDir *, storeIOState *, char *, size_t, squid_off_t, FREE *); typedef void STOBJUNLINK(SwapDir *, StoreEntry *); +typedef void STOBJRECYCLE(SwapDir *, StoreEntry *); typedef void STLOGOPEN(SwapDir *); typedef void STLOGCLOSE(SwapDir *); @@ -345,6 +347,7 @@ typedef char *AUTHSUSERNAME(auth_user_t *); typedef void AUTHSONCLOSEC(ConnStateData *); typedef void AUTHSPARSE(authScheme *, int, char *); +typedef void AUTHSCHECKCONFIG(authScheme *); typedef void AUTHSINIT(authScheme *); typedef void AUTHSREQFREE(auth_user_request_t *); typedef void AUTHSSETUP(authscheme_entry_t *); diff -ruN squid-2.6.STABLE1/src/wccp2.c squid-2.6.STABLE2/src/wccp2.c --- squid-2.6.STABLE1/src/wccp2.c Sat Jun 10 18:12:39 2006 +++ squid-2.6.STABLE2/src/wccp2.c Sun Jul 30 16:15:30 2006 @@ -1,6 +1,6 @@ /* - * $Id: wccp2.c,v 1.13 2006/06/11 00:12:39 hno Exp $ + * $Id: wccp2.c,v 1.23 2006/07/30 22:15:30 hno Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Steven WIlton @@ -38,18 +38,9 @@ #include #define WCCP_PORT 2048 -#define WCCP_VERSION 4 -#define WCCP_REVISION 0 #define WCCP_RESPONSE_SIZE 12448 -#define WCCP_ACTIVE_CACHES 32 -#define WCCP_HASH_SIZE 32 #define WCCP_BUCKETS 256 -#define WCCP_HERE_I_AM 7 -#define WCCP_I_SEE_YOU 8 -#define WCCP_ASSIGN_BUCKET 9 - - static int theWccp2Connection = -1; static int wccp2_connected = 0; @@ -62,6 +53,7 @@ #define WCCP2_I_SEE_YOU 11 #define WCCP2_REDIRECT_ASSIGN 12 #define WCCP2_REMOVAL_QUERY 13 + #define WCCP2_VERSION 0x200 #define WCCP2_SECURITY_INFO 0 @@ -102,8 +94,14 @@ #define WCCP2_CAPABILITY_ASSIGNMENT_METHOD 0x02 #define WCCP2_CAPABILITY_RETURN_METHOD 0x03 -#define WCCP2_CAPABILITY_GRE 0x00000001 -#define WCCP2_CAPABILITY_L2 0x00000002 +#define WCCP2_FORWARDING_METHOD_GRE 0x00000001 +#define WCCP2_FORWARDING_METHOD_L2 0x00000002 + +#define WCCP2_ASSIGNMENT_METHOD_HASH 0x00000001 +#define WCCP2_ASSIGNMENT_METHOD_MASK 0x00000002 + +#define WCCP2_PACKET_RETURN_METHOD_GRE 0x00000001 +#define WCCP2_PACKET_RETURN_METHOD_L2 0x00000002 #define WCCP2_NONE_SECURITY_LEN 0 #define WCCP2_MD5_SECURITY_LEN 16 @@ -205,6 +203,12 @@ static struct wccp2_capability_info_header_t wccp2_capability_info_header; +/* Capability element header */ +struct wccp2_capability_element_header_t { + uint16_t capability_type; + uint16_t capability_length; +}; + /* Capability element */ struct wccp2_capability_element_t { uint16_t capability_type; @@ -599,7 +603,7 @@ wccp2_here_i_am_header.length += sizeof(wccp2_capability_info_header); assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); wccp2_capability_info_header.capability_info_type = htons(WCCP2_CAPABILITY_INFO); - wccp2_capability_info_header.capability_info_length = htons(2 * sizeof(wccp2_capability_element)); + wccp2_capability_info_header.capability_info_length = htons(3 * sizeof(wccp2_capability_element)); xmemcpy(ptr, &wccp2_capability_info_header, sizeof(wccp2_capability_info_header)); ptr += sizeof(wccp2_capability_info_header); @@ -612,6 +616,15 @@ xmemcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); ptr += sizeof(wccp2_capability_element); + /* Add the assignment method */ + wccp2_here_i_am_header.length += sizeof(wccp2_capability_element); + assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); + wccp2_capability_element.capability_type = htons(WCCP2_CAPABILITY_ASSIGNMENT_METHOD); + wccp2_capability_element.capability_length = htons(sizeof(wccp2_capability_element.capability_value)); + wccp2_capability_element.capability_value = htonl(WCCP2_ASSIGNMENT_METHOD_HASH); + xmemcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); + ptr += sizeof(wccp2_capability_element); + /* Add the return method */ wccp2_here_i_am_header.length += sizeof(wccp2_capability_element); assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); @@ -640,7 +653,7 @@ wccp2ConnectionOpen(void) { u_short port = WCCP_PORT; - struct sockaddr_in router, local; + struct sockaddr_in router, local, null; socklen_t local_len, router_len; struct wccp2_service_list_t *service_list_ptr; struct wccp2_router_list_t *router_list_ptr; @@ -651,7 +664,7 @@ return; } theWccp2Connection = comm_open(SOCK_DGRAM, - 0, + IPPROTO_UDP, Config.Wccp2.address, port, COMM_NONBLOCKING, @@ -668,7 +681,10 @@ debug(80, 1) ("Initialising all WCCPv2 lists\n"); + /* Initialise all routers on all services */ + memset(&null, 0, sizeof(null)); + null.sin_family = AF_UNSPEC; service_list_ptr = wccp2_service_list_head; while (service_list_ptr != NULL) { for (router_list_ptr = &service_list_ptr->router_list_head; router_list_ptr->next != NULL; router_list_ptr = router_list_ptr->next) { @@ -686,17 +702,14 @@ router_list_ptr->local_ip = local.sin_addr; - /* Disconnect the sending socket */ - router.sin_family = AF_UNSPEC; - if (connect(theWccp2Connection, (struct sockaddr *) &router, router_len)) - fatal("Unable to disconnect WCCP out socket"); + /* Disconnect the sending socket. Note: FreeBSD returns error + * but disconnects anyway so we have to just assume it worked + */ + if (wccp2_numrouters > 1) + connect(theWccp2Connection, (struct sockaddr *) &null, router_len); } service_list_ptr = service_list_ptr->next; } - if (wccp2_numrouters == 1) { - router.sin_family = AF_INET; - connect(theWccp2Connection, (struct sockaddr *) &router, sizeof(router)); - } wccp2_connected = 1; } @@ -781,7 +794,6 @@ uint32_t tmp; char *ptr; int num_caches; - uint16_t num_capabilities; debug(80, 6) ("wccp2HandleUdp: Called.\n"); @@ -854,7 +866,7 @@ return; } router_capability_header = (struct wccp2_capability_info_header_t *) &wccp2_i_see_you.data[offset]; - return; + break; default: debug(80, 1) ("Unknown record type in WCCPv2 Packet (%d).\n", ntohs(header->type)); @@ -908,37 +920,40 @@ /* Increment the received id in the packet */ if (ntohl(router_list_ptr->info->received_id) != ntohl(router_identity_info->router_id_element.received_id)) { - debug(80, 3) ("Incoming WCCP2_I_SEE_YOU member change = %d tmp=%d.\n", + debug(80, 3) ("Incoming WCCP2_I_SEE_YOU Received ID old=%d new=%d.\n", ntohl(router_list_ptr->info->received_id), ntohl(router_identity_info->router_id_element.received_id)); router_list_ptr->info->received_id = router_identity_info->router_id_element.received_id; } /* TODO: check return/forwarding methods */ if (router_capability_header == NULL) { - if ((Config.Wccp2.return_method != WCCP2_CAPABILITY_GRE) || (Config.Wccp2.forwarding_method != WCCP2_CAPABILITY_GRE)) { - debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router does not support the forwarding method specified\n"); + if ((Config.Wccp2.return_method != WCCP2_PACKET_RETURN_METHOD_GRE) || (Config.Wccp2.forwarding_method != WCCP2_FORWARDING_METHOD_GRE)) { + debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router does not support the forwarding method specified, only GRE supported\n"); wccp2ConnectionClose(); return; } } else { - num_capabilities = ntohs(router_capability_header->capability_info_length); - /* run through each capability element from last to first */ - if (num_capabilities > 0) { - num_capabilities--; - router_capability_element = (struct wccp2_capability_element_t *) (router_capability_header) + sizeof(struct wccp2_capability_info_header_t) + (num_capabilities * sizeof(struct wccp2_capability_element_t)); + char *end = ((char *) router_capability_header) + sizeof(*router_capability_header) + ntohs(router_capability_header->capability_info_length) - sizeof(struct wccp2_capability_info_header_t); + + router_capability_element = (struct wccp2_capability_element_t *) (((char *) router_capability_header) + sizeof(*router_capability_header)); + while ((char *) router_capability_element <= end) { switch (ntohs(router_capability_element->capability_type)) { case WCCP2_CAPABILITY_FORWARDING_METHOD: - if (ntohl(router_capability_element->capability_value) != Config.Wccp2.forwarding_method) { - debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router has specified a different forwarding method\n"); + if (!(ntohl(router_capability_element->capability_value) & Config.Wccp2.forwarding_method)) { + debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router has specified a different forwarding method %d, expected %d\n", ntohl(router_capability_element->capability_value), Config.Wccp2.forwarding_method); wccp2ConnectionClose(); return; } break; case WCCP2_CAPABILITY_ASSIGNMENT_METHOD: - /* we don't current care */ + if (!(ntohl(router_capability_element->capability_value) & WCCP2_ASSIGNMENT_METHOD_HASH)) { + debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router has specified a different assignment method %d, expected %d\n", ntohl(router_capability_element->capability_value), WCCP2_ASSIGNMENT_METHOD_HASH); + wccp2ConnectionClose(); + return; + } break; case WCCP2_CAPABILITY_RETURN_METHOD: - if (ntohl(router_capability_element->capability_value) != Config.Wccp2.return_method) { - debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router has specified a different return method\n"); + if (!(ntohl(router_capability_element->capability_value) & Config.Wccp2.return_method)) { + debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router has specified a different return method %d, expected %d\n", ntohl(router_capability_element->capability_value), Config.Wccp2.return_method); wccp2ConnectionClose(); return; } @@ -947,6 +962,7 @@ debug(80, 1) ("Unknown capability type in WCCPv2 Packet (%d).\n", ntohs(router_capability_element->capability_type)); } + router_capability_element = (struct wccp2_capability_element_t *) (((char *) router_capability_element) + sizeof(struct wccp2_capability_element_header_t) + ntohs(router_capability_element->capability_length)); } } @@ -1020,9 +1036,8 @@ if (ntohl(router_view_header->change_number) != router_list_ptr->member_change) { debug(80, 4) ("Change detected - queueing up new assignment\n"); router_list_ptr->member_change = ntohl(router_view_header->change_number); - if (!eventFind(wccp2AssignBuckets, NULL)) { - eventAdd("wccp2AssignBuckets", wccp2AssignBuckets, NULL, 15.0, 1); - } + eventDelete(wccp2AssignBuckets, NULL); + eventAdd("wccp2AssignBuckets", wccp2AssignBuckets, NULL, 15.0, 1); } } else { debug(80, 5) ("I am not the lowest ip cache - not assigning buckets\n"); @@ -1043,6 +1058,11 @@ debug(80, 1) ("wccp2HereIam: wccp2 socket closed. Shutting down WCCP2\n"); return; } + /* Wait 10 seconds if store dirs are rebuilding */ + if (store_dirs_rebuilding && Config.Wccp2.rebuildwait) { + eventAdd("wccp2HereIam", wccp2HereIam, NULL, 1.0, 1); + return; + } router_len = sizeof(router); memset(&router, '\0', router_len); router.sin_family = AF_INET; @@ -1063,18 +1083,24 @@ } debug(80, 3) ("Sending HereIam packet size %d\n", (int) service_list_ptr->wccp_packet_size); /* Send the packet */ - sendto(theWccp2Connection, - &service_list_ptr->wccp_packet, - service_list_ptr->wccp_packet_size, - 0, - (struct sockaddr *) &router, - router_len); + + if (wccp2_numrouters > 1) { + comm_udp_sendto(theWccp2Connection, + &router, + router_len, + &service_list_ptr->wccp_packet, + service_list_ptr->wccp_packet_size); + } else { + send(theWccp2Connection, + &service_list_ptr->wccp_packet, + service_list_ptr->wccp_packet_size, + 0); + } } service_list_ptr = service_list_ptr->next; } - if (!eventFind(wccp2HereIam, NULL)) - eventAdd("wccp2HereIam", wccp2HereIam, NULL, 10.0, 1); + eventAdd("wccp2HereIam", wccp2HereIam, NULL, 10.0, 1); } static void @@ -1219,12 +1245,18 @@ } if (ntohl(router_list_ptr->num_caches)) { /* send packet */ - sendto(theWccp2Connection, - &wccp_packet, - offset, - 0, - (struct sockaddr *) &router, - router_len); + if (wccp2_numrouters > 1) { + comm_udp_sendto(theWccp2Connection, + &router, + router_len, + &wccp_packet, + offset); + } else { + send(theWccp2Connection, + &wccp_packet, + offset, + 0); + } } } service_list_ptr = service_list_ptr->next; diff -ruN squid-2.6.STABLE1/tools/Makefile.am squid-2.6.STABLE2/tools/Makefile.am --- squid-2.6.STABLE1/tools/Makefile.am Tue May 23 15:52:30 2006 +++ squid-2.6.STABLE2/tools/Makefile.am Thu Jul 6 02:35:32 2006 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.1 2006/05/23 21:52:30 hno Exp $ +# $Id: Makefile.am,v 1.2 2006/07/06 08:35:32 adrian Exp $ # # Uncomment and customize the following to suit your needs: # @@ -17,12 +17,14 @@ SUBDIRS = bin_PROGRAMS = \ - squidclient + squidclient \ + cossdump libexec_PROGRAMS = \ cachemgr$(CGIEXT) squidclient_SOURCES = squidclient.c +cossdump_SOURCES = cossdump.c cachemgr__CGIEXT__SOURCES = cachemgr.c cachemgr__CGIEXT__CFLAGS = -DDEFAULT_CACHEMGR_CONFIG=\"$(DEFAULT_CACHEMGR_CONFIG)\" $(AM_CFLAGS) diff -ruN squid-2.6.STABLE1/tools/Makefile.in squid-2.6.STABLE2/tools/Makefile.in --- squid-2.6.STABLE1/tools/Makefile.in Mon Jun 12 00:10:12 2006 +++ squid-2.6.STABLE2/tools/Makefile.in Thu Jul 6 02:35:32 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.5 2006/06/12 06:10:12 hno Exp $ +# $Id: Makefile.in,v 1.6 2006/07/06 08:35:32 adrian Exp $ # # Uncomment and customize the following to suit your needs: # @@ -45,7 +45,7 @@ build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = -bin_PROGRAMS = squidclient$(EXEEXT) +bin_PROGRAMS = squidclient$(EXEEXT) cossdump$(EXEEXT) libexec_PROGRAMS = cachemgr$(CGIEXT)$(EXEEXT) subdir = tools DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in @@ -66,6 +66,10 @@ cachemgr__CGIEXT__LDADD = $(LDADD) am__DEPENDENCIES_1 = cachemgr__CGIEXT__DEPENDENCIES = $(am__DEPENDENCIES_1) +am_cossdump_OBJECTS = cossdump.$(OBJEXT) +cossdump_OBJECTS = $(am_cossdump_OBJECTS) +cossdump_LDADD = $(LDADD) +cossdump_DEPENDENCIES = $(am__DEPENDENCIES_1) am_squidclient_OBJECTS = squidclient.$(OBJEXT) squidclient_OBJECTS = $(am_squidclient_OBJECTS) squidclient_LDADD = $(LDADD) @@ -77,8 +81,10 @@ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(cachemgr__CGIEXT__SOURCES) $(squidclient_SOURCES) -DIST_SOURCES = $(cachemgr__CGIEXT__SOURCES) $(squidclient_SOURCES) +SOURCES = $(cachemgr__CGIEXT__SOURCES) $(cossdump_SOURCES) \ + $(squidclient_SOURCES) +DIST_SOURCES = $(cachemgr__CGIEXT__SOURCES) $(cossdump_SOURCES) \ + $(squidclient_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ @@ -263,6 +269,7 @@ TESTS = $(check_PROGRAMS) SUBDIRS = squidclient_SOURCES = squidclient.c +cossdump_SOURCES = cossdump.c cachemgr__CGIEXT__SOURCES = cachemgr.c cachemgr__CGIEXT__CFLAGS = -DDEFAULT_CACHEMGR_CONFIG=\"$(DEFAULT_CACHEMGR_CONFIG)\" $(AM_CFLAGS) LDADD = -L../lib -lmiscutil $(XTRA_LIBS) @@ -362,6 +369,9 @@ cachemgr$(CGIEXT)$(EXEEXT): $(cachemgr__CGIEXT__OBJECTS) $(cachemgr__CGIEXT__DEPENDENCIES) @rm -f cachemgr$(CGIEXT)$(EXEEXT) $(LINK) $(cachemgr__CGIEXT__LDFLAGS) $(cachemgr__CGIEXT__OBJECTS) $(cachemgr__CGIEXT__LDADD) $(LIBS) +cossdump$(EXEEXT): $(cossdump_OBJECTS) $(cossdump_DEPENDENCIES) + @rm -f cossdump$(EXEEXT) + $(LINK) $(cossdump_LDFLAGS) $(cossdump_OBJECTS) $(cossdump_LDADD) $(LIBS) squidclient$(EXEEXT): $(squidclient_OBJECTS) $(squidclient_DEPENDENCIES) @rm -f squidclient$(EXEEXT) $(LINK) $(squidclient_LDFLAGS) $(squidclient_OBJECTS) $(squidclient_LDADD) $(LIBS) @@ -373,6 +383,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cachemgr__CGIEXT_-cachemgr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cossdump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/squidclient.Po@am__quote@ .c.o: diff -ruN squid-2.6.STABLE1/tools/cossdump.c squid-2.6.STABLE2/tools/cossdump.c --- squid-2.6.STABLE1/tools/cossdump.c Wed Dec 31 17:00:00 1969 +++ squid-2.6.STABLE2/tools/cossdump.c Sat Jul 8 05:04:46 2006 @@ -0,0 +1,218 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "../src/defines.h" +#include "../src/enums.h" + +struct _tlv; +typedef struct _tlv tlv; + +struct _tlv { + char type; + int length; + void *value; + tlv *next; +}; + +#undef debug +#define debug(a, b) printf + +#define MEM_TLV sizeof(tlv) +#define memAllocate(a) malloc(a) +#define memFree(a, b) free(a) +#define xmemcpy(a, b, c) memcpy(a, b, c) +#define xmalloc(a) malloc(a) +#define xfree(a) free(a) + +#if SIZEOF_INT64_T > SIZEOF_LONG && HAVE_STRTOLL +typedef int64_t squid_off_t; +#define SIZEOF_SQUID_OFF_T SIZEOF_INT64_T +#define PRINTF_OFF_T PRId64 +#define strto_off_t (int64_t)strtoll +#else +typedef long squid_off_t; +#define SIZEOF_SQUID_OFF_T SIZEOF_LONG +#define PRINTF_OFF_T "ld" +#define strto_off_t strtol +#endif + +static tlv ** +storeSwapTLVAdd(int type, const void *ptr, size_t len, tlv ** tail) +{ + tlv *t = memAllocate(MEM_TLV); + t->type = (char) type; + t->length = (int) len; + t->value = xmalloc(len); + xmemcpy(t->value, ptr, len); + *tail = t; + return &t->next; /* return new tail pointer */ +} + +#if UNUSED_CODE +static void +storeSwapTLVFree(tlv * n) +{ + tlv *t; + while ((t = n) != NULL) { + n = t->next; + xfree(t->value); + memFree(t, MEM_TLV); + } +} +#endif + +#if UNUSED_CODE +static char * +storeSwapMetaPack(tlv * tlv_list, int *length) +{ + int buflen = 0; + tlv *t; + int j = 0; + char *buf; + assert(length != NULL); + buflen++; /* STORE_META_OK */ + buflen += sizeof(int); /* size of header to follow */ + for (t = tlv_list; t; t = t->next) + buflen += sizeof(char) + sizeof(int) + t->length; + buflen++; /* STORE_META_END */ + buf = xmalloc(buflen); + buf[j++] = (char) STORE_META_OK; + xmemcpy(&buf[j], &buflen, sizeof(int)); + j += sizeof(int); + for (t = tlv_list; t; t = t->next) { + buf[j++] = (char) t->type; + xmemcpy(&buf[j], &t->length, sizeof(int)); + j += sizeof(int); + xmemcpy(&buf[j], t->value, t->length); + j += t->length; + } + buf[j++] = (char) STORE_META_END; + assert((int) j == buflen); + *length = buflen; + return buf; +} +#endif + +static tlv * +storeSwapMetaUnpack(const char *buf, int *hdr_len) +{ + tlv *TLV; /* we'll return this */ + tlv **T = &TLV; + char type; + int length; + int buflen; + int j = 0; + assert(buf != NULL); + assert(hdr_len != NULL); + if (buf[j++] != (char) STORE_META_OK) + return NULL; + xmemcpy(&buflen, &buf[j], sizeof(int)); + j += sizeof(int); + /* + * sanity check on 'buflen' value. It should be at least big + * enough to hold one type and one length. + */ + if (buflen <= (sizeof(char) + sizeof(int))) + return NULL; + while (buflen - j > (sizeof(char) + sizeof(int))) { + type = buf[j++]; + /* VOID is reserved, but allow some slack for new types.. */ + if (type <= STORE_META_VOID || type > STORE_META_END + 10) { + debug(20, 0) ("storeSwapMetaUnpack: bad type (%d)!\n", type); + break; + } + xmemcpy(&length, &buf[j], sizeof(int)); + if (length < 0 || length > (1 << 16)) { + debug(20, 0) ("storeSwapMetaUnpack: insane length (%d)!\n", length); + break; + } + j += sizeof(int); + if (j + length > buflen) { + debug(20, 0) ("storeSwapMetaUnpack: overflow!\n"); + debug(20, 0) ("\ttype=%d, length=%d, buflen=%d, offset=%d\n", + type, length, buflen, (int) j); + break; + } + T = storeSwapTLVAdd(type, &buf[j], (size_t) length, T); + j += length; + } + *hdr_len = buflen; + return TLV; +} + + +#define STRIPESIZE 1048576 +#define BLOCKSIZE 1024 +#define BLKBITS 10 + +static void +parse_stripe(int stripeid, char *buf, int len) +{ + int j = 0; + int bl = 0; + tlv *t, *tlv_list; + int64_t *l; + int tmp; + + while (j < len) { + l = NULL; + bl = 0; + tlv_list = storeSwapMetaUnpack(&buf[j], &bl); + if (tlv_list == NULL) { + printf(" Object: NULL\n"); + return; + } + printf(" Object: (filen %d) hdr size %d\n", j / BLOCKSIZE + (stripeid * STRIPESIZE / BLOCKSIZE), bl); + for (t = tlv_list; t; t = t->next) { + switch(t->type) { + case STORE_META_URL: + /* XXX Is this OK? Is the URL guaranteed to be \0 terminated? */ + printf(" URL: %s\n", (char *)t->value); + break; + case STORE_META_OBJSIZE: + l = t->value; + printf("Size: %" PRINTF_OFF_T " (len %d)\n", *l, t->length); + break; + } + } + if (l == NULL) { + printf(" STRIPE: Completed, got an object with no size\n"); + return; + } + j = j + *l + bl; + /* And now, the blocksize! */ + tmp = j / BLOCKSIZE; + tmp = (tmp+1) * BLOCKSIZE; + j = tmp; + } +} + +int +main(int argc, char *argv[]) +{ + int fd; + char buf[STRIPESIZE]; + int i = 0, len; + + if (argc < 2) { + printf("Usage: %s \n", argv[0]); + exit(1); + } + + fd = open(argv[1], O_RDONLY); + if (fd < 0) { + perror("open"); + exit(1); + } + while ((len = read(fd, buf, STRIPESIZE)) > 0) { + printf("STRIPE: %d (len %d)\n", i, len); + parse_stripe(i, buf, len); + i++; + } + return 0; +}