Hi
Not sure if anyone else is interested but I've managed to get
dansguardian and privoxy working on my android 2.2 netbook (toshiba
ac100).
Instructions below. Seems to work pretty well out of box just need to
patch dansguardian to get around a bug in memccpy in the android ndk
for 2.2 (which seems to have been fixed in more recent versions of
android)
You need a rooted device to be able to do this. This is obviously easy
to get around unless I can work out some way of making the Wifi proxy
settings secure.
Be interested if anyone else can get it working on some other device
<<
Download and install NDK from
http://developer.android.com/sdk/ndk/index.html
**Create toolchain
cd to where NDK in installed and run
./build/tools/make-standalone-toolchain.sh --platform=android-8 --
install-dir=android-8-toolchain
Add #NDK_PATH#/android-8-toolchain/bin to your PATH
cd ..
mkdir projects/external
cd projects/external
**Build privoxy
wget
http://sourceforge.net/projects/ijbswa/files/Sources/3.0.12%20%28stable%29/privoxy-3.0.12-stable-src.tar.gz
tar xzvf privoxy-3.0.12-stable-src.tar.gz
cd privoxy-3.0.12-stable
autoheader
autoconf
edit configure and comment out
#PTHREAD_LIB=-lpthread
./configure CC=arm-linux-androideabi-gcc LD=arm-linux-androideabi-ld
ac_cv_func_setpgrp_void=yes --host=arm-linux
make
upload privoxy and config to your android device
**Build dg
cd projects/external
wget
http://dansguardian.org/downloads/2/Stable/dansguardian-2.10.1.1.tar.gz
tar zxvf dansguardian-2.10.1.1.tar.gz
cd dansguardian-2.10.1.1
autoheader
autoconf
download patch file as dg_2.10.1.1_android_2.2.patch
cd src
patch -p0 < ../dg_2.10.1.1_android_2.2.patch
cd ..
# change the /data/scott paths to one of yuor liking
./configure CXX=arm-linux-androideabi-g++ CC=arm-linux-androideabi-gcc
LD=arm-linux-androideabi-ld --enable-pcre=no --enable-clamav=no --
host=arm-linux-androideabi --target=arm-linux-androideabi --with-
proxyuser=root --with-proxygroup=root --with-piddir=/data/scott/log --
with-logdir=/data/scott/log --with-sysconfsubdir=dansguardian --
prefix=
make
upload src/dansguardian binary and the configs folder (I grabbed the
config folder for dansguardian from my ubuntu PC as I have made quite
a few mods to it) to your device
You will either need to change privoxy to use port 3128 or
dansguardian to use proxy port 8118
Once you have both privoxy and dansguardian starting ok on your device
you'll need to goto to your
WIFI settings (not sure how this would work if you have 3G) and set
your proxy to localhost 8080
Check your browser works OK via DG, and some sort of naughty link is
blocked
I've also hacked an existing startup sh script called from init.rc to
get privoxy and dansguardian started on boot up of the device
>>
The dansguardian patch I required is here
<<
--- BaseSocket.cpp.orig 2011-05-01 15:10:03.443974107 +1000
+++ BaseSocket.cpp 2011-05-01 13:04:12.186906265 +1000
@@ -58,6 +58,26 @@
// IMPLEMENTATION
+/* needed because android8 NDK has a bug in memccpy
+*
https://www.codeaurora.org/gitweb/quic/la/?p=platform/bionic.git;a=commitdiff;h=e44cb1a35c4bf3f30e2b9e3961c57b7ca6fa7849
+*/
+void *d_memccpy(void *dst, const void *src, int c, size_t n)
+{
+ char* q = (char*)dst;
+ const char* p = (const char*)src;
+ const char* p_end = p + n;
+ char ch = ~(char)c; /* ensure ch != c */
+
+ for (;;) {
+ if (ch == c || p >= p_end) break;
+ *q++ = ch = *p++;
+ }
+
+ if (p >= p_end && ch != c)
+ return NULL;
+
+ return q;
+}
// a wrapper for select so that it auto-restarts after an EINTR.
// can be instructed to watch out for signal triggered config
reloads.
@@ -281,7 +301,7 @@
int tocopy = size;
if ((bufflen - buffstart) < size)
tocopy = bufflen - buffstart;
- char* result = (char*)memccpy(buff, buffer + buffstart, '\n',
tocopy);
+ char* result = (char*)d_memccpy(buff, buffer + buffstart, '\n',
tocopy);
if (result != NULL) {
// indicate that a newline was chopped off, if desired
if (chopped)
@@ -319,7 +339,7 @@
int tocopy = bufflen;
if ((i + bufflen) > (size-1))
tocopy = (size-1) - i;
- char* result = (char*)memccpy(buff+i, buffer, '\n', tocopy);
+ char* result = (char*)d_memccpy(buff+i, buffer, '\n', tocopy);
if (result != NULL) {
// indicate that a newline was chopped off, if desired
if (chopped)
>>