Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to use OpenVPN to connect to a work network. Unfortunately, the work network is behind a NAT, which means I have to use the float option to make it work.

Apparently, NetworkManager does not support the float option --- there appears to be no way of specifying it in the configuration options.

I don't want to lose NetworkManager, because it provides a very convenient way of connecting to random wireless networks; but I have to use OpenVPN. I've tried using OpenVPN directly with a raw OpenVPN configuration file, and this correctly sets up the connection, but this now interacts horribly with NetworkManager so things like DNS and routing is all messed up.

Does anyone know any way of getting NetworkManager to support the float option?

share|improve this question

1 Answer 1

According to an Ubuntu Forums thread there was a patch added to the ppa for network manager but it is no longer offered.

The page lists the following code however that you can try.

--- network-manager-openvpn-0.7.1~20090213+bzr14.orig/properties/auth-helpers.c
+++ network-manager-openvpn-0.7.1~20090213+bzr14/properties/auth-helpers.c
@@ -718,6 +718,7 @@
 static const char *advanced_keys[] = {
    NM_OPENVPN_KEY_PORT,
    NM_OPENVPN_KEY_COMP_LZO,
+   NM_OPENVPN_KEY_FLOAT,
    NM_OPENVPN_KEY_TAP_DEV,
    NM_OPENVPN_KEY_PROTO_TCP,
    NM_OPENVPN_KEY_CIPHER,
@@ -1005,6 +1006,13 @@
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
    }

+   value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_FLOAT);
+   if (value && !strcmp (value, "yes")) {
+       widget = glade_xml_get_widget (xml, "float_checkbutton");
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+   }
+
+
    value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_PROTO_TCP);
    if (value && !strcmp (value, "yes")) {
        widget = glade_xml_get_widget (xml, "tcp_checkbutton");
@@ -1112,6 +1120,10 @@
    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
        g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_COMP_LZO), g_strdup ("yes"));

+   widget = glade_xml_get_widget (xml, "float_checkbutton");
+   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+       g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_FLOAT), g_strdup ("yes"));
+
    widget = glade_xml_get_widget (xml, "tcp_checkbutton");
    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
        g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_PROTO_TCP), g_strdup ("yes"));
--- network-manager-openvpn-0.7.1~20090213+bzr14.orig/properties/nm-openvpn-dialog.glade
+++ network-manager-openvpn-0.7.1~20090213+bzr14/properties/nm-openvpn-dialog.glade
@@ -935,6 +935,20 @@
                     <property name="position">3</property>
                   </packing>
                 </child>
+                <child>
+                  <widget class="GtkCheckButton" id="float_checkbutton">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="label" translatable="no">Use the _Float option</property>
+                    <property name="use_underline">True</property>
+                    <property name="response_id">0</property>
+                    <property name="draw_indicator">True</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
               </widget>
             </child>
             <child>
--- network-manager-openvpn-0.7.1~20090213+bzr14.orig/src/nm-openvpn-service.h
+++ network-manager-openvpn-0.7.1~20090213+bzr14/src/nm-openvpn-service.h
@@ -43,6 +43,7 @@
 #define NM_OPENVPN_KEY_CERT "cert"
 #define NM_OPENVPN_KEY_CIPHER "cipher"
 #define NM_OPENVPN_KEY_COMP_LZO "comp-lzo"
+#define NM_OPENVPN_KEY_FLOAT "float"
 #define NM_OPENVPN_KEY_CONNECTION_TYPE "connection-type"
 #define NM_OPENVPN_KEY_TAP_DEV "tap-dev"
 #define NM_OPENVPN_KEY_KEY "key"
--- network-manager-openvpn-0.7.1~20090213+bzr14.orig/src/nm-openvpn-service.c
+++ network-manager-openvpn-0.7.1~20090213+bzr14/src/nm-openvpn-service.c
@@ -88,6 +88,7 @@
    { NM_OPENVPN_KEY_CERT,                 G_TYPE_STRING, 0, 0, FALSE },
    { NM_OPENVPN_KEY_CIPHER,               G_TYPE_STRING, 0, 0, FALSE },
    { NM_OPENVPN_KEY_COMP_LZO,             G_TYPE_BOOLEAN, 0, 0, FALSE },
+   { NM_OPENVPN_KEY_FLOAT,                G_TYPE_BOOLEAN, 0, 0, FALSE },
    { NM_OPENVPN_KEY_CONNECTION_TYPE,      G_TYPE_STRING, 0, 0, FALSE },
    { NM_OPENVPN_KEY_TAP_DEV,              G_TYPE_BOOLEAN, 0, 0, FALSE },
    { NM_OPENVPN_KEY_KEY,                  G_TYPE_STRING, 0, 0, FALSE },
@@ -640,6 +641,10 @@
    if (tmp && !strcmp (tmp, "yes"))
        add_openvpn_arg (args, "--comp-lzo");

+   tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_FLOAT);
+   if (tmp && !strcmp (tmp, "yes"))
+       add_openvpn_arg (args, "--float");
+
    add_openvpn_arg (args, "--nobind");

    /* Device, either tun or tap */

To apply this patch to the source of your current network-manager-openvpn plugin as follows:

mkdir ~/build-tmp
cd ~/build-tmp
apt-get source network-manager-openvpn
cd ./network-manager-openvpn*
wget http://onemyndseye.doesntexist.com/onemyndseye-ppa/patches/nm-advoptions-float.patch -O ./debian/patches/nm-advoptions-float.patch
echo "nm-advoptions-float.patch" >>./debian/patches/series
sudo apt-get build-dep network-mananger-openvpn
sudo apt-get install libglade2-dev devscripts build-essential
sudo dpkg-buildpackage

Good luck.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.