summaryrefslogtreecommitdiff
path: root/vpn/plugins
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-02-18 17:23:33 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-02-19 12:22:57 +0200
commite878ad14b1b10825a97a43e9da263f37f75334d7 (patch)
tree928651a2a0ba9d431e596643f2c4b74774d6e5bc /vpn/plugins
parent3b7f587a4278b9a43e82f23380090e02b86ec356 (diff)
downloadconnman-e878ad14b1b10825a97a43e9da263f37f75334d7.tar.gz
connman-e878ad14b1b10825a97a43e9da263f37f75334d7.tar.bz2
connman-e878ad14b1b10825a97a43e9da263f37f75334d7.zip
l2tp: Use PPPD prefix for pppd specific options
For backward compatibility purposes, support also the L2TP prefix for PPPD options.
Diffstat (limited to 'vpn/plugins')
-rw-r--r--vpn/plugins/l2tp.c68
1 files changed, 47 insertions, 21 deletions
diff --git a/vpn/plugins/l2tp.c b/vpn/plugins/l2tp.c
index 23553574..e0b2b04f 100644
--- a/vpn/plugins/l2tp.c
+++ b/vpn/plugins/l2tp.c
@@ -98,23 +98,23 @@ struct {
{ "L2TP.Rand Source", "rand source", OPT_L2G, NULL, OPT_STRING },
{ "L2TP.IPsecSaref", "ipsec saref", OPT_L2G, NULL, OPT_STRING },
{ "L2TP.Port", "port", OPT_L2G, NULL, OPT_STRING },
- { "L2TP.EchoFailure", "lcp-echo-failure", OPT_PPPD, "0", OPT_STRING },
- { "L2TP.EchoInterval", "lcp-echo-interval", OPT_PPPD, "0", OPT_STRING },
- { "L2TP.Debug", "debug", OPT_PPPD, NULL, OPT_STRING },
- { "L2TP.RefuseEAP", "refuse-eap", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.RefusePAP", "refuse-pap", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.RefuseCHAP", "refuse-chap", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.RefuseMSCHAP", "refuse-mschap", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.RefuseMSCHAP2", "refuse-mschapv2", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.NoBSDComp", "nobsdcomp", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.NoPcomp", "nopcomp", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.UseAccomp", "accomp", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.NoDeflate", "nodeflate", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.ReqMPPE", "require-mppe", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.ReqMPPE40", "require-mppe-40", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.ReqMPPE128", "require-mppe-128", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.ReqMPPEStateful", "mppe-stateful", OPT_PPPD, NULL, OPT_BOOL },
- { "L2TP.NoVJ", "no-vj-comp", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.EchoFailure", "lcp-echo-failure", OPT_PPPD, "0", OPT_STRING },
+ { "PPPD.EchoInterval", "lcp-echo-interval", OPT_PPPD, "0", OPT_STRING },
+ { "PPPD.Debug", "debug", OPT_PPPD, NULL, OPT_STRING },
+ { "PPPD.RefuseEAP", "refuse-eap", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.RefusePAP", "refuse-pap", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.RefuseCHAP", "refuse-chap", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.RefuseMSCHAP", "refuse-mschap", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.RefuseMSCHAP2", "refuse-mschapv2", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.NoBSDComp", "nobsdcomp", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.NoPcomp", "nopcomp", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.UseAccomp", "accomp", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.NoDeflate", "nodeflate", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.ReqMPPE", "require-mppe", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.ReqMPPE40", "require-mppe-40", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.ReqMPPE128", "require-mppe-128", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.ReqMPPEStateful", "mppe-stateful", OPT_PPPD, NULL, OPT_BOOL },
+ { "PPPD.NoVJ", "no-vj-comp", OPT_PPPD, NULL, OPT_BOOL },
};
static DBusConnection *connection;
@@ -259,14 +259,40 @@ static int l2tp_notify(DBusMessage *msg, struct vpn_provider *provider)
static int l2tp_save(struct vpn_provider *provider, GKeyFile *keyfile)
{
const char *option;
+ connman_bool_t l2tp_option, pppd_option;
int i;
for (i = 0; i < (int)ARRAY_SIZE(pppd_options); i++) {
- if (strncmp(pppd_options[i].cm_opt, "L2TP.", 5) == 0) {
+ l2tp_option = pppd_option = FALSE;
+
+ if (strncmp(pppd_options[i].cm_opt, "L2TP.", 5) == 0)
+ l2tp_option = TRUE;
+
+ if (strncmp(pppd_options[i].cm_opt, "PPPD.", 5) == 0)
+ pppd_option = TRUE;
+
+ if (l2tp_option == TRUE || pppd_option == TRUE) {
option = vpn_provider_get_string(provider,
- pppd_options[i].cm_opt);
- if (option == NULL)
- continue;
+ pppd_options[i].cm_opt);
+ if (option == NULL) {
+ /*
+ * Check if the option prefix is L2TP as the
+ * PPPD options were using L2TP prefix earlier.
+ */
+ char *l2tp_str;
+
+ if (pppd_option == FALSE)
+ continue;
+
+ l2tp_str = g_strdup_printf("L2TP.%s",
+ &pppd_options[i].cm_opt[5]);
+ option = vpn_provider_get_string(provider,
+ l2tp_str);
+ g_free(l2tp_str);
+
+ if (option == NULL)
+ continue;
+ }
g_key_file_set_string(keyfile,
vpn_provider_get_save_group(provider),