Skip to contentSkip to conversation

Fixes for oe-git-proxy

PATCH New Peter Kjellerstedt 1 participant 4 messages Sep 18, 2015

lore
Share & tools
lore
#0 lore raw

cover Fixes for oe-git-proxy

This fixes a couple of problems with the oe-git-proxy script. See the respective commits for more information.

//Peter

The following changes since commit 3a5e46b6ed483e43251da7e328b9299189997722:

bitbake: bb.fetch2.{git, hg}: remove tarball if it needs updating (2015-09-18 09:05:36 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib pkj/oe-git-proxy
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/oe-git-proxy

Peter Kjellerstedt (3):
oe-git-proxy: Allow explicit IP addresses in $NO_PROXY
oe-git-proxy: Correct the parsing of a port in $ALL_PROXY
oe-git-proxy: Allow socks4 as protocol in $ALL_PROXY

 scripts/oe-git-proxy | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/3 oe-git-proxy: Allow explicit IP addresses in $NO_PROXY

Without this fix, if one specified, e.g., 127.0.0.1 in $NO_PROXY, the oe-git-proxy script would fail with a message like this:

/home/pkj/yocto/poky/scripts/oe-git-proxy: line 64: 32-127.0.0.1: syntax error: invalid arithmetic operator (error token is ".0.0.1")

---
 scripts/oe-git-proxy | 1 +
 1 file changed, 1 insertion(+)
scripts/oe-git-proxy +1 -0
index 4873455..2473282 100755
@@ -53,6 +53,7 @@ match_ipv4() {
 
 	# Determine the mask bitlength
 	BITS=${CIDR##*/}
+	[ "$BITS" != "$CIDR" ] || BITS=32
 	if [ -z "$BITS" ]; then
 		return 1
 	fi
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/3 oe-git-proxy: Correct the parsing of a port in $ALL_PROXY

In reply to Peter Kjellerstedt

Due to an error in the regular expression used to extract a port number specified in $ALL_PROXY, rather than allowing the port number to be followed by an optional "/", the port was required to be followed by "/?".

This corrects the regular expression to allow an optional "/". It also allows the odd "/?" suffix for backwards compatibility.

---
 scripts/oe-git-proxy | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/oe-git-proxy +3 -1
index 2473282..b971c88 100755
@@ -113,7 +113,9 @@ done
 # Proxy is necessary, determine protocol, server, and port
 PROTO=$(echo $ALL_PROXY | sed -e 's/\([^:]*\):\/\/.*/\1/')
 PROXY=$(echo $ALL_PROXY | sed -e 's/.*:\/\/\([^:]*\).*/\1/')
-PORT=$(echo $ALL_PROXY | sed -e 's/.*:\([0-9]*\)\/?$/\1/')
+# For backwards compatibility, this allows the port number to be followed by /?
+# in addition to the customary optional /
+PORT=$(echo $ALL_PROXY | sed -e 's/.*:\([0-9]*\)\(\/?\?\)\?$/\1/')
 if [ "$PORT" = "$ALL_PROXY" ]; then
 	PORT=""
 fi
Signature · 1 line
2.1.0
#3 lore raw

PATCH 3/3 oe-git-proxy: Allow socks4 as protocol in $ALL_PROXY

In reply to Peter Kjellerstedt

The current default is to use SOCKS4a when socks is specified as protocol in $ALL_PROXY. However, not all socks servers support SOCKS4a. By allowing socks4 as an additional protocol, this script will happily work with SOCKS4 only servers.

---
 scripts/oe-git-proxy | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/oe-git-proxy +6 -1
index b971c88..d2e9f92 100755
@@ -120,11 +120,16 @@ if [ "$PORT" = "$ALL_PROXY" ]; then
 	PORT=""
 fi
 
-if [ "$PROTO" = "socks" ]; then
+if [ "$PROTO" = "socks" ] || [ "$PROTO" = "socks4a" ]; then
 	if [ -z "$PORT" ]; then
 		PORT="1080"
 	fi
 	METHOD="SOCKS4A:$PROXY:$1:$2,socksport=$PORT"
+elif [ "$PROTO" = "socks4" ]; then
+	if [ -z "$PORT" ]; then
+		PORT="1080"
+	fi
+	METHOD="SOCKS4:$PROXY:$1:$2,socksport=$PORT"
 else
 	# Assume PROXY (http, https, etc)
 	if [ -z "$PORT" ]; then
Signature · 1 line
2.1.0