Configure tsocks with a simple heuristic.
Consider the proxy has to be in a 'local' network. It means it is directly
reachable by the local machine, even if the local machine has to hop through
one or more gates to reach the proxy (often the case in enterprise networks
where class A 10.0.0.0/8 is in fact sub-divided into smaller networks, each
one of them in a different location, eg. 10.1.0.0/16 in a place, while
10.2.0.0/16 would be on the other side of the world). Not being in the same
subnet does not mean the proxy is not available.
So we will build a mask with at most high bits set, which defines a network
that has both the local machine and the proxy. Because a machine may have
more than one interface, build a mask for each of them, removing 127.0.0.1
which is added automagically by tsocks, and removing duplicate masks.
If all of this does not work, then it means the local machine can NOT in fact
reach the proxy, which in turn means the user mis-configured something (most
probably a typo...).
/trunk/scripts/crosstool.sh | 61 52 9 0 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 9 deletions(-)
1 # This will build and install sstrip to run on host and sstrip target files
3 is_enabled="${CT_SSTRIP}"
5 case "${CT_SSTRIP_FROM}" in
8 echo "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
10 do_tools_sstrip_get() {
11 CT_GetFile "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}" \
12 http://www.muppetlabs.com/~breadbox/pub/software
14 do_tools_sstrip_extract() {
15 CT_ExtractAndPatch "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
17 do_tools_sstrip_build() {
18 CT_DoStep INFO "Installing sstrip"
19 mkdir -p "${CT_BUILD_DIR}/build-strip"
20 cd "${CT_BUILD_DIR}/build-strip"
21 ( cd "${CT_SRC_DIR}/ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}/sstrip"; tar cf - . ) |tar xf -
23 CT_DoLog EXTRA "Building sstrip"
24 make CC="${CT_CC_NATIVE}" sstrip 2>&1 |CT_DoLog ALL
26 CT_DoLog EXTRA "Installing sstrip"
27 install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
34 sstrip_url='http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/sstrip/sstrip.c'
38 do_tools_sstrip_get() {
39 # With this one, we must handle the download by ourselves,
40 # we can't leave the job to the classic CT_GetFile.
41 if [ -f "${CT_TARBALLS_DIR}/sstrip.c" ]; then
44 if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then
45 CT_DoLog EXTRA "Using \"sstrip\" from local storage"
46 ln -sf "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" \
47 "${CT_TARBALLS_DIR}/sstrip.c" 2>&1 |CT_DoLog ALL
50 CT_Pushd "${CT_TARBALLS_DIR}"
51 CT_DoLog EXTRA "Retrieving \"sstrip\" from network"
52 http_data=`lynx -dump "${sstrip_url}"`
53 link=`echo -en "${http_data}" \
54 |egrep '\[[[:digit:]]+\]download' \
55 |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;'`
56 rev_url=`echo -en "${http_data}" \
58 |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;'`
59 CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
60 mv -v sstrip.c?* sstrip.c 2>&1 |CT_DoLog DEBUG
61 if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
62 CT_DoLog EXTRA "Saving \"sstrip.c\" to local storage"
63 cp -v sstrip.c "${CT_LOCAL_TARBALLS_DIR}" 2>&1 |CT_DoLog DEBUG
67 do_tools_sstrip_extract() {
68 # We'll let buildroot guys take care of sstrip maintenance and patching.
69 mkdir -p "${CT_SRC_DIR}/sstrip"
70 cp -v "${CT_TARBALLS_DIR}/sstrip.c" "${CT_SRC_DIR}/sstrip" |CT_DoLog ALL
72 do_tools_sstrip_build() {
73 CT_DoStep INFO "Installing sstrip"
74 mkdir -p "${CT_BUILD_DIR}/build-sstrip"
75 cd "${CT_BUILD_DIR}/build-sstrip"
77 CT_DoLog EXTRA "Building sstrip"
78 ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c" 2>&1 |CT_DoLog ALL
80 CT_DoLog EXTRA "Installing sstrip"
81 install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
87 *) do_print_filename() {
90 do_tools_sstrip_get() {
93 do_tools_sstrip_extract() {
96 do_tools_sstrip_build() {