xingplus / tunnelblick

Automatically exported from code.google.com/p/tunnelblick
0 stars 0 forks source link

if-down breaks DNS with PPP connection #74

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Connect to drei.at 3G over PPP
2. Connect to OpenVPN server that pushes DNS DHCP option

What is the expected output? What do you see instead?

DNS up script should read dns info thru scutil and save data to a file on
/tmp/ correctly.

Due to an unusual DNS configuration, data will be wrongly parsed and result
in a corrupted temp file breaking down DNS after OpenVPN's disconnection.

What version of Tunnelblick are you using? On what version of OS X? PPC or
Intel?

b10 10.5.6 PPC

Please provide any additional information below.

This is what a scutil dump usually looks like:

<dictionary> {
  ServerAddresses : <array> {
    0 : 213.94.78.16
    1 : 213.94.78.17
}

and this is the scutil dump from drei.at

<dictionary> {
  SupplementalMatchDomains : <array> {
    0 : 
  }
  ServerAddresses : <array> {
    0 : 213.94.78.16
    1 : 213.94.78.17
  }
  SupplementalMatchOrders : <array> {
    0 : 100000
  }
}

As you can see there are three records beginning with a '0' giving the
script wrong data.

The resulting file on /tmp/ looks like this:

213.94.78.16
100000 213.94.78.17

Any attempt to restore this data as dns addresses will fail, making the
hsdpa connection over ppp unusable

Original issue reported on code.google.com by raf...@gmail.com on 25 Feb 2009 at 9:49

GoogleCodeExporter commented 9 years ago
A simple change to the script should fix this. The change filters the scutil 
output
through awk to remove lines other than the nameserver addresses.

Change:
     OLDDNS1=$( (scutil | grep '0 : ' | sed -e 's/\ *0 : //')<< EOF

To:
     OLDDNS1=$( (scutil | awk '/ServerAddresses/, /\}/' | grep '0 : ' | sed -e 's/\
*0 : //')<< EOF

by inserting " | awk '/ServerAddresses/, /\}/'" just after "scutil".

Do this for both the OLDDNS1 line and the OLDDNS2 line, and you should be all 
set.

This works by having awk will only pass on (to grep) lines starting with the 
line
containing "ServerAddresses", and ending with the line containing "}".

So only the following will be passed on to grep

  ServerAddresses : <array> {
    0 : 213.94.78.16
    1 : 213.94.78.17
  }

and will extract only the two nameserver addresses.

I couldn't test this since I don't have drei.at, so I'd appreciate confirmation 
that
it works. (Or if it doesn't -- this problem should not be hard to solve!)

Original comment by jkbull...@gmail.com on 18 Mar 2009 at 11:39

GoogleCodeExporter commented 9 years ago
Thank you very much jkbullard! That did the trick. Tunnelblick should 
incorporate this in its up script. 

Original comment by raf...@gmail.com on 18 Mar 2009 at 1:15

GoogleCodeExporter commented 9 years ago
Fixed in r94.

Original comment by jkbull...@gmail.com on 5 Aug 2009 at 2:38