Tss.... I was bieng real stupid while building up the tsocks.conf file. Implement a much simpler way.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Apr 20 18:04:20 2008 +0000 (2008-04-20)
changeset 4532969b1d3884a
parent 452 15fdb2eb2db3
child 454 372b2f397baa
Tss.... I was bieng real stupid while building up the tsocks.conf file. Implement a much simpler way.

/trunk/scripts/crosstool.sh | 27 5 22 0 +++++----------------------
1 file changed, 5 insertions(+), 22 deletions(-)
scripts/crosstool.sh
     1.1 --- a/scripts/crosstool.sh	Sun Apr 20 16:46:17 2008 +0000
     1.2 +++ b/scripts/crosstool.sh	Sun Apr 20 18:04:20 2008 +0000
     1.3 @@ -233,28 +233,11 @@
     1.4      # Remove any lingering config file from any previous run
     1.5      rm -f "${CT_BUILD_DIR}/tsocks.conf"
     1.6      # Find all interfaces and build locally accessible networks
     1.7 -    /sbin/ifconfig |gawk '
     1.8 -      $0 ~ /inet addr:/ {
     1.9 -        split( $2, ip, ":|\\." );
    1.10 -        ip_num = ip[2]*2^24 + ip[3]*2^16 + ip[4]*2^8 + ip[5]*2^0;
    1.11 -        # Skip 127.0.0.1
    1.12 -        if( ip_num == 2130706433 ) {
    1.13 -          next;
    1.14 -        }
    1.15 -        split( $(NF), mask, ":|\\." );
    1.16 -        mask_num = mask[2]*2^24 + mask[3]*2^16 + mask[4]*2^8 + mask[5]*2^0;
    1.17 -        ip_num = and( ip_num, mask_num );
    1.18 -        printf( "local = %d.%d.%d.%d/%d.%d.%d.%d\n",
    1.19 -                and( 0xFF, rshift( ip_num,   24 ) ),
    1.20 -                and( 0xFF, rshift( ip_num,   16 ) ),
    1.21 -                and( 0xFF, rshift( ip_num,    8 ) ),
    1.22 -                and( 0xFF, rshift( ip_num,    0 ) ),
    1.23 -                and( 0xFF, rshift( mask_num, 24 ) ),
    1.24 -                and( 0xFF, rshift( mask_num, 16 ) ),
    1.25 -                and( 0xFF, rshift( mask_num,  8 ) ),
    1.26 -                and( 0xFF, rshift( mask_num,  0 ) ) );
    1.27 -      }
    1.28 -    ' >"${CT_BUILD_DIR}/tsocks.conf"
    1.29 +    /sbin/ifconfig |egrep 'inet addr' |while read inet addr bcast mask; do
    1.30 +      ip="${addr/*:}"
    1.31 +      mask="${mask/*:}"
    1.32 +      [ -n "${mask}" -a "${ip}" != "127.0.0.1" ] && echo "local = ${ip}/${mask}"
    1.33 +    done >"${CT_BUILD_DIR}/tsocks.conf"
    1.34      ( echo "server = ${CT_PROXY_HOST}";
    1.35        echo "server_port = ${CT_PROXY_PORT}";
    1.36        [ -n "${CT_PROXY_USER}"   ] && echo "default_user=${CT_PROXY_USER}";