From faf5bf8a0f40119273b94d8c80bafaaabb3d185e Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Sat, 28 Jan 2017 03:02:22 +0500 Subject: 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. --- accel-pppd/ctrl/l2tp/packet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'accel-pppd/ctrl') 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) -- cgit v1.2.3