From 2ec544149c3c09aa5a64660cc740e4e04044c11c Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 16 Feb 2017 17:47:01 +0800 Subject: [PATCH] Increased maximum frame size to accomodate jumbo frames + some check we don't go over again. --- hypervisor_iol_bridge.c | 6 ++++++ nio.h | 2 +- ubridge.c | 6 ++++++ ubridge.h | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hypervisor_iol_bridge.c b/hypervisor_iol_bridge.c index 9174b4d..fc225c3 100644 --- a/hypervisor_iol_bridge.c +++ b/hypervisor_iol_bridge.c @@ -75,6 +75,12 @@ void *iol_nio_listener(void *data) perror("recv"); break; } + + if (bytes_received > MAX_MTU) { + fprintf(stderr, "received frame is %zd bytes (maximum is %d bytes)\n", bytes_received, MAX_MTU); + continue; + } + nio->bytes_sent += bytes_received; if (debug_level > 0) { diff --git a/nio.h b/nio.h index 1fd2234..589aae7 100644 --- a/nio.h +++ b/nio.h @@ -27,7 +27,7 @@ #define m_min(a,b) (((a) < (b)) ? (a) : (b)) -#define NIO_MAX_PKT_SIZE 2048 +#define NIO_MAX_PKT_SIZE 10000 #define NIO_DEV_MAXLEN 64 enum { diff --git a/ubridge.c b/ubridge.c index b22e997..e8d87ac 100644 --- a/ubridge.c +++ b/ubridge.c @@ -54,6 +54,12 @@ static void bridge_nios(nio_t *source_nio, nio_t *destination_nio, bridge_t *bri perror("recv"); break; } + + if (bytes_received > NIO_MAX_PKT_SIZE) { + fprintf(stderr, "received frame is %zd bytes (maximum is %d bytes)\n", bytes_received, NIO_MAX_PKT_SIZE); + continue; + } + source_nio->bytes_sent += bytes_received; if (debug_level > 0) { diff --git a/ubridge.h b/ubridge.h index fa77dae..cbf3af5 100644 --- a/ubridge.h +++ b/ubridge.h @@ -35,7 +35,7 @@ #include "nio.h" #define NAME "ubridge" -#define VERSION "0.9.10" +#define VERSION "0.9.11" #define CONFIG_FILE "ubridge.ini" #ifndef FALSE