[squid-users] Help with "Follow X-Forwarded-For headers patch"

From: Campbell, Shawn <scampbell@dont-contact.us>
Date: Wed, 8 Oct 2003 12:56:26 -0400

I am currently using squid 2.5 stable4 with the following configuration
options:

./configure --prefix=/var/squid --exec-prefix=/var/squid
--enable-linux-netfilter --enable-poll --enable-dlmalloc
--enable-underscores --enable-wccpv2 --enable-delay-pools
--enable-removal-policies --enable-gnuregex --enable-snmp
--enable-truncate --disable-ident-lookups

I am using the wccpv2 patch.

http://squid.visolve.com/developments/wccpv2_install.htm
http://squid.visolve.com/developments/wccpv2.htm

I am also trying to use the Follow X-Forwarded-For header patch that is
maintained by Alan Barret.

http://devel.squid-cache.org/follow_xff/
http://devel.squid-cache.org/follow_xff/follow_xff-2.5.patch

Follow X-Forwarded-For headers
                               Goal:
When a request passes through a
chain of one or more other proxies
before reaching Squid, we sometimes
want to examine the X-Forwarded-For
headers to find the IP address of
the original (or indirect) client,
and use the indirect client address
in access controls, delay pools and
logs.
                             Status:
Finished converting my previous set
of private patches (based on
squid-2.4) to work in squid-3.
Proceeding to test them a little
more. Further enhancements might
follow later.

I had trouble applying Alan's patch for squid 2.5 and I thought the
reason might be related to the wccpv2 patch. So I applied Alan's patch
to a clean, unpatched squid. I used the following command to patch
squid (I am in the squid source directory).

patch -p0 < ../follow_xff-2.5.patch

The command produced the following results:

patching file configure.in
Hunk #1 succeeded at 1100 (offset 6 lines).
patching file src/acl.c
Hunk #1 succeeded at 2001 (offset 20 lines).
patching file src/cf.data.pre
Hunk #1 succeeded at 2057 (offset 44 lines).
patching file src/client_side.c
Hunk #2 succeeded at 182 (offset 1 line).
Hunk #3 succeeded at 499 (offset 3 lines).
Hunk #4 succeeded at 3228 (offset 45 lines).
patching file src/delay_pools.c
patching file src/structs.h
Hunk #1 succeeded at 592 (offset 1 line).
Hunk #2 succeeded at 618 (offset 1 line).
Hunk #3 succeeded at 1084 (offset -1 lines).
Hunk #4 succeeded at 1664 (offset -1 lines).
Hunk #5 succeeded at 1677 (offset -1 lines).

It looks like patch had to use alot of offsets which may explain my
problem further down.

Alan's directions say to apply the patch and then run bootstrap.sh to
generate a new configure.in file. When I run bootstrap.sh, I get the
following output:

configure.in:1264: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1365: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1366: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1367: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1368: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1369: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1370: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1371: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1372: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1373: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1374: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1752: warning: AC_TRY_RUN called without default to allow
cross compiling
/usr/bin/autoheader2.13: Symbol `FOLLOW_X_FORWARDED_FOR' is not covered
by /usr/share/autoconf2.13/acconfig.h ./acconfig.h
autoheader failed
Autotool bootstrapping failed. You will need to investigate and correct
before you can develop on this source tree

I tried altering ./acconfig.h to address the symbol issue as follows:

#undef FOLLOW_X_FORWARDED_FOR

I tried running bootstrap.sh again with the following results:

configure.in:1264: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1365: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1366: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1367: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1368: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1369: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1370: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1371: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1372: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1373: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1374: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1752: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1264: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1360: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1361: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1362: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1363: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1364: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1365: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1366: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1367: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1368: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1369: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1370: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1371: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1372: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1373: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1374: warning: AC_TRY_RUN called without default to allow
cross compiling
configure.in:1752: warning: AC_TRY_RUN called without default to allow
cross compiling
Autotool bootstrapping complete.

A configure.in was successfully generated after that change. When I try
to run ./configure with the same options I listed above, everything
looks ok.

I run into problems when I run make:

source='ufs/store_dir_ufs.c' object='ufs/store_dir_ufs.o' libtool=no \
depfile='.deps/ufs/store_dir_ufs.Po'
tmpdepfile='.deps/ufs/store_dir_ufs.TPo' \
depmode=gcc /bin/sh ../../cfgaux/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I. -I../../include
-I../../include -I../../src/ -g -O2 -Wall -c -o ufs/store_dir_ufs.o
`test -f ufs/store_dir_ufs.c || echo './'`ufs/store_dir_ufs.c
In file included from ../../src/squid.h:409,
                 from ufs/store_dir_ufs.c:36:
../../src/structs.h:1092: warning: unnamed struct/union that defines no
instances
../../src/structs.h:1100: parse error before `}'
../../src/structs.h:2198: warning: This file contains more `}'s than
`{'s.
In file included from ufs/store_dir_ufs.c:36:
../../src/squid.h:481: warning: This file contains more `}'s than `{'s.
make[4]: *** [ufs/store_dir_ufs.o] Error 1
make[4]: Leaving directory `/usr/src/squid-2.5.STABLE4/src/fs'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/src/squid-2.5.STABLE4/src/fs'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/src/squid-2.5.STABLE4/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/squid-2.5.STABLE4/src'
make: *** [all-recursive] Error 1

It appears that the patch offsets I mentioned above did not alter some
of the files correctly.

I don't know if Alan Barret or anyone else that maintains the Follow
X-Forwarded-For headers patch reads the list, but I thought I would post
to see if anyone had any ideas. Does anyone know how to contact Alan or
any other maintainer?

Has anyone else tried using Alan's patch? Any ideas on what I could do
to address the problem?

Any assistance would be greatly appreciated.

Thanks.

Shawn
Received on Wed Oct 08 2003 - 10:56:38 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:20:26 MST