diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2017-01-28 03:02:22 +0500 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-12-05 16:53:18 +0300 |
commit | 8b2558d0c5f31ba8b73ac8aa971863c0c988c786 (patch) | |
tree | abeb2f71c3654cf4d9b929566d08825e939a3b83 | |
parent | 3b128243480646fd2ec0fef90a8fc52a277f7ec2 (diff) | |
download | accel-ppp-8b2558d0c5f31ba8b73ac8aa971863c0c988c786.tar.gz accel-ppp-8b2558d0c5f31ba8b73ac8aa971863c0c988c786.zip |
l2tp: skip obsolete session data packets from logging
After session is freed on our end, kernel doesn't bother with possible
incoming data packets and just passes them to userspace, in turn
they are mistreated as short control packets with corresponding errors.
Since there's no special data packet handling, just ignore them.
-rw-r--r-- | accel-pppd/ctrl/l2tp/packet.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index 34e4bb6..455c486 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -289,21 +289,21 @@ int l2tp_recv(int fd, struct l2tp_packet_t **p, struct in_pktinfo *pkt_info, return 0; } - if (n < sizeof(*hdr)) { + if (n < 6) { if (conf_verbose) log_warn("l2tp: short packet received (%i/%zu)\n", n, sizeof(*hdr)); goto out_err_hdr; } + if (hdr->T == 0) + goto out_err_hdr; + if (n < ntohs(hdr->length)) { if (conf_verbose) log_warn("l2tp: short packet received (%i/%i)\n", n, ntohs(hdr->length)); goto out_err_hdr; } - if (hdr->T == 0) - goto out_err_hdr; - if (hdr->ver == 2) { if (hdr->L == 0) { if (conf_verbose) |