protonvpn-cli icon indicating copy to clipboard operation
protonvpn-cli copied to clipboard

Connection test based on IP change may be wrong in some cases

Open Tamaranch opened this issue 6 years ago • 0 comments

I had the case recently using my phone as a modem: my IP changed during the openvpn connection process. But in the code, we have:

if [[ ("$current_ip" != "$new_ip") && ("$new_ip" != "Error.") ]]; then
  echo "[$] Connected!"
  echo "[#] New IP: $new_ip"

So pvpn concluded that I was connected when it was not! A complementary test should be added, such as

if [[ ("$current_ip" != "$new_ip") && ("$new_ip" != "Error.") && grep -q "route add $new_ip" "$connection_logs" ]]; then
  echo "[$] Connected!"
  echo "[#] New IP: $new_ip"

I don't know if it's really the right way to do it, so I do not propose a PR, but something should probably be done.

Tamaranch avatar Jul 02 '19 16:07 Tamaranch