diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-23 00:32:17 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-23 00:32:17 +0100 |
commit | fe3433784f55ece5690746d1921b1d8f333d249e (patch) | |
tree | 28cdff9d92fef26ec9ada6155429934899239ef7 | |
parent | d2accfd480e58c67da672c92868724eb66cbce77 (diff) | |
download | fastd-fe3433784f55ece5690746d1921b1d8f333d249e.tar fastd-fe3433784f55ece5690746d1921b1d8f333d249e.zip |
iface: discard empty packets
-rw-r--r-- | src/iface.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; } |