summaryrefslogtreecommitdiff
path: root/trafgen.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-06-27 12:03:25 +0300
committerTobias Klauser <tklauser@distanz.ch>2015-06-30 21:36:30 +0200
commitf6b2b535d482084e49ba8787973d8586ed51f563 (patch)
tree0835564347e1858fa620f958f2cb01756f4e25be /trafgen.c
parent8c75168ed5005f70955dd4ade93dec6abf481852 (diff)
trafgen: Print min packet size in error message
Print minimum needed packet size in case if validation error. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen.c')
-rw-r--r--trafgen.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/trafgen.c b/trafgen.c
index 53320fe..93bb1b4 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -138,6 +138,8 @@ struct icmp_filter {
#define SMOKE_N_PROBES 100
+#define PKT_MIN_LEN 14
+
static void signal_handler(int number)
{
switch (number) {
@@ -791,10 +793,11 @@ static int xmit_packet_precheck(struct ctx *ctx, unsigned int cpu)
}
for (mtu = device_mtu(ctx->device), i = 0; i < plen; ++i) {
- if (packets[i].len > mtu + 14)
+ if (packets[i].len > mtu + PKT_MIN_LEN)
panic("Device MTU < than packet%d's size!\n", i);
- if (packets[i].len <= 14)
- panic("Packet%d's size too short!\n", i);
+ if (packets[i].len <= PKT_MIN_LEN)
+ panic("Packet%d's size must be > %d bytes!\n",
+ i, PKT_MIN_LEN);
}
return 0;