diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-05-22 13:30:30 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-05-22 13:30:30 +0400 |
commit | 0d19e3bbe4ed663c3cdd4aeb666df782cd81c35c (patch) | |
tree | 1a82f853d00ccaa7c4e04da6472658bb9bfc0ad4 | |
parent | cf358fcdc57dd52d30ca490b1164d832cf11fe8b (diff) | |
download | accel-ppp-xebd-0d19e3bbe4ed663c3cdd4aeb666df782cd81c35c.tar.gz accel-ppp-xebd-0d19e3bbe4ed663c3cdd4aeb666df782cd81c35c.zip |
Some AVP we are not handling yet, and it is better to provide option
to ignore them, instead of refusing connection.
Signed-off-by: Denys Fedoryshchenko <denys@visp.net.lb>
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 5 | ||||
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.h | 1 | ||||
-rw-r--r-- | accel-pppd/ctrl/l2tp/packet.c | 17 |
3 files changed, 17 insertions, 6 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 50523cf..d8a98f8 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -47,6 +47,7 @@ #define STATE_CLOSE 0 int conf_verbose = 0; +int conf_avp_permissive = 0; static int conf_timeout = 60; static int conf_rtimeout = 5; static int conf_retransmit = 5; @@ -1157,6 +1158,10 @@ static void load_config(void) if (opt && atoi(opt) > 0) conf_verbose = 1; + opt = conf_get_opt("l2tp", "avp_permissive"); + if (opt && atoi(opt) > 0) + conf_avp_permissive = 1; + opt = conf_get_opt("l2tp", "hello-interval"); if (opt && atoi(opt) > 0) conf_hello_interval = atoi(opt); diff --git a/accel-pppd/ctrl/l2tp/l2tp.h b/accel-pppd/ctrl/l2tp/l2tp.h index ac9b8e0..8a8cffd 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.h +++ b/accel-pppd/ctrl/l2tp/l2tp.h @@ -66,6 +66,7 @@ struct l2tp_packet_t }; extern int conf_verbose; +extern int conf_avp_permissive; struct l2tp_dict_attr_t *l2tp_dict_find_attr_by_name(const char *name); struct l2tp_dict_attr_t *l2tp_dict_find_attr_by_id(int id); diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index d312118..f8a46e7 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -172,19 +172,22 @@ int l2tp_recv(int fd, struct l2tp_packet_t **p, struct in_pktinfo *pkt_info) if (hdr->L == 0) { if (conf_verbose) log_warn("l2tp: incorrect message received (L=0)\n"); - goto out_err_hdr; + if (!conf_avp_permissive) + goto out_err_hdr; } if (hdr->S == 0) { if (conf_verbose) log_warn("l2tp: incorrect message received (S=0)\n"); - goto out_err_hdr; + if (!conf_avp_permissive) + goto out_err_hdr; } if (hdr->O == 1) { if (conf_verbose) log_warn("l2tp: incorrect message received (O=1)\n"); - goto out_err_hdr; + if (!conf_avp_permissive) + goto out_err_hdr; } } else if (hdr->ver != 3) { if (conf_verbose) @@ -222,19 +225,21 @@ int l2tp_recv(int fd, struct l2tp_packet_t **p, struct in_pktinfo *pkt_info) if (!da) { if (conf_verbose) log_warn("l2tp: unknown avp received (type=%i, M=%u)\n", ntohs(avp->type), avp->M); - if (avp->M) + if (avp->M && !conf_avp_permissive) goto out_err; } else { if (da->M != -1 && da->M != avp->M) { if (conf_verbose) log_warn("l2tp: incorrect avp received (type=%i, M=%i, must be %i)\n", ntohs(avp->type), avp->M, da->M); - goto out_err; + if (!conf_avp_permissive) + goto out_err; } if (da->H != -1 && da->H != avp->H) { if (conf_verbose) log_warn("l2tp: incorrect avp received (type=%i, H=%i, must be %i)\n", ntohs(avp->type), avp->H, da->H); - goto out_err; + if (!conf_avp_permissive) + goto out_err; } if (avp->H) { |