summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2018-03-06 18:28:27 +0100
committerTobias Klauser <tklauser@distanz.ch>2018-03-06 18:28:27 +0100
commit0cba196c4e8d02c5d96d9eb945583869afde5d2d (patch)
treeafe99fa0e00b36696cbea274e65b07dce7b26f65
parent44ceece354c50795ba04e450b9269e6e3f92dd34 (diff)
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 <tklauser@distanz.ch>
-rw-r--r--trafgen.c8
1 files 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);