[Bug 382168] [NEW] vpnc: do_ifconfig() in /etc/vpnc/vpnc-script misparses output of "ip route"

Peter Maydell pmaydell at chiark.greenend.org.uk
Sun May 31 16:03:32 UTC 2009


Public bug reported:

Binary package hint: vpnc

This is Ubuntu 9.04, vpnc 0.5.3-1

When I connect to a VPN with vpnc I get this output:
pm215 at canth:~$ sudo vpnc-connect arm
Device "eth1
eth0" does not exist.
SIOCSIFMTU: Invalid argument
VPNC started in background (pid: 12716)...

(and the vpn then seems to come up OK).

This is because the /etc/vpnc/vpnc-script is not correctly parsing the output of "/sbin/ip route" on this machine. The function do_ifconfig() does this:
                DEV=$($IPROUTE route | grep ^default | sed 's/^.* dev \([[:alnum:]-]\+\).*$/\1/')
                MTU=$(($($IPROUTE link show "$DEV" | grep mtu | sed 's/^.* mtu \([[:digit:]]\+\).*$/\1/') - 88))

On this machine the output of 'ip route' is:
81.2.115.144/29 dev eth1  proto kernel  scope link  src 81.2.115.148
169.254.0.0/16 dev eth0  proto kernel  scope link  src 169.254.4.250
default via 81.2.115.145 dev eth1  metric 100
default dev eth0  scope link  metric 1000

and so:
pm215 at canth:~$ echo "$(ip route | grep ^default | sed 's/^.* dev \([[:alnum:]-]\+\).*$/\1/')"
eth1
eth0

and then 'ip link show' complains when it's passed this string (with a
literal \n in it) as the device name.

I think that probably what the script ought to be doing is sorting all
the results it gets in increasing order of metric and picking the first
one.

(Also the error handling here is clearly a bit ropy as the script has
just ploughed on regardless.)

** Affects: vpnc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
vpnc: do_ifconfig() in /etc/vpnc/vpnc-script misparses output of "ip route"
https://bugs.launchpad.net/bugs/382168
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list