mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-02-20 17:12:55 +00:00
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(-)
This commit is contained in:
parent
6e611c2e75
commit
08f2c57f96
@ -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}";
|
||||
|
Loading…
x
Reference in New Issue
Block a user