trafgen: Fix output pcap file name length trimming
commit6e3a87093dfcd8b4b62685e67b565d842c631da1
authorVadim Kochan <vadim4j@gmail.com>
Mon, 12 Jun 2017 20:55:37 +0000 (12 23:55 +0300)
committerTobias Klauser <tklauser@distanz.ch>
Mon, 19 Jun 2017 09:05:42 +0000 (19 11:05 +0200)
tree5b6b1c93d8ed4bc8c2804ccccedfd5dac584378a
parent78c13b71e196a107eaa4ec00bb40b062929a6a88
trafgen: Fix output pcap file name length trimming

Trim output name to IFNAMSIZ only if the output is a networking device,
otherwise the following error occured if output name is greater then
IFNAMSIZ:

  $ trafgen -n 1 '{ udp() }' -o /tmp/xxxxxxxxxxxxxx.pcap
  No networking device or pcap file: /tmp/xxxxxxxxxx
  Failed to open output device

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
trafgen.c
trafgen_dev.c