summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2020-01-13 12:27:15 +0300
committerGitHub <noreply@github.com>2020-01-13 12:27:15 +0300
commit183ecb17cdb3f3a29912e1eea70603657ad221f0 (patch)
tree2a7558853c2451fed00f3d10ea1c9ed641bacfe0 /accel-pppd/ctrl
parent61862862a9fa24db4f16c24db1aed1f1a5f0be19 (diff)
parentf532c72d0cb33b16b9794d83a46969538bdf2596 (diff)
downloadaccel-ppp-183ecb17cdb3f3a29912e1eea70603657ad221f0.tar.gz
accel-ppp-183ecb17cdb3f3a29912e1eea70603657ad221f0.zip
Merge pull request #110 from themiron/ipv6-pool
Add named ipv6 pools support
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c16
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c25
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c8
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c8
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c8
5 files changed, 64 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 45f66b73..b1504a2f 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -119,6 +119,8 @@ static int conf_arp;
static int conf_ipv6;
static uint32_t conf_src;
static const char *conf_ip_pool;
+static const char *conf_ipv6_pool;
+static const char *conf_dpv6_pool;
static const char *conf_l4_redirect_pool;
//static int conf_dhcpv6;
static int conf_username;
@@ -1366,6 +1368,10 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s
if (conf_ip_pool)
ses->ses.ipv4_pool_name = _strdup(conf_ip_pool);
+ if (conf_ipv6_pool)
+ ses->ses.ipv6_pool_name = _strdup(conf_ipv6_pool);
+ if (conf_dpv6_pool)
+ ses->ses.dpv6_pool_name = _strdup(conf_dpv6_pool);
triton_context_register(&ses->ctx, &ses->ses);
@@ -2073,6 +2079,10 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc
if (conf_ip_pool)
ses->ses.ipv4_pool_name = _strdup(conf_ip_pool);
+ if (conf_ipv6_pool)
+ ses->ses.ipv6_pool_name = _strdup(conf_ipv6_pool);
+ if (conf_dpv6_pool)
+ ses->ses.dpv6_pool_name = _strdup(conf_dpv6_pool);
ses->ctrl.dont_ifcfg = 1;
@@ -2118,6 +2128,10 @@ static void ipoe_session_create_auto(struct ipoe_serv *serv)
if (conf_ip_pool)
ses->ses.ipv4_pool_name = _strdup(conf_ip_pool);
+ if (conf_ipv6_pool)
+ ses->ses.ipv6_pool_name = _strdup(conf_ipv6_pool);
+ if (conf_dpv6_pool)
+ ses->ses.dpv6_pool_name = _strdup(conf_dpv6_pool);
ses->ctrl.dont_ifcfg = 1;
@@ -3915,6 +3929,8 @@ static void load_config(void)
conf_offer_timeout = 10;
conf_ip_pool = conf_get_opt("ipoe", "ip-pool");
+ conf_ipv6_pool = conf_get_opt("ipoe", "ipv6-pool");
+ conf_dpv6_pool = conf_get_opt("ipoe", "ipv6-pool-delegate");
conf_l4_redirect_pool = conf_get_opt("ipoe", "l4-redirect-ip-pool");
conf_vlan_name = conf_get_opt("ipoe", "vlan-name");
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()) {
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index a1f54e71..32dee77a 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -99,6 +99,8 @@ int conf_padi_limit = 0;
int conf_mppe = MPPE_UNSET;
int conf_sid_uppercase = 0;
static const char *conf_ip_pool;
+static const char *conf_ipv6_pool;
+static const char *conf_dpv6_pool;
static const char *conf_ifname;
enum {CSID_MAC, CSID_IFNAME, CSID_IFNAME_MAC};
static int conf_called_sid;
@@ -409,6 +411,10 @@ static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const ui
if (conf_ip_pool)
conn->ppp.ses.ipv4_pool_name = _strdup(conf_ip_pool);
+ if (conf_ipv6_pool)
+ conn->ppp.ses.ipv6_pool_name = _strdup(conf_ipv6_pool);
+ if (conf_dpv6_pool)
+ conn->ppp.ses.dpv6_pool_name = _strdup(conf_dpv6_pool);
if (conf_ifname)
conn->ppp.ses.ifname_rename = _strdup(conf_ifname);
@@ -2028,6 +2034,8 @@ static void load_config(void)
}
conf_ip_pool = conf_get_opt("pppoe", "ip-pool");
+ conf_ipv6_pool = conf_get_opt("pppoe", "ipv6-pool");
+ conf_dpv6_pool = conf_get_opt("pppoe", "ipv6-pool-delegate");
conf_ifname = conf_get_opt("pppoe", "ifname");
conf_called_sid = CSID_MAC;
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index 081e9216..1161da5a 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -63,6 +63,8 @@ static int conf_echo_failure = 3;
static int conf_verbose = 0;
static int conf_mppe = MPPE_UNSET;
static const char *conf_ip_pool;
+static const char *conf_ipv6_pool;
+static const char *conf_dpv6_pool;
static const char *conf_ifname;
static mempool_t conn_pool;
@@ -713,6 +715,10 @@ static int pptp_connect(struct triton_md_handler_t *h)
if (conf_ip_pool)
conn->ppp.ses.ipv4_pool_name = _strdup(conf_ip_pool);
+ if (conf_ipv6_pool)
+ conn->ppp.ses.ipv6_pool_name = _strdup(conf_ipv6_pool);
+ if (conf_dpv6_pool)
+ conn->ppp.ses.dpv6_pool_name = _strdup(conf_dpv6_pool);
if (conf_ifname)
conn->ppp.ses.ifname_rename = _strdup(conf_ifname);
@@ -802,6 +808,8 @@ static void load_config(void)
}
conf_ip_pool = conf_get_opt("pptp", "ip-pool");
+ conf_ipv6_pool = conf_get_opt("pptp", "ipv6-pool");
+ conf_dpv6_pool = conf_get_opt("pptp", "ipv6-pool-delegate");
conf_ifname = conf_get_opt("pptp", "ifname");
switch (iprange_check_activation()) {
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 62e574c7..5bf8fd82 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -159,6 +159,8 @@ static int conf_hello_interval = SSTP_HELLO_TIMEOUT;
static int conf_verbose = 0;
static int conf_ppp_max_mtu = 1452;
static const char *conf_ip_pool;
+static const char *conf_ipv6_pool;
+static const char *conf_dpv6_pool;
static const char *conf_ifname;
static int conf_proxyproto = 0;
@@ -2276,6 +2278,10 @@ static int sstp_connect(struct triton_md_handler_t *h)
conn->ppp.ses.chan_name = _strdup(addr_buf);
if (conf_ip_pool)
conn->ppp.ses.ipv4_pool_name = _strdup(conf_ip_pool);
+ if (conf_ipv6_pool)
+ conn->ppp.ses.ipv6_pool_name = _strdup(conf_ipv6_pool);
+ if (conf_dpv6_pool)
+ conn->ppp.ses.dpv6_pool_name = _strdup(conf_dpv6_pool);
if (conf_ifname)
conn->ppp.ses.ifname_rename = _strdup(conf_ifname);
@@ -2693,6 +2699,8 @@ static void load_config(void)
conf_ppp_max_mtu = atoi(opt);
conf_ip_pool = conf_get_opt("sstp", "ip-pool");
+ conf_ipv6_pool = conf_get_opt("sstp", "ipv6-pool");
+ conf_dpv6_pool = conf_get_opt("sstp", "ipv6-pool-delegate");
conf_ifname = conf_get_opt("sstp", "ifname");
ipmode = (serv.addr.u.sa.sa_family == AF_INET && !conf_proxyproto) ?