Please pull from: git://iam.tj/network-manager-openvpn.git gnome712720
This patch is based on my branch "gnome712710" fixing the --remote separator issue. When the remote gateway is specified as IP PORT [PROTO] the entire string would be passed as a single argument on the openvpn command-line, which would cause openvpn to use any default port and protocol settings it had rather than those specified. This is hard to spot since checking the command-line using "ps" doesn't differentiate between spaces and argument separators. This patch parses the "remote ..." string, separating tokens with a space, and adds optional port and protocol values to the comamnd-line correctly. With this and the 712710 patch multiple comma-separated remote connections using different ports and protocols can be specified in the Gateway text widget, e.g. "a.b.c.d 443 tcp,e.f.g.h 1194 udp" Signed-off-by: TJ <[email protected]> --- src/nm-openvpn-service.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c index 3975643..257e5fd 100644 --- a/src/nm-openvpn-service.c +++ b/src/nm-openvpn-service.c @@ -905,11 +905,28 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin, tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE); if (tmp && strlen (tmp)) { - char *tok; + char *tok, *tok2, *p; while ((tok = strsep((char**)&tmp, ",")) != NULL) { if (strlen(tok)) { add_openvpn_arg (args, "--remote"); add_openvpn_arg (args, tok); + tmp2 = strdup(tok); + while ((tok2 = strsep((char **)&tmp2, " ")) != NULL) { + gboolean port = FALSE; + if (strlen(tok2)) { + for (p=tok2, port=TRUE; *p; p++) { + if (!isdigit(*p)) { + port = FALSE; + break; + } + } + if (port) + add_openvpn_arg (args, tok2); + else if ((strncmp("udp", tok2, 3) == 0 || strncmp("tcp", tok2, 3) == 0)) + add_openvpn_arg (args, tok2); + } + } + free((void *)tmp2); } } } -- 1.8.1.2.433.g9808ce0.dirty _______________________________________________ networkmanager-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/networkmanager-list
