From 0cba196c4e8d02c5d96d9eb945583869afde5d2d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 6 Mar 2018 18:28:27 +0100 Subject: trafgen: don't close dev_out and dev_in in parent process They are opened in main_loop which is only executed in the child(ren), so close them there again. This avoids closing the devices twice, which may lead to segfaults. Fixes #188 Signed-off-by: Tobias Klauser --- trafgen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trafgen.c b/trafgen.c index 2897880..0996703 100644 --- a/trafgen.c +++ b/trafgen.c @@ -976,6 +976,10 @@ static void main_loop(struct ctx *ctx, char *confname, bool slow, else xmit_fastpath_or_die(ctx, cpu, orig_num); + dev_io_close(ctx->dev_out); + if (ctx->dev_in) + dev_io_close(ctx->dev_in); + cleanup_packets(); } @@ -1354,10 +1358,6 @@ thread_out: if (dev_io_is_netdev(ctx.dev_out) && set_irq_aff) device_restore_irq_affinity_list(); - dev_io_close(ctx.dev_out); - if (ctx.dev_in) - dev_io_close(ctx.dev_in); - argv_free(cpp_argv); free(ctx.device); free(ctx.rhost); -- cgit v1.2.3-54-g00ecf