summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/l2tp/l2tp.c
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2013-04-09 21:42:58 +0200
committerDmitry Kozlov <xeb@mail.ru>2013-04-17 09:06:35 +0400
commit76f30e4e2d664d3c10f988b8d9660b478718c777 (patch)
treebff356098315db7e3080aa61f67dc2324f063df0 /accel-pppd/ctrl/l2tp/l2tp.c
parent95c7a75fe8405832dfae02d787afffb54bc1f70e (diff)
downloadaccel-ppp-76f30e4e2d664d3c10f988b8d9660b478718c777.tar.gz
accel-ppp-76f30e4e2d664d3c10f988b8d9660b478718c777.zip
l2tp: Handle incoming hidden AVPs
Decode hidden AVPs on reception. This is transparent for functions in l2tp.c (except for the presence of the Random Vector AVP). Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/ctrl/l2tp/l2tp.c')
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 455e1a15..267a47f8 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -1963,6 +1963,8 @@ static int l2tp_recv_SCCRQ(const struct l2tp_serv_t *serv,
list_for_each_entry(attr, &pack->attrs, entry) {
switch (attr->attr->id) {
+ case Random_Vector:
+ break;
case Protocol_Version:
protocol_version = attr;
break;
@@ -2080,6 +2082,7 @@ static int l2tp_recv_SCCRP(struct l2tp_conn_t *conn,
list_for_each_entry(attr, &pack->attrs, entry) {
switch (attr->attr->id) {
case Message_Type:
+ case Random_Vector:
case Host_Name:
case Bearer_Capabilities:
case Firmware_Revision:
@@ -2215,6 +2218,7 @@ static int l2tp_recv_SCCCN(struct l2tp_conn_t *conn,
list_for_each_entry(attr, &pack->attrs, entry) {
switch (attr->attr->id) {
case Message_Type:
+ case Random_Vector:
break;
case Challenge_Response:
challenge_resp = attr;
@@ -2313,6 +2317,7 @@ static int l2tp_recv_StopCCN(struct l2tp_conn_t *conn,
list_for_each_entry(attr, &pack->attrs, entry) {
switch(attr->attr->id) {
case Message_Type:
+ case Random_Vector:
break;
case Assigned_Tunnel_ID:
assigned_tid = attr;
@@ -2426,6 +2431,7 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn,
assigned_sid = attr;
break;
case Message_Type:
+ case Random_Vector:
case Call_Serial_Number:
case Bearer_Type:
case Calling_Number:
@@ -2520,6 +2526,7 @@ static int l2tp_recv_ICRP(struct l2tp_sess_t *sess,
list_for_each_entry(attr, &pack->attrs, entry) {
switch(attr->attr->id) {
case Message_Type:
+ case Random_Vector:
break;
case Assigned_Session_ID:
assigned_sid = attr;
@@ -2677,6 +2684,7 @@ static int l2tp_recv_OCRQ(struct l2tp_conn_t *conn,
list_for_each_entry(attr, &pack->attrs, entry) {
switch (attr->attr->id) {
case Message_Type:
+ case Random_Vector:
case Call_Serial_Number:
case Minimum_BPS:
case Maximum_BPS:
@@ -2776,6 +2784,7 @@ static int l2tp_recv_OCRP(struct l2tp_sess_t *sess,
list_for_each_entry(attr, &pack->attrs, entry) {
switch(attr->attr->id) {
case Message_Type:
+ case Random_Vector:
break;
case Assigned_Session_ID:
assigned_sid = attr;
@@ -2839,6 +2848,7 @@ static int l2tp_recv_OCCN(struct l2tp_sess_t *sess,
list_for_each_entry(attr, &pack->attrs, entry) {
switch (attr->attr->id) {
case Message_Type:
+ case Random_Vector:
case TX_Speed:
case Framing_Type:
break;
@@ -2903,6 +2913,7 @@ static int l2tp_recv_CDN(struct l2tp_sess_t *sess,
list_for_each_entry(attr, &pack->attrs, entry) {
switch(attr->attr->id) {
case Message_Type:
+ case Random_Vector:
break;
case Assigned_Session_ID:
assigned_sid = attr;
@@ -3114,7 +3125,8 @@ static int l2tp_conn_read(struct triton_md_handler_t *h)
int res;
while (1) {
- res = l2tp_recv(h->fd, &pack, NULL);
+ res = l2tp_recv(h->fd, &pack, NULL,
+ conf_secret, conf_secret_len);
if (res) {
if (res == -2) {
log_tunnel(log_info1, conn,
@@ -3321,7 +3333,8 @@ static int l2tp_udp_read(struct triton_md_handler_t *h)
char src_addr[17];
while (1) {
- if (l2tp_recv(h->fd, &pack, &pkt_info))
+ if (l2tp_recv(h->fd, &pack, &pkt_info,
+ conf_secret, conf_secret_len) < 0)
break;
if (!pack)