From 08f2c57f96d425396af7dc21bf5ef7b2d82973ca Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sun, 20 Apr 2008 18:04:20 +0000 Subject: 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(-) diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh index ae67457..b5f1373 100755 --- a/scripts/crosstool.sh +++ b/scripts/crosstool.sh @@ -233,28 +233,11 @@ case "${CT_PROXY_TYPE}" in # Remove any lingering config file from any previous run rm -f "${CT_BUILD_DIR}/tsocks.conf" # Find all interfaces and build locally accessible networks - /sbin/ifconfig |gawk ' - $0 ~ /inet addr:/ { - split( $2, ip, ":|\\." ); - ip_num = ip[2]*2^24 + ip[3]*2^16 + ip[4]*2^8 + ip[5]*2^0; - # Skip 127.0.0.1 - if( ip_num == 2130706433 ) { - next; - } - split( $(NF), mask, ":|\\." ); - mask_num = mask[2]*2^24 + mask[3]*2^16 + mask[4]*2^8 + mask[5]*2^0; - ip_num = and( ip_num, mask_num ); - printf( "local = %d.%d.%d.%d/%d.%d.%d.%d\n", - and( 0xFF, rshift( ip_num, 24 ) ), - and( 0xFF, rshift( ip_num, 16 ) ), - and( 0xFF, rshift( ip_num, 8 ) ), - and( 0xFF, rshift( ip_num, 0 ) ), - and( 0xFF, rshift( mask_num, 24 ) ), - and( 0xFF, rshift( mask_num, 16 ) ), - and( 0xFF, rshift( mask_num, 8 ) ), - and( 0xFF, rshift( mask_num, 0 ) ) ); - } - ' >"${CT_BUILD_DIR}/tsocks.conf" + /sbin/ifconfig |egrep 'inet addr' |while read inet addr bcast mask; do + ip="${addr/*:}" + mask="${mask/*:}" + [ -n "${mask}" -a "${ip}" != "127.0.0.1" ] && echo "local = ${ip}/${mask}" + done >"${CT_BUILD_DIR}/tsocks.conf" ( echo "server = ${CT_PROXY_HOST}"; echo "server_port = ${CT_PROXY_PORT}"; [ -n "${CT_PROXY_USER}" ] && echo "default_user=${CT_PROXY_USER}"; -- cgit v0.10.2-6-g49f6