diff options
| author | Vladislav Grishenko <themiron@mail.ru> | 2017-10-30 17:27:22 +0500 |
|---|---|---|
| committer | Vladislav Grishenko <themiron@mail.ru> | 2017-12-05 20:39:15 +0500 |
| commit | ae72e179afa46d82865aa8d459b32cc27541e4a7 (patch) | |
| tree | f426671bf7ef9cecf06937f7a673f8b03b7a58bd /accel-pppd/ctrl | |
| parent | 71770d7a41278731f676a11ff943da735a09c5b0 (diff) | |
| download | accel-ppp-ae72e179afa46d82865aa8d459b32cc27541e4a7.tar.gz accel-ppp-ae72e179afa46d82865aa8d459b32cc27541e4a7.zip | |
ppp: implement per-ctrl ppp interface rename support, may be overrided by radius
Reuse exsisting radius functionality and allow set iterface name
template for pppoe/pptp/l2tp, '%d' specification will be replaced
automagically to the next available index by kernel.
PPP interface rename allows to easy differ client's interfaces from
the other ppp ones, for example, with just netfilter interface rules.
Example:
[pptp]
ifname=pptp%d will produce pptp0, pptp1, ...
Diffstat (limited to 'accel-pppd/ctrl')
| -rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 4 | ||||
| -rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 4 | ||||
| -rw-r--r-- | accel-pppd/ctrl/pptp/pptp.c | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index a44d31d..55881b8 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -94,6 +94,7 @@ 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_ifname; static unsigned int stat_conn_starting; static unsigned int stat_conn_active; @@ -1796,6 +1797,8 @@ static int l2tp_session_start_data_channel(struct l2tp_sess_t *sess) goto err; } } + if (conf_ifname) + sess->ppp.ses.ifname_rename = _strdup(conf_ifname); sess->ppp.ses.ctrl = &sess->ctrl; sess->apses_state = APSTATE_INIT; @@ -4928,6 +4931,7 @@ static void load_config(void) } conf_ip_pool = conf_get_opt("l2tp", "ip-pool"); + conf_ifname = conf_get_opt("l2tp", "ifname"); switch (iprange_check_activation()) { case IPRANGE_DISABLED: diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index c572176..4f99354 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -98,6 +98,7 @@ 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_ifname; enum {CSID_MAC, CSID_IFNAME, CSID_IFNAME_MAC}; static int conf_called_sid; static int conf_cookie_timeout; @@ -407,6 +408,8 @@ 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_ifname) + conn->ppp.ses.ifname_rename = _strdup(conf_ifname); triton_context_register(&conn->ctx, conn); @@ -2009,6 +2012,7 @@ static void load_config(void) } conf_ip_pool = conf_get_opt("pppoe", "ip-pool"); + conf_ifname = conf_get_opt("pppoe", "ifname"); conf_called_sid = CSID_MAC; opt = conf_get_opt("pppoe", "called-sid"); diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index fa48687..88b3759 100644 --- a/accel-pppd/ctrl/pptp/pptp.c +++ b/accel-pppd/ctrl/pptp/pptp.c @@ -61,6 +61,7 @@ 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_ifname; static mempool_t conn_pool; @@ -705,6 +706,8 @@ 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_ifname) + conn->ppp.ses.ifname_rename = _strdup(conf_ifname); triton_context_register(&conn->ctx, &conn->ppp.ses); triton_md_register_handler(&conn->ctx, &conn->hnd); @@ -781,6 +784,7 @@ static void load_config(void) } conf_ip_pool = conf_get_opt("pptp", "ip-pool"); + conf_ifname = conf_get_opt("pptp", "ifname"); switch (iprange_check_activation()) { case IPRANGE_DISABLED: |
