trafgen: Use strtoul() instead of strtol() for unsigned long

If setting an unsigned long variable, use strtoul() instead of strtol().

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
netsniff-ng: Fix whitespaces

Remove some leading/trailing whitespaces.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
trafgen: Don't expose -k/--kernel-pull anymore and warn if it still used

The -k/--kernel-pull option got useless with commit c139e80 ("trafgen:
remove timer-based trigger model"). Instead of entirely removing it and
thus possibly breaking people's scripts, still accept it as an option,
but warn the user about it. We might want to remove the option in a
future release.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
ring: Consistently use size_t to specify ring size

The mm_len member of struct ring is of type size_t, but in the code
paths leading to set it, unsigned int is used. In circumstances where
unsigned int is 32 bit and size_t is 64 bit, this could lead to an
integer overflow, which causes an improper ring size being mmap()'ed in
mmap_ring_generic().

In order to prevent this, consistently use size_t to store the ring
size, since this is also what mmap() takes as its `length' parameter.

This now allows to specify ring sizes larger than 4 GiB for both
netsniff-ng and trafgen (fixes #90).

Reported-by: Jon Schipp <jonschipp@gmail.com>
Reported-by: Michał Purzyński <michalpurzynski1@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
netsniff-ng: Use while() instead of empty for

Instead of using a foor loop with empty initialization and afterthought,
just use a while loop with the same condition.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
netsniff-ng/ring: Make verbose flag bool

Change type of verbose flag from int to bool.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Merge remote-tracking branch 'upstream/master'
build: Do not add PREFIX to ETCDIR

This will fix issue of installation of configuration files to
/usr/local/etc (or /usr/etc for distribution builds) instead of /etc.

[tklauser: extended description a bit]

Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
Merge remote-tracking branch 'upstream/master'