Hi all,
I would like to connect the l2tp VPN via ConnMan, but I can't connect the
xl2tp server,
Please share following configure files to me:
connman-xl2tpd.conf
connman-ppp-option.conf
Preferably someone tells me connection steps, thanks a lot!
All of files come from l2tp.c:
static int run_connect(struct vpn_provider *provider,
struct connman_task *task, const char *if_name,
vpn_provider_connect_cb_t cb, void *user_data,
const char *username, const char *password)
{
char *l2tp_name, *pppd_name;
int l2tp_fd, pppd_fd;
int err;
if (!username || !password) {
DBG("Cannot connect username %s password %p",
username, password);
err = -EINVAL;
goto done;
}
DBG("username %s password %p", username, password);
l2tp_name = g_strdup_printf("/var/run/connman/connman-xl2tpd.conf");
l2tp_fd = open(l2tp_name, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
if (l2tp_fd < 0) {
g_free(l2tp_name);
connman_error("Error writing l2tp config");
err = -EIO;
goto done;
}
pppd_name = g_strdup_printf("/var/run/connman/connman-ppp-option.conf");
pppd_fd = open(pppd_name, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
if (pppd_fd < 0) {
connman_error("Error writing pppd config");
g_free(l2tp_name);
g_free(pppd_name);
close(l2tp_fd);
err = -EIO;
goto done;
}
l2tp_write_config(provider, pppd_name, l2tp_fd);
write_pppd_option(provider, pppd_fd);
connman_task_add_argument(task, "-D", NULL);
connman_task_add_argument(task, "-c", l2tp_name);
g_free(l2tp_name);
g_free(pppd_name);
close(l2tp_fd);
close(pppd_fd);
err = connman_task_run(task, l2tp_died, provider,
NULL, NULL, NULL);
if (err < 0) {
connman_error("l2tp failed to start");
err = -EIO;
goto done;
}
done:
if (cb)
cb(provider, user_data, err);
return err;
}
Cheer,
Chengyi
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman