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 # ===========================================================================
2 # crosstool-NG configuration targets
3 # These targets are used from top-level makefile
5 # Derive the project version from, well, the project version:
6 export PROJECTVERSION=$(CT_VERSION)
8 KCONFIG_TOP = config/config.in
9 obj = $(CT_TOP_DIR)/kconfig
10 PHONY += clean help oldconfig menuconfig config defoldconfig extractconfig
12 # Darwin (MacOS-X) does not have proper libintl support
13 ifeq ($(shell uname -s),Darwin)
17 ifneq ($(KBUILD_NO_NLS),)
18 CFLAGS += -DKBUILD_NO_NLS
21 # Build a list of all config files
22 DEBUG_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/debug -type f -name '*.in')
23 TOOLS_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/tools -type f -name '*.in')
25 STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
26 GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/debug.in \
27 $(CT_TOP_DIR)/config.gen/tools.in
29 CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
31 $(GEN_CONFIG_FILES):: $(CT_TOP_DIR)/config.gen
33 $(CT_TOP_DIR)/config.gen:
34 @mkdir -p $(CT_TOP_DIR)/config.gen
36 $(CT_TOP_DIR)/config.gen/debug.in:: $(DEBUG_CONFIG_FILES)
37 @echo "# Debug facilities menu" >$@
38 @echo "# Generated file, do not edit!!!" >>$@
39 @echo "menu \"Debug facilities\"" >>$@
40 @for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/debug/*.in)); do \
41 echo "source $${f}"; \
45 $(CT_TOP_DIR)/config.gen/tools.in:: $(TOOLS_CONFIG_FILES)
46 @echo "# Tools facilities menu" >$@
47 @echo "# Generated file, do not edit!!!" >>$@
48 @echo "menu \"Tools facilities\"" >>$@
49 @for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/tools/*.in)); do \
50 echo "source $${f}"; \
54 config menuconfig oldconfig defoldconfig extractconfig:: $(KCONFIG_TOP)
57 @ln -sf $(CT_LIB_DIR)/config config
59 menuconfig:: $(obj)/mconf $(CONFIG_FILES)
62 config:: $(obj)/conf $(CONFIG_FILES)
65 oldconfig:: $(obj)/conf $(CONFIG_FILES)
68 defoldconfig:: $(obj)/conf $(CONFIG_FILES)
69 @yes "" |$< -s $(KCONFIG_TOP) >/dev/null
71 extractconfig:: $(obj)/conf $(CONFIG_FILES)
72 @$(CT_LIB_DIR)/tools/extract-config.sh >.config
75 # Help text used by make help
77 @echo ' config - Update current config using a line-oriented program'
78 @echo ' menuconfig - Update current config using a menu based program'
79 @echo ' oldconfig - Update current config using a provided .config as base'
80 @echo ' extractconfig - Create a new config using options extracted from a'
81 @echo ' build log piped into stdin'
85 SHIPPED := $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
88 @ln -s $(notdir $<) $@
90 $(obj)/conf $(obj)/mconf:: $(obj)
95 $(obj)/mconf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c
96 @$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
97 $(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ccflags) \
98 $(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ldflags $(HOST_CC))
100 $(obj)/conf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c
101 @$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
104 @rm -f $(CT_TOP_DIR)/kconfig/{,m}conf
106 @rmdir --ignore-fail-on-non-empty $(CT_TOP_DIR)/kconfig 2>/dev/null || true
107 @rm -f $(CT_TOP_DIR)/config 2>/dev/null || true
108 @rm -rf $(CT_TOP_DIR)/config.gen