From f532c72d0cb33b16b9794d83a46969538bdf2596 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Sat, 11 Jan 2020 01:57:14 +0500 Subject: ipv6pool: add per-proto ipv6-pool and ipv6-pool-delegate options also, disable ipv6 pools via chap-secrets, need to find another syntax for it, may be with comments. --- accel-pppd/ctrl/l2tp/l2tp.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'accel-pppd/ctrl/l2tp') diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 6c108487..0d1ca21a 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -94,6 +94,8 @@ static int conf_mppe = MPPE_UNSET; static int conf_dataseq = L2TP_DATASEQ_ALLOW; static int conf_reorder_timeout = 0; static const char *conf_ip_pool; +static const char *conf_ipv6_pool; +static const char *conf_dpv6_pool; static const char *conf_ifname; static unsigned int stat_conn_starting; @@ -1791,12 +1793,23 @@ static int l2tp_session_start_data_channel(struct l2tp_sess_t *sess) if (conf_ip_pool) { sess->ppp.ses.ipv4_pool_name = _strdup(conf_ip_pool); if (sess->ppp.ses.ipv4_pool_name == NULL) { + err_pool: log_session(log_error, sess, "impossible to start data channel:" - " allocation of IPv4 pool name failed\n"); + " allocation of pool name failed\n"); goto err; } } + if (conf_ipv6_pool) { + sess->ppp.ses.ipv6_pool_name = _strdup(conf_ipv6_pool); + if (sess->ppp.ses.ipv6_pool_name == NULL) + goto err_pool; + } + if (conf_dpv6_pool) { + sess->ppp.ses.dpv6_pool_name = _strdup(conf_dpv6_pool); + if (sess->ppp.ses.dpv6_pool_name == NULL) + goto err_pool; + } if (conf_ifname) sess->ppp.ses.ifname_rename = _strdup(conf_ifname); @@ -1836,6 +1849,14 @@ err: _free(sess->ppp.ses.ipv4_pool_name); sess->ppp.ses.ipv4_pool_name = NULL; } + if (sess->ppp.ses.ipv6_pool_name) { + _free(sess->ppp.ses.ipv6_pool_name); + sess->ppp.ses.ipv6_pool_name = NULL; + } + if (sess->ppp.ses.dpv6_pool_name) { + _free(sess->ppp.ses.dpv6_pool_name); + sess->ppp.ses.dpv6_pool_name = NULL; + } if (sess->ctrl.called_station_id) { _free(sess->ctrl.called_station_id); sess->ctrl.called_station_id = NULL; @@ -4938,6 +4959,8 @@ static void load_config(void) } conf_ip_pool = conf_get_opt("l2tp", "ip-pool"); + conf_ipv6_pool = conf_get_opt("l2tp", "ipv6-pool"); + conf_dpv6_pool = conf_get_opt("l2tp", "ipv6-pool-delegate"); conf_ifname = conf_get_opt("l2tp", "ifname"); switch (iprange_check_activation()) { -- cgit v1.2.3