accel-ppp-users Mailing List for accel-ppp (Page 31)
Status: Beta
Brought to you by:
xebd
You can subscribe to this list here.
2012 |
Jan
|
Feb
(2) |
Mar
(4) |
Apr
|
May
(3) |
Jun
(4) |
Jul
(9) |
Aug
(38) |
Sep
(24) |
Oct
(25) |
Nov
(2) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2013 |
Jan
(20) |
Feb
(64) |
Mar
(58) |
Apr
(17) |
May
|
Jun
(29) |
Jul
(16) |
Aug
|
Sep
(1) |
Oct
(8) |
Nov
(1) |
Dec
|
2014 |
Jan
(25) |
Feb
(11) |
Mar
(15) |
Apr
(33) |
May
(2) |
Jun
(23) |
Jul
(3) |
Aug
(11) |
Sep
(12) |
Oct
(37) |
Nov
(8) |
Dec
|
2015 |
Jan
(10) |
Feb
(4) |
Mar
(2) |
Apr
(4) |
May
|
Jun
(3) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(12) |
2016 |
Jan
|
Feb
(1) |
Mar
(3) |
Apr
(18) |
May
(21) |
Jun
(28) |
Jul
(11) |
Aug
|
Sep
|
Oct
(1) |
Nov
(21) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
(4) |
Feb
(6) |
Mar
(7) |
Apr
|
May
|
Jun
(13) |
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(50) |
Nov
(21) |
Dec
(16) |
From: Guillaume N. <g....@al...> - 2012-08-14 17:23:31
|
Use struct l2tp_sess_t to separate session data from other connection information. This is required in order to implement session multiplexing. Signed-off-by: Guillaume Nault <g....@al...> --- accel-pppd/ctrl/l2tp/l2tp.c | 146 +++++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 68 deletions(-) diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 01d0c90..0c7a573 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -68,6 +68,19 @@ struct l2tp_serv_t struct sockaddr_in addr; }; +struct l2tp_sess_t +{ + struct l2tp_conn_t *paren_conn; + uint16_t sid; + uint16_t peer_sid; + + int state1; + int state2; + + struct ppp_ctrl_t ctrl; + struct ppp_t ppp; +}; + struct l2tp_conn_t { struct triton_context_t ctx; @@ -80,9 +93,7 @@ struct l2tp_conn_t struct sockaddr_in addr; uint16_t tid; - uint16_t sid; uint16_t peer_tid; - uint16_t peer_sid; uint32_t framing_cap; uint16_t challenge_len; l2tp_value_t challenge; @@ -92,11 +103,7 @@ struct l2tp_conn_t struct list_head send_queue; int state; - int state1; - int state2; - - struct ppp_ctrl_t ctrl; - struct ppp_t ppp; + struct l2tp_sess_t sess; }; static pthread_mutex_t l2tp_lock = PTHREAD_MUTEX_INITIALIZER; @@ -131,7 +138,7 @@ static void l2tp_disconnect(struct l2tp_conn_t *conn) if (conn->state == STATE_PPP) { __sync_sub_and_fetch(&stat_active, 1); conn->state = STATE_FIN; - ppp_terminate(&conn->ppp, TERM_USER_REQUEST, 1); + ppp_terminate(&conn->sess.ppp, TERM_USER_REQUEST, 1); } else if (conn->state != STATE_FIN) __sync_sub_and_fetch(&stat_starting, 1); @@ -139,13 +146,13 @@ static void l2tp_disconnect(struct l2tp_conn_t *conn) l2tp_conn[conn->tid] = NULL; pthread_mutex_unlock(&l2tp_lock); - if (conn->ppp.fd != -1) - close(conn->ppp.fd); + if (conn->sess.ppp.fd != -1) + close(conn->sess.ppp.fd); if (conn->tunnel_fd != -1) close(conn->tunnel_fd); - triton_event_fire(EV_CTRL_FINISHED, &conn->ppp); + triton_event_fire(EV_CTRL_FINISHED, &conn->sess.ppp); log_ppp_info1("disconnected\n"); @@ -157,12 +164,12 @@ static void l2tp_disconnect(struct l2tp_conn_t *conn) l2tp_packet_free(pack); } - if (conn->ppp.chan_name) - _free(conn->ppp.chan_name); + if (conn->sess.ppp.chan_name) + _free(conn->sess.ppp.chan_name); if (conn->challenge_len) _free(conn->challenge.octets); - _free(conn->ctrl.calling_station_id); - _free(conn->ctrl.called_station_id); + _free(conn->sess.ctrl.calling_station_id); + _free(conn->sess.ctrl.called_station_id); mempool_free(conn); } @@ -199,8 +206,9 @@ out_err: static void l2tp_ppp_started(struct ppp_t *ppp) { - struct l2tp_conn_t *conn = container_of(ppp, typeof(*conn), ppp); - + struct l2tp_sess_t *sess = container_of(ppp, typeof(*sess), ppp); + struct l2tp_conn_t *conn = sess->paren_conn; + log_ppp_debug("l2tp: ppp started\n"); if (conf_hello_interval) @@ -209,7 +217,8 @@ static void l2tp_ppp_started(struct ppp_t *ppp) static void l2tp_ppp_finished(struct ppp_t *ppp) { - struct l2tp_conn_t *conn = container_of(ppp, typeof(*conn), ppp); + struct l2tp_sess_t *sess = container_of(ppp, typeof(*sess), ppp); + struct l2tp_conn_t *conn = sess->paren_conn; log_ppp_debug("l2tp: ppp finished\n"); @@ -227,7 +236,7 @@ static void l2tp_conn_close(struct triton_context_t *ctx) if (conn->state == STATE_PPP) { __sync_sub_and_fetch(&stat_active, 1); conn->state = STATE_FIN; - ppp_terminate(&conn->ppp, TERM_ADMIN_RESET, 1); + ppp_terminate(&conn->sess.ppp, TERM_ADMIN_RESET, 1); } if (l2tp_terminate(conn, 0, 0)) @@ -301,7 +310,7 @@ static int l2tp_tunnel_alloc(struct l2tp_serv_t *serv, struct l2tp_packet_t *pac return -1; } - conn->sid = 1; + conn->sess.sid = 1; memcpy(&conn->addr, &pack->addr, sizeof(pack->addr)); conn->peer_tid = assigned_tid->val.uint16; @@ -333,32 +342,33 @@ static int l2tp_tunnel_alloc(struct l2tp_serv_t *serv, struct l2tp_packet_t *pac conn->rtimeout_timer.period = conf_rtimeout * 1000; conn->hello_timer.expire = l2tp_send_HELLO; conn->hello_timer.period = conf_hello_interval * 1000; - conn->ctrl.ctx = &conn->ctx; - conn->ctrl.type = CTRL_TYPE_L2TP; - conn->ctrl.name = "l2tp"; - conn->ctrl.started = l2tp_ppp_started; - conn->ctrl.finished = l2tp_ppp_finished; - conn->ctrl.max_mtu = 1420; - conn->ctrl.mppe = conf_mppe; - conn->ctrl.def_pool = conf_ip_pool; - - conn->ctrl.calling_station_id = _malloc(17); - conn->ctrl.called_station_id = _malloc(17); - u_inet_ntoa(conn->addr.sin_addr.s_addr, conn->ctrl.calling_station_id); - u_inet_ntoa(addr.sin_addr.s_addr, conn->ctrl.called_station_id); - - ppp_init(&conn->ppp); - conn->ppp.ctrl = &conn->ctrl; - conn->ppp.fd = -1; + conn->sess.paren_conn = conn; + conn->sess.ctrl.ctx = &conn->ctx; + conn->sess.ctrl.type = CTRL_TYPE_L2TP; + conn->sess.ctrl.name = "l2tp"; + conn->sess.ctrl.started = l2tp_ppp_started; + conn->sess.ctrl.finished = l2tp_ppp_finished; + conn->sess.ctrl.max_mtu = 1420; + conn->sess.ctrl.mppe = conf_mppe; + conn->sess.ctrl.def_pool = conf_ip_pool; + + conn->sess.ctrl.calling_station_id = _malloc(17); + conn->sess.ctrl.called_station_id = _malloc(17); + u_inet_ntoa(conn->addr.sin_addr.s_addr, conn->sess.ctrl.calling_station_id); + u_inet_ntoa(addr.sin_addr.s_addr, conn->sess.ctrl.called_station_id); + + ppp_init(&conn->sess.ppp); + conn->sess.ppp.ctrl = &conn->sess.ctrl; + conn->sess.ppp.fd = -1; conn->tunnel_fd = -1; - triton_context_register(&conn->ctx, &conn->ppp); + triton_context_register(&conn->ctx, &conn->sess.ppp); triton_md_register_handler(&conn->ctx, &conn->hnd); triton_md_enable_handler(&conn->hnd, MD_MODE_READ); triton_context_wakeup(&conn->ctx); if (conf_verbose) { - log_switch(&conn->ctx, &conn->ppp); + log_switch(&conn->ctx, &conn->sess.ppp); log_ppp_info2("recv "); l2tp_packet_print(pack, log_ppp_info2); } @@ -406,18 +416,18 @@ static int l2tp_connect(struct l2tp_conn_t *conn) goto out_err; } - conn->ppp.fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); - if (conn->ppp.fd < 0) { + conn->sess.ppp.fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); + if (conn->sess.ppp.fd < 0) { log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); goto out_err; } - flg = fcntl(conn->ppp.fd, F_GETFD); + flg = fcntl(conn->sess.ppp.fd, F_GETFD); if (flg < 0) { log_ppp_error("l2tp: fcntl(F_GETFD): %s\n", strerror(errno)); goto out_err; } - flg = fcntl(conn->ppp.fd, F_SETFD, flg | FD_CLOEXEC); + flg = fcntl(conn->sess.ppp.fd, F_SETFD, flg | FD_CLOEXEC); if (flg < 0) { log_ppp_error("l2tp: fcntl(F_SETFD): %s\n", strerror(errno)); goto out_err; @@ -428,24 +438,24 @@ static int l2tp_connect(struct l2tp_conn_t *conn) goto out_err; } - pppox_addr.pppol2tp.s_session = conn->sid; - pppox_addr.pppol2tp.d_session = conn->peer_sid; + pppox_addr.pppol2tp.s_session = conn->sess.sid; + pppox_addr.pppol2tp.d_session = conn->sess.peer_sid; - if (connect(conn->ppp.fd, (struct sockaddr *)&pppox_addr, sizeof(pppox_addr)) < 0) { + if (connect(conn->sess.ppp.fd, (struct sockaddr *)&pppox_addr, sizeof(pppox_addr)) < 0) { log_ppp_error("l2tp: connect(session): %s\n", strerror(errno)); goto out_err; } - if (setsockopt(conn->ppp.fd, SOL_PPPOL2TP, PPPOL2TP_SO_LNSMODE, &arg, sizeof(arg))) { + if (setsockopt(conn->sess.ppp.fd, SOL_PPPOL2TP, PPPOL2TP_SO_LNSMODE, &arg, sizeof(arg))) { log_ppp_error("l2tp: setsockopt: %s\n", strerror(errno)); goto out_err; } - conn->ppp.chan_name = _strdup(inet_ntoa(conn->addr.sin_addr)); + conn->sess.ppp.chan_name = _strdup(inet_ntoa(conn->addr.sin_addr)); - triton_event_fire(EV_CTRL_STARTED, &conn->ppp); + triton_event_fire(EV_CTRL_STARTED, &conn->sess.ppp); - if (establish_ppp(&conn->ppp)) + if (establish_ppp(&conn->sess.ppp)) goto out_err; __sync_sub_and_fetch(&stat_starting, 1); @@ -460,9 +470,9 @@ out_err: close(conn->tunnel_fd); conn->tunnel_fd = -1; } - if (conn->ppp.fd >= 0) { - close(conn->ppp.fd); - conn->ppp.fd = -1; + if (conn->sess.ppp.fd >= 0) { + close(conn->sess.ppp.fd); + conn->sess.ppp.fd = -1; } return -1; } @@ -618,9 +628,9 @@ static int l2tp_send_ICRP(struct l2tp_conn_t *conn) if (!pack) return -1; - pack->hdr.sid = htons(conn->peer_sid); + pack->hdr.sid = htons(conn->sess.peer_sid); - if (l2tp_packet_add_int16(pack, Assigned_Session_ID, conn->sid, 1)) + if (l2tp_packet_add_int16(pack, Assigned_Session_ID, conn->sess.sid, 1)) goto out_err; l2tp_send(conn, pack, 0); @@ -630,7 +640,7 @@ static int l2tp_send_ICRP(struct l2tp_conn_t *conn) else triton_timer_mod(&conn->timeout_timer, 0); - conn->state1 = STATE_WAIT_ICCN; + conn->sess.state1 = STATE_WAIT_ICCN; return 0; @@ -649,7 +659,7 @@ out_err: pack->hdr.sid = htons(conn->peer_sid); - if (l2tp_packet_add_int16(pack, Assigned_Session_ID, conn->sid, 1)) + if (l2tp_packet_add_int16(pack, Assigned_Session_ID, conn->sess.sid, 1)) goto out_err; if (l2tp_packet_add_int32(pack, Call_Serial_Number, 0, 1)) goto out_err; @@ -768,7 +778,7 @@ static int l2tp_recv_SCCCN(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) if (conn->state == STATE_WAIT_SCCCN) { triton_timer_mod(&conn->timeout_timer, 0); conn->state = STATE_ESTB; - conn->state1 = STATE_WAIT_ICRQ; + conn->sess.state1 = STATE_WAIT_ICRQ; } else log_ppp_warn("l2tp: unexpected SCCCN\n"); @@ -795,7 +805,7 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) struct l2tp_attr_t *attr; struct l2tp_attr_t *assigned_sid = NULL; - if (conn->state1 != STATE_WAIT_ICRQ) { + if (conn->sess.state1 != STATE_WAIT_ICRQ) { log_ppp_warn("l2tp: unexpected ICRQ\n"); return 0; } @@ -832,7 +842,7 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) return -1; } - conn->peer_sid = assigned_sid->val.uint16; + conn->sess.peer_sid = assigned_sid->val.uint16; if (l2tp_send_ICRP(conn)) return -1; @@ -845,12 +855,12 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) static int l2tp_recv_ICCN(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) { - if (conn->state1 != STATE_WAIT_ICCN) { + if (conn->sess.state1 != STATE_WAIT_ICCN) { log_ppp_warn("l2tp: unexpected ICCN\n"); return 0; } - conn->state1 = STATE_ESTB; + conn->sess.state1 = STATE_ESTB; if (l2tp_connect(conn)) { if (l2tp_terminate(conn, 2, 0)) @@ -868,31 +878,31 @@ static int l2tp_recv_ICCN(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) static int l2tp_recv_OCRP(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) { - if (conn->state2 != STATE_WAIT_OCRP) { + if (conn->sess.state2 != STATE_WAIT_OCRP) { log_ppp_warn("l2tp: unexpected OCRP\n"); return 0; } - conn->state2 = STATE_WAIT_OCCN; + conn->sess.state2 = STATE_WAIT_OCCN; return 0; } static int l2tp_recv_OCCN(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) { - if (conn->state2 != STATE_WAIT_OCCN) { + if (conn->sess.state2 != STATE_WAIT_OCCN) { log_ppp_warn("l2tp: unexpected OCCN\n"); return 0; } - conn->state2 = STATE_ESTB; + conn->sess.state2 = STATE_ESTB; return 0; } static int l2tp_recv_CDN(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) { - if (ntohs(pack->hdr.sid) != conn->sid) { + if (ntohs(pack->hdr.sid) != conn->sess.sid) { if (conf_verbose) log_warn("l2tp: sid %i is incorrect\n", ntohs(pack->hdr.sid)); return 0; @@ -901,7 +911,7 @@ static int l2tp_recv_CDN(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack) if (conn->state == STATE_PPP) { __sync_sub_and_fetch(&stat_active, 1); conn->state = STATE_FIN; - ppp_terminate(&conn->ppp, TERM_USER_REQUEST, 1); + ppp_terminate(&conn->sess.ppp, TERM_USER_REQUEST, 1); } if (l2tp_terminate(conn, 0, 0)) -- 1.7.10.4 |
From: Guillaume N. <g....@al...> - 2012-08-14 17:22:59
|
The following patch series allows a LAC to establish several sessions per L2TP tunnel. Patches 01 to 13 separate session specific operations from tunnel ones, and patch 14 actually implements session multiplexing. The full series is bisectable and applies on the 1.7 branch. Session multiplexing is implemented in the following way: -Tunnels share their triton context with all their sessions. -Each tunnel stores its sessions in a binary search tree where ordering is based on the session ID. -A new mempool is used for allocating sessions. -Tunnels are automatically closed after their last session has been shut down. A few limitations remain: -Logging with log_ppp_*() gives less information because it is not possible anymore to automatically pass the PPP structure to log_switch in the before_switch() callback (see patch 02). -The session establishment timeout, which spanned from the SCCRP to the ICCN, has been replaced by two timeouts: one for the tunnel (spans from SCCRP to SCCCN) and one for the session (spans from ICRP to ICCN). This means that there is no active timeout after the SCCCN is processed and a tunnel will remain opened if no ICRQ is sent from the LAC (see patch 13). It may be valuable to use inactivity timeouts for tunnels and sessions instead. -During session allocation, if the randomly generated session ID is already used by another session in the same tunnel, the allocation is cancelled and session establishment request is rejected, even if enough resources were available to handle that new session. Of course, the more sessions in a tunnel, the likelier this situation may occur (see patch 14). Comments and feedbacks welcomed. Guillaume Nault (14): L2TP: Add new structure to store session spectific data L2TP: Add session specific allocation function L2TP: Define and use dedicated function to free sessions L2TP: Rename function that frees connection strutures L2TP: Separate session and tunnel connection code L2TP: Use different states for handling sessions and tunnels L2TP: Terminate sessions without closing tunnel L2TP: Add standalone StopCCN message sending function L2TP: Start sending HELLO messages upon tunnel connection L2TP: Close only session (not tunnel) after a PPP disconnection L2TP: Modify prototype of functions acting only on sessions L2TP: Allocate new sessions after receiving ICRQ messages L2TP: Use different connection timers for tunnels and sessions L2TP: Handle multiple sessions per tunnel accel-pppd/ctrl/l2tp/l2tp.c | 608 ++++++++++++++++++++++++++++++------------- 1 file changed, 421 insertions(+), 187 deletions(-) -- 1.7.10.4 |
From: Dmitry K. <xe...@ma...> - 2012-07-29 05:50:22
|
Fri, 27 Jul 2012 21:38:26 +0200 от "Piotrek S." <ko...@gm...>: > Hi, > > I trying to configure accel-ppp with log_pgsql but with no successful :/ > > Can anyone have running config with log_pgsql ? > > I tried many combinations of conninfo parameter in config file... but it > is not running. > > Thanks for any suggestions. > > Regards Hi, Did you include log_pgsql to [modules] ? |
From: Piotrek S. <ko...@gm...> - 2012-07-27 19:38:37
|
Hi, I trying to configure accel-ppp with log_pgsql but with no successful :/ Can anyone have running config with log_pgsql ? I tried many combinations of conninfo parameter in config file... but it is not running. Thanks for any suggestions. Regards |
From: Dmitry K. <xe...@ma...> - 2012-07-13 06:27:01
|
Applied. Thanks. Thu, 12 Jul 2012 15:21:37 +0200 от Guillaume Nault <g....@al...>: This patch series (for the 1.7 branch) fixes a few shortcomings in the way l2tp_connect() detects and handles errors. It ensures that ppp and l2tp tunnel sockets get properly created (with the FD_CLOEXEC flag set) and that cleanup is done in case of failure. Guillaume Nault (3): L2TP: Fix socket() error handling in l2tp_connect() L2TP: Close sockets opened by l2tp_connect() upon failure L2TP: Check for fcntl() errors in l2tp_connect() accel-pppd/ctrl/l2tp/l2tp.c | 60 +++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 16 deletions(-) -- 1.7.10.4 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Accel-ppp-users mailing list Acc...@li... https://lists.sourceforge.net/lists/listinfo/accel-ppp-users |
From: Guillaume N. <g....@al...> - 2012-07-12 13:22:46
|
Add error detection to ensure the FD_CLOEXEC flag gets set for every new socket. Signed-off-by: Guillaume Nault <g....@al...> --- accel-pppd/ctrl/l2tp/l2tp.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 469492d..fa76048 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -374,6 +374,7 @@ static int l2tp_connect(struct l2tp_conn_t *conn) { struct sockaddr_pppol2tp pppox_addr; int arg = 1; + int flg; memset(&pppox_addr, 0, sizeof(pppox_addr)); pppox_addr.sa_family = AF_PPPOX; @@ -388,8 +389,17 @@ static int l2tp_connect(struct l2tp_conn_t *conn) log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); goto out_err; } - - fcntl(conn->tunnel_fd, F_SETFD, fcntl(conn->tunnel_fd, F_GETFD) | FD_CLOEXEC); + + flg = fcntl(conn->tunnel_fd, F_GETFD); + if (flg < 0) { + log_ppp_error("l2tp: fcntl(F_GETFD): %s\n", strerror(errno)); + goto out_err; + } + flg = fcntl(conn->tunnel_fd, F_SETFD, flg | FD_CLOEXEC); + if (flg < 0) { + log_ppp_error("l2tp: fcntl(F_SETFD): %s\n", strerror(errno)); + goto out_err; + } conn->ppp.fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); if (conn->ppp.fd < 0) { @@ -397,7 +407,16 @@ static int l2tp_connect(struct l2tp_conn_t *conn) goto out_err; } - fcntl(conn->ppp.fd, F_SETFD, fcntl(conn->ppp.fd, F_GETFD) | FD_CLOEXEC); + flg = fcntl(conn->ppp.fd, F_GETFD); + if (flg < 0) { + log_ppp_error("l2tp: fcntl(F_GETFD): %s\n", strerror(errno)); + goto out_err; + } + flg = fcntl(conn->ppp.fd, F_SETFD, flg | FD_CLOEXEC); + if (flg < 0) { + log_ppp_error("l2tp: fcntl(F_SETFD): %s\n", strerror(errno)); + goto out_err; + } if (connect(conn->tunnel_fd, (struct sockaddr *)&pppox_addr, sizeof(pppox_addr)) < 0) { log_ppp_error("l2tp: connect(tunnel): %s\n", strerror(errno)); @@ -418,7 +437,7 @@ static int l2tp_connect(struct l2tp_conn_t *conn) } conn->ppp.chan_name = _strdup(inet_ntoa(conn->addr.sin_addr)); - + triton_event_fire(EV_CTRL_STARTED, &conn->ppp); if (establish_ppp(&conn->ppp)) -- 1.7.10.4 |
From: Guillaume N. <g....@al...> - 2012-07-12 13:22:32
|
Centralise error management to ensure full cleanup upon failure. Signed-off-by: Guillaume Nault <g....@al...> --- accel-pppd/ctrl/l2tp/l2tp.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 5bba25e..469492d 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -386,24 +386,22 @@ static int l2tp_connect(struct l2tp_conn_t *conn) conn->tunnel_fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); if (conn->tunnel_fd < 0) { log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); - return -1; + goto out_err; } fcntl(conn->tunnel_fd, F_SETFD, fcntl(conn->tunnel_fd, F_GETFD) | FD_CLOEXEC); conn->ppp.fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); if (conn->ppp.fd < 0) { - close(conn->tunnel_fd); - conn->tunnel_fd = -1; log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); - return -1; + goto out_err; } fcntl(conn->ppp.fd, F_SETFD, fcntl(conn->ppp.fd, F_GETFD) | FD_CLOEXEC); if (connect(conn->tunnel_fd, (struct sockaddr *)&pppox_addr, sizeof(pppox_addr)) < 0) { log_ppp_error("l2tp: connect(tunnel): %s\n", strerror(errno)); - return -1; + goto out_err; } pppox_addr.pppol2tp.s_session = conn->sid; @@ -411,12 +409,12 @@ static int l2tp_connect(struct l2tp_conn_t *conn) if (connect(conn->ppp.fd, (struct sockaddr *)&pppox_addr, sizeof(pppox_addr)) < 0) { log_ppp_error("l2tp: connect(session): %s\n", strerror(errno)); - return -1; + goto out_err; } if (setsockopt(conn->ppp.fd, SOL_PPPOL2TP, PPPOL2TP_SO_LNSMODE, &arg, sizeof(arg))) { log_ppp_error("l2tp: setsockopt: %s\n", strerror(errno)); - return -1; + goto out_err; } conn->ppp.chan_name = _strdup(inet_ntoa(conn->addr.sin_addr)); @@ -424,14 +422,25 @@ static int l2tp_connect(struct l2tp_conn_t *conn) triton_event_fire(EV_CTRL_STARTED, &conn->ppp); if (establish_ppp(&conn->ppp)) - return -1; + goto out_err; __sync_sub_and_fetch(&stat_starting, 1); __sync_add_and_fetch(&stat_active, 1); conn->state = STATE_PPP; - + return 0; + +out_err: + if (conn->tunnel_fd >= 0) { + close(conn->tunnel_fd); + conn->tunnel_fd = -1; + } + if (conn->ppp.fd >= 0) { + close(conn->ppp.fd); + conn->ppp.fd = -1; + } + return -1; } static void l2tp_rtimeout(struct triton_timer_t *t) -- 1.7.10.4 |
From: Guillaume N. <g....@al...> - 2012-07-12 13:22:27
|
Check if the tunnel file descriptor has been successfully created. Explicitely check for negative values to detect socket() errors. Signed-off-by: Guillaume Nault <g....@al...> --- accel-pppd/ctrl/l2tp/l2tp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index d8a98f8..5bba25e 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -384,7 +384,7 @@ static int l2tp_connect(struct l2tp_conn_t *conn) pppox_addr.pppol2tp.d_tunnel = conn->peer_tid; conn->tunnel_fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); - if (!conn->ppp.fd) { + if (conn->tunnel_fd < 0) { log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); return -1; } @@ -392,13 +392,13 @@ static int l2tp_connect(struct l2tp_conn_t *conn) fcntl(conn->tunnel_fd, F_SETFD, fcntl(conn->tunnel_fd, F_GETFD) | FD_CLOEXEC); conn->ppp.fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); - if (!conn->ppp.fd) { + if (conn->ppp.fd < 0) { close(conn->tunnel_fd); conn->tunnel_fd = -1; log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); return -1; } - + fcntl(conn->ppp.fd, F_SETFD, fcntl(conn->ppp.fd, F_GETFD) | FD_CLOEXEC); if (connect(conn->tunnel_fd, (struct sockaddr *)&pppox_addr, sizeof(pppox_addr)) < 0) { -- 1.7.10.4 |
From: Guillaume N. <g....@al...> - 2012-07-12 13:21:49
|
This patch series (for the 1.7 branch) fixes a few shortcomings in the way l2tp_connect() detects and handles errors. It ensures that ppp and l2tp tunnel sockets get properly created (with the FD_CLOEXEC flag set) and that cleanup is done in case of failure. Guillaume Nault (3): L2TP: Fix socket() error handling in l2tp_connect() L2TP: Close sockets opened by l2tp_connect() upon failure L2TP: Check for fcntl() errors in l2tp_connect() accel-pppd/ctrl/l2tp/l2tp.c | 60 +++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 16 deletions(-) -- 1.7.10.4 |
From: Dmitry K. <xe...@ma...> - 2012-07-06 21:34:47
|
Hi, I didn't think about it, but if you are interesting this things, they will be implemented. |
From: Guillaume N. <g....@al...> - 2012-07-06 16:53:35
|
Hi, First of all, thanks to accel-ppp developers for all the good work. Accel-ppp has many interesting features, but after a few tests I've realised that it can only handle one L2TP session per tunnel. I'd be very much interested in session multiplexing support. I can help in implementing it. Is anyone interested upstream? Or are there any plans already for implementing session multiplexing? I have the same questions for LAC support. I guess many people would be interested in those features. Best regards -- Guillaume Nault |
From: Dmitry K. <xe...@ma...> - 2012-06-29 17:55:35
|
Applied. Thanks. |
From: Guillaume N. <g....@al...> - 2012-06-29 15:49:16
|
Hi, The attached patch allows compiling accel-ppp from git tree, even when the git "color.diff" option is set to "always". The original issue is that when git is configured to always use coloured outputs, the commit hash used to set ACCEL_PPP_VERSION is followed by an SGR escape code. This code then gets misinterpreted by the rest of the build scripts, ultimately resulting in compilation errors. This patch disables the Git's coloured output when retrieving the commit hash used to set ACCEL_PPP_VERSION. |
From: Dmitry K. <xe...@ma...> - 2012-06-28 04:05:40
|
Hi. Use cli command 'reload' for it. But please note, unfortunately it doesn't do full reload, some option changes needs full restart. Thu, 28 Jun 2012 09:18:55 +0800 от Martin Lambev <fs...@gm...>: Hello Dmitry, Thank you for excellent work on accel-ppp and giving such a piece of art to the World! I have a quick question: (short ver.) is there way to keep connected users if I change settings in accel-ppp.conf? Long explanation: Whenever I make changes on accel-ppp.conf and invoke service accel-ppp restart all connected users are disconnected, is there way to "gracefully" refresh accel-pppd with new configuration without disconnecting all connected users? Thank you. Martin ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Accel-ppp-users mailing list Acc...@li... https://lists.sourceforge.net/lists/listinfo/accel-ppp-users |
From: Martin L. <fs...@gm...> - 2012-06-28 01:19:08
|
Hello Dmitry, Thank you for excellent work on accel-ppp and giving such a piece of art to the World! I have a quick question: (short ver.) is there way to keep connected users if I change settings in accel-ppp.conf? Long explanation: Whenever I make changes on accel-ppp.conf and invoke service accel-ppp restart all connected users are disconnected, is there way to "gracefully" refresh accel-pppd with new configuration without disconnecting all connected users? Thank you. Martin |
From: Mastan V. S. <skm...@gm...> - 2012-05-25 17:30:07
|
Thank you Dmitry. On Fri, May 25, 2012 at 10:02 AM, Dmitry Kozlov <xe...@ma...> wrote: > [client-ip-range] > disable > > |
From: Dmitry K. <xe...@ma...> - 2012-05-25 17:02:36
|
[client-ip-range] disable |
From: Mastan V. S. <skm...@gm...> - 2012-05-25 00:35:19
|
Hi, acccel-ppp.conf expects a valid [client-ip-range] configuration. is there any way to allow any client to connect? if not, is there any reason for that restriction? Thanks, Vali. |
From: Dmitry K. <xe...@ma...> - 2012-03-23 03:24:11
|
>I think i can use "bind" option under [l2tp] section for this purpose. >please let me know if that is wrong option to use or if it has any internal limitation. Hi. Yes, it is right option. |
From: Mastan V. S. <skm...@gm...> - 2012-03-22 23:27:27
|
I think i can use "bind" option under [l2tp] section for this purpose. please let me know if that is wrong option to use or if it has any internal limitation. Thanks, Vali. |
From: Mastan V. S. <skm...@gm...> - 2012-03-22 21:45:57
|
Hi, Is there any configuration option to restrict L2TP server to listen on specific interface(s) only? There is an interface option in [pppoe] section. i am looking for similar option for L2TP section. Thanks, Vali. |
From: Mastan V. S. <skm...@gm...> - 2012-03-22 21:37:51
|
i think accel-ppp does not have L2TP client (LAC) support. in response to *[Accel-ppp-users] Why accelppp implementing only server version of protocols? <https://sourceforge.net/mailarchive/message.php?msg_id=28795076> * From: lexa <lexa@cf...> - 2012-02-06 17:21 Hi. I heard that accel-ppp is much faster then userspace realization of l2tp(such as xl2tp). But i can't realize how to make accel-pptp work as a l2tp client. I belive that ppp protocol don't make much difference between client and server. So can you explain how to configure accel-ppp as simple end-user l2tp client, without radius,snmp,custom logging, just connect to l2tp server and receive ip settings from him. |
From: lexa <le...@cf...> - 2012-02-06 17:21:17
|
Hi. I heard that accel-ppp is much faster then userspace realization of l2tp(such as xl2tp). But i can't realize how to make accel-pptp work as a l2tp client. I belive that ppp protocol don't make much difference between client and server. So can you explain how to configure accel-ppp as simple end-user l2tp client, without radius,snmp,custom logging, just connect to l2tp server and receive ip settings from him. |
From: lexa <le...@cf...> - 2012-02-06 17:21:08
|
Hi. I heard that accel-ppp is much faster then userspace realization of l2tp(such as xl2tp). But i can't realize how to make accel-pptp work as a l2tp client. I belive that ppp protocol don't make much difference between client and server. So can you explain how to configure accel-ppp as simple end-user l2tp client, without radius,snmp,custom logging, just connect to l2tp server and receive ip settings from him. |