Package: iodine
Version: 0.6.0~rc1-2
Severity: normal

The code to detect the network interface does not check if the
guessed interface has an ip address associated to it.

This in turns makes the ipcalc utility go crazy. Try to run it without
arguments
but with the -b flag. It will output 192.168.1.1 anyway, plus errors/warning
that iodine-client-start does not, but probably should, try to detect, like
"INVALID ADDRESS". And of course returns 0, so you really have to grep here :-(

So, if you are in the unfortunate case of having a wifi on, but being connected
on cable, the interface detection code fails, and iodine-client-start tries to
tunnel your traffic trough the wifi assuming is has address 192.168.1.1.

I've attached a little patch to use ip to detect interfaces with a global ip
associated to them.

Cheers



-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages iodine depends on:
ii  adduser                 3.112+nmu2       add and remove users and groups
ii  debconf [debconf-2.0]   1.5.37           Debian configuration management sy
ii  libc6                   2.11.2-7         Embedded GNU C Library: Shared lib
ii  udev                    164-2            /dev/ and hotplug management daemo
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

iodine recommends no packages.

Versions of packages iodine suggests:
ii  dnsutils              1:9.7.2.dfsg.P3-1  Clients provided with BIND
ii  fping                 2.4b2-to-ipv6-16.1 sends ICMP ECHO_REQUEST packets to
ii  gawk                  1:3.1.7.dfsg-5     GNU awk, a pattern scanning and pr
ii  ipcalc                0.41-2             parameter calculator for IPv4 addr
ii  iproute               20100519-3         networking and traffic control too

-- debconf information:
diff --git a/iodine-client-start b/iodine-client-start
index 2f5ad94..6895af9 100755
--- a/iodine-client-start
+++ b/iodine-client-start
@@ -217,18 +217,15 @@ echo ==== Creating IP-over-DNS tunnel over local network connection...
 ## Find a network interface
 
 if [ -z ${interface} ]; then
-    interface=$(tail --lines=+3 /proc/net/wireless \
-	| head -1 | tr -d : | awk '{print $1}')
-fi
-
-if [ -z ${interface} ]; then
-    interface=$(ifconfig -a | egrep '^[^ ].*encap:Ethernet' \
-	| head -1 | awk '{print $1}')
-fi
-
-if [ -z ${interface} ]; then
-    echo ERROR: No network interface found.
-    exit 1
+    nifs=$(ip -4 -o addr show scope global | wc -l)
+    if [ $nifs -eq 0 ]; then
+        echo ERROR: No network interface found.
+        exit 1
+    fi
+    interface=$(ip -4 -o addr show scope global | awk '{print $2}')
+    if [ $nifs -gt 1 ]; then
+        echo WARNING: $nifs interfaces with an ip address, chosing the first one
+    fi
 fi
 
 echo ==== Local network interface: ${interface}

Reply via email to