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 # Makefile.in for building crosstool-NG
2 # This file serves as source for the ./configure operation
6 # Check if Makefile is up to date:
8 @echo "$< did changed: you must re-run './configure'"
11 ###############################################################################
12 # Configuration variables
21 MAKE := $(shell which $(MAKE) || type -p $(MAKE) || echo /usr/bin/make)
23 ###############################################################################
26 build: build-bin build-lib build-man
28 install: install-local-test build install-bin install-lib install-doc install-man
30 clean: clean-bin clean-lib clean-doc
36 uninstall: install-local-test uninstall-bin uninstall-lib uninstall-doc uninstall-man
38 ###############################################################################
41 #--------------------------------------
50 build-man: docs/ct-ng.1.gz
52 docs/ct-ng.1.gz: docs/ct-ng.1
58 @sed -r -e 's,@@CT_MAKE@@,$(MAKE),g;' \
59 -e 's,@@CT_BINDIR@@,$(BINDIR),g;' \
60 -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;' \
61 -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;' \
62 -e 's,@@CT_MANDIR@@,$(MANDIR),g;' \
63 -e 's,@@CT_VERSION@@,$(VERSION),g;' \
64 -e 's,@@CT_DATE@@,$(DATE),g;' \
67 #--------------------------------------
77 @echo " RM docs/ct-ng.1"
79 @echo " RM docs/ct-ng.1.gz"
80 @rm -f docs/ct-ng.1.gz
82 #--------------------------------------
85 # If using locally, don't install
87 @if [ "$(LOCAL)" = "1" ]; then \
88 echo "You're using local copy as runtime. You can't (un)install."; \
92 install-bin: install-local-test $(BINDIR)
94 @install -m 755 ct-ng $(BINDIR)/ct-ng
96 install-lib: install-local-test $(LIBDIR) install-lib-main install-lib-samples
98 install-lib-main: install-local-test $(LIBDIR)
99 @for src_dir in arch config kconfig patches scripts tools; do \
100 echo " INST $${src_dir}/"; \
101 tar cf - --exclude=.svn $${src_dir} |(cd $(LIBDIR); tar xf -); \
103 @rm -f $(LIBDIR)/tools/addToolVersion.sh
104 @echo " INST steps.mk"
105 @install -m 644 steps.mk $(LIBDIR)/steps.mk
106 @echo " INST .version"
107 @echo "$(VERSION)" >$(LIBDIR)/.version
109 # Samples need a little love:
110 # - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
111 install-lib-samples: install-local-test $(LIBDIR) install-lib-main
112 @echo " INST samples/"
113 @tar cf - --exclude=.svn samples |(cd $(LIBDIR); tar xf -)
114 @for samp_file in $(LIBDIR)/samples/*/crosstool.config; do \
115 sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \
118 install-doc: install-local-test $(DOCDIR)
119 @for doc_file in docs/CREDITS docs/overview.txt; do \
120 echo " INST $${doc_file}"; \
121 install -m 644 "$${doc_file}" $(DOCDIR); \
124 install-man: install-local-test $(MANDIR)
125 @echo " INST ct-ng.1.gz"
126 @install -m 644 docs/ct-ng.1.gz $(MANDIR)
128 $(BINDIR) $(LIBDIR) $(DOCDIR) $(MANDIR)::
130 @install -m 755 -d $@
133 #--------------------------------------
136 uninstall-bin: install-local-test
137 @rm -f $(BINDIR)/ct-ng
139 uninstall-lib: install-local-test
142 uninstall-doc: install-local-test
145 uninstall-man: install-local-test
146 @rm -f $(MANDIR)/ct-ng.1{,.gz}