csum: move p4_csum into csum.h

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
curvetun: Added error reporting for mal-formed tcp/udp carrier types

I personally had mis-spelled udp (upd) and found myself diving into source
to determine why tcp was repeatedly being used instead of udp.

I'm uncertain whether the general lack of error checking and reporting
is intentional, or simply due to the very large task of getting the tools
up and running.

Further, if error checking is to be done on parameters and inputs, I'm
personally uneducated on the best method for reporting them.  I assumed
syslog(), as that is used frequently in setup/teardown messaging for
curvetun.  Is the inclusion of syslog.h reasonable here?
Merge pull request #53 from electronjoe/curvetun-udp-tcp-server-spec-check

curvetun: Added error reporting for mal-formed tcp/udp carrier types
Merge branch 'master' of github.com:borkmann/netsniff-ng
xio: redirect stdout, stderr to syslog in daemon mode

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
xio: minor: rename variable

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Improved error reporting in xio

How portable is strerror? Assuming it is... This patch provides more robust
failure mode reporting in xio.

Pre patch:
curvetun[15819]: ioctl screwed up!

Post patch:
curvetun[15819]: ioctl screwed up! Operation not permitted.
Corrected spinning loop potential in getrandombytes

Client was unable to start due to repeated loop execution.

Successful file descriptor opening of /dev/urandom had no
impact on loop execution, preventing the client from moving on.

Signed-off-by: Scott Moeller <electronjoe@gmail.com>
docs: add Scott to authors

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
curvetun: Fied client initial message padding randomization

secrand() returns a signed integer, which was being taken modulo
200 and used as a padding amount for the connection initialization.

When the result was negative this resulted in a negative padding
amount, which subsequently caused segmentation fault during memset.

Signed-off-by: Scott Moeller <electronjoe@gmail.com>
xio: secrand: test for -1

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
trafgen: simplify built-in example

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
curvetun: Enhanced server connect and disconnect syslog messages

Made the messages a bit clearer for the average user, who may
be unaware (or not care) that there are four file descriptors
always open in addition to the number of active connections.

Old connect/disconnect messages:
curvetun[25448]: New connection from 68.107.99.106:41208 with id 15 on CPU0, 5 active!
curvetun[25448]: Closed connection with id 15, 4 active!

New connect message:
curvetun[16247]: New connection from 68.107.99.106:36581 (1 active client connections) -  id 15 on CPU0
curvetun[16247]: Closed connection with id 15 (0 active client connections remain)
curvetun: Added graceful handling of SIGTERM signal

This allows friendlier termination of the curvetun daemon,
using kill -9 gets a little harsh (and leaves lock files
lying around).
Merge pull request #58 from electronjoe/a1cf780cccc4819eb360cda1e0e94e17935cb8c7

curvetun: Enhanced server connect / disconnect syslog messaging
Merge pull request #59 from electronjoe/graceful-SIGTERM-handling

curvetun: Added graceful handling of SIGTERM signal
xio: Consistently use tabs for indentation

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
curvetun: simplify signal handler

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>