Comment 0 for bug 1252832

Revision history for this message
TJ (tj) wrote :

Up to and including 13.10 and 14.04 there is a bug in the parsing of multiple remote gateway specifications.

The tooltip says:

po/id.po:402:msgid "Remote host name or IP address. You can specify multiple items for redundancy (use commas to separate the entries).
config: remote"

But the code separate on spaces as well as commas (src/nm-openvpn-service.c::nm_openvpn_start_openvpn_binary()):

    tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
    if (tmp && strlen (tmp)) {
        char *tok;
        while ((tok = strsep((char**)&tmp, " ,")) != NULL) {
            if (strlen(tok)) {
                add_openvpn_arg (args, "--remote");
                add_openvpn_arg (args, tok);
            }
        }
    }

So the following entry in the Gateway text-box "a.bc.d 1194 udp, e.f.g.h 443 tcp"

which is stored in /etc/NetworkManager/system-connections/server as:

 remote=a.b.c.d 1194 udp, e.f.g.h 443 tcp

results in trying to start the process using this:

/usr/sbin/openvpn --remote a.b.c.d --remote 1194 --remote udp --remote e.f.g.h --remote 443 --remote tcp --comp-lzo --nobind --dev tun --proto udp --port 1194 ...

which fails miserably.

the fix is to remove the space from the strsep() match string.