From f91b1752029fffce868e3331a23c1c8ee741b372 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Thu, 5 Nov 2015 22:54:05 +0100 Subject: trafgen: let the kernel check min/max transm. unit boundaries Let AF_PACKET do this job to fail in case boundaries are too small or too large. I found it quite useful for testing the kernel. Signed-off-by: Daniel Borkmann --- trafgen.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/trafgen.c b/trafgen.c index 9ecde20..f88db18 100644 --- a/trafgen.c +++ b/trafgen.c @@ -798,9 +798,9 @@ static void __set_state_cd(unsigned int cpu, unsigned long p, sig_atomic_t s) static void xmit_packet_precheck(struct ctx *ctx, unsigned int cpu) { - unsigned int i; unsigned long plen_total, orig = ctx->num; - size_t mtu, total_len = 0; + size_t total_len = 0; + unsigned int i; bug_on(plen != dlen); @@ -822,14 +822,6 @@ static void xmit_packet_precheck(struct ctx *ctx, unsigned int cpu) __set_state(cpu, CPU_STATS_STATE_RES); return; } - - for (mtu = device_mtu(ctx->device), i = 0; i < plen; ++i) { - if (packets[i].len > mtu + PKT_MIN_LEN) - panic("Device MTU < than packet%d's size!\n", i); - if (packets[i].len <= PKT_MIN_LEN) - panic("Packet%d's size must be > %d bytes!\n", - i, PKT_MIN_LEN); - } } static void main_loop(struct ctx *ctx, char *confname, bool slow, -- cgit v1.2.3-54-g00ecf