trafgen: fix packet socket initialization with multiple CPUs
commit443d97581b9b715b8f40ae35fdeaf272caa296a4
authorPaolo Abeni <pabeni@redhat.com>
Wed, 13 Sep 2017 15:54:52 +0000 (13 17:54 +0200)
committerTobias Klauser <tklauser@distanz.ch>
Fri, 15 Sep 2017 06:41:02 +0000 (15 08:41 +0200)
treeb558429433a627ec9c03f348bcdd668fa4568686
parent285ac73006e2e4af6e0e4cb0eaa178b13cdcba8f
trafgen: fix packet socket initialization with multiple CPUs

The commit 78c13b71e196 ("trafgen: Allow to generate packets
to output pcap file") introduced a regression when output is
a network device and multiple CPU are in use: the packet
socket is created before fork() and thus the socket is shared
among all the processes: all of them except the first will
fail while setting the tx_ring.

Fix it splitting the io open() helper in a create() op,
called before forking, and the open() op called by each process.

Fixes: 78c13b71e196 ("trafgen: Allow to generate packets to output pcap file")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
trafgen.c
trafgen_dev.c
trafgen_dev.h