diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2020-01-11 01:57:14 +0500 |
---|---|---|
committer | Vladislav Grishenko <themiron@mail.ru> | 2020-01-11 01:57:14 +0500 |
commit | f532c72d0cb33b16b9794d83a46969538bdf2596 (patch) | |
tree | bcfab735d95546e9992aafb3303e360893a9a140 /accel-pppd/ctrl/l2tp/l2tp.c | |
parent | 70952034ecaf0ecb732052d6837f7a4c084ba7bc (diff) | |
download | accel-ppp-xebd-f532c72d0cb33b16b9794d83a46969538bdf2596.tar.gz accel-ppp-xebd-f532c72d0cb33b16b9794d83a46969538bdf2596.zip |
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.
Diffstat (limited to 'accel-pppd/ctrl/l2tp/l2tp.c')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 6c10848..0d1ca21 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()) { |