From fe3433784f55ece5690746d1921b1d8f333d249e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 23 Mar 2015 00:32:17 +0100 Subject: iface: discard empty packets --- src/iface.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/iface.c b/src/iface.c index 5d6fb27..64767c2 100644 --- a/src/iface.c +++ b/src/iface.c @@ -412,6 +412,11 @@ void fastd_iface_handle(fastd_iface_t *iface) { /** Writes a packet to the TUN/TAP device */ void fastd_iface_write(fastd_iface_t *iface, fastd_buffer_t buffer) { + if (!buffer.len) { + pr_debug("fastd_iface_write: truncated packet"); + return; + } + if (multiaf_tun && get_iface_type() == IFACE_TYPE_TUN) { uint8_t version = *((uint8_t *)buffer.data) >> 4; uint32_t af; @@ -426,7 +431,7 @@ void fastd_iface_write(fastd_iface_t *iface, fastd_buffer_t buffer) { break; default: - pr_warn("fastd_iface_write: unknown IP version %u", version); + pr_debug("fastd_iface_write: unknown IP version %u", version); return; } -- cgit v1.2.3