@@ -863,6 +863,52 @@ def disable_kill_switch(self):
863863 self .killswitch_btn .setChecked (False )
864864 return False
865865
866+ def disable_ipv6 (self ):
867+ if self .sudo_password :
868+ try :
869+ p1 = subprocess .Popen (['echo' , self .sudo_password ], stdout = subprocess .PIPE , stderr = subprocess .PIPE , stdin = subprocess .PIPE )
870+ p2 = subprocess .Popen (['sudo' , '-S' , 'sysctl' , '-w' , 'net.ipv6.conf.all.disable_ipv6=1' , '&&' , 'sysctl' , '-w' , 'net.ipv6.conf.default.disable_ipv6=1' ], stdin = p1 .stdout , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
871+ p1 .stdout .close ()
872+ p2 .stdout .close ()
873+ except subprocess .CalledProcessError :
874+ self .statusbar .showMessage ("ERROR: disabling IPV6 failed" , 2000 )
875+ else :
876+ self .sudo_dialog = self .get_sudo ()
877+ self .sudo_dialog .text_label .setText ("<html><head/><body><p>VPN Network Manager requires <span style=\" font-weight:600;\" >sudo</span> permissions in order to disable IPV6. Please input the <span style=\" font-weight:600;\" >sudo</span> Password or run the program with elevated priveledges.</p></body></html>" )
878+ self .sudo_dialog .exec_ ()
879+
880+ if self .sudo_password :
881+ try :
882+ p1 = subprocess .Popen (['echo' , self .sudo_password ], stdout = subprocess .PIPE , stderr = subprocess .PIPE , stdin = subprocess .PIPE )
883+ p2 = subprocess .Popen (['sudo' , '-S' , 'sysctl' , '-w' , 'net.ipv6.conf.all.disable_ipv6=1' , '&&' , 'sysctl' , '-w' , 'net.ipv6.conf.default.disable_ipv6=0' ], stdin = p1 .stdout , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
884+ p1 .stdout .close ()
885+ p2 .stdout .close ()
886+ except subprocess .CalledProcessError :
887+ self .statusbar .showMessage ("ERROR: disabling IPV6 failed" , 2000 )
888+
889+ def enable_ipv6 (self ):
890+ if self .sudo_password :
891+ try :
892+ p1 = subprocess .Popen (['echo' , self .sudo_password ], stdout = subprocess .PIPE , stderr = subprocess .PIPE , stdin = subprocess .PIPE )
893+ p2 = subprocess .Popen (['sudo' , '-S' , 'sysctl' , '-w' , 'net.ipv6.conf.all.disable_ipv6=0' , '&&' , 'sysctl' , '-w' , 'net.ipv6.conf.default.disable_ipv6=0' ], stdin = p1 .stdout , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
894+ p1 .stdout .close ()
895+ p2 .stdout .close ()
896+ except subprocess .CalledProcessError :
897+ self .statusbar .showMessage ("ERROR: disabling IPV6 failed" , 2000 )
898+ else :
899+ self .sudo_dialog = self .get_sudo ()
900+ self .sudo_dialog .text_label .setText ("<html><head/><body><p>VPN Network Manager requires <span style=\" font-weight:600;\" >sudo</span> permissions in order to enable IPV6. Please input the <span style=\" font-weight:600;\" >sudo</span> Password or run the program with elevated priveledges.</p></body></html>" )
901+ self .sudo_dialog .exec_ ()
902+
903+ if self .sudo_password :
904+ try :
905+ p1 = subprocess .Popen (['echo' , self .sudo_password ], stdout = subprocess .PIPE , stderr = subprocess .PIPE , stdin = subprocess .PIPE )
906+ p2 = subprocess .Popen (['sudo' , '-S' , 'sysctl' , '-w' , 'net.ipv6.conf.all.disable_ipv6=0' , '&&' , 'sysctl' , '-w' , 'net.ipv6.conf.default.disable_ipv6=0' ], stdin = p1 .stdout , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
907+ p1 .stdout .close ()
908+ p2 .stdout .close ()
909+ except subprocess .CalledProcessError :
910+ self .statusbar .showMessage ("ERROR: Enabling IPV6 failed" , 2000 )
911+
866912 def check_connection_validity (self ):
867913 if self .server_type_select .currentText () == 'Double VPN' : # perhaps add pop up to give user the choice
868914 self .connection_type_select .setCurrentIndex (1 ) # set to TCP
@@ -912,8 +958,8 @@ def connect(self):
912958 return False
913959 elif self .auto_connect_box .isChecked () and self .sudo_password : # sudo password exists in memory
914960 self .set_auto_connect ()
915-
916961 self .check_connection_validity ()
962+ self .disable_ipv6 ()
917963 self .get_ovpn ()
918964 self .import_ovpn ()
919965 self .add_secrets ()
@@ -951,6 +997,7 @@ def disconnect_vpn(self):
951997 self .disable_auto_connect ()
952998 self .disable_connection ()
953999 self .remove_connection ()
1000+ self .enable_ipv6 ()
9541001 self .statusbar .clearMessage ()
9551002 self .repaint ()
9561003
0 commit comments