build: Change return type of main in configure compile test programs

When running the configure script with `CC=clang ./configure' clang
fails all the compile test programs due to the main() function not
having return type int. Change it, so we can use clang as a compiler in
the configure script.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
build: travis: Re-enable clang and also use it for configure

Make sure we also use clang for the compile tests in the configure
script.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
build: Detect compiler (gcc or clang) and filter out compiler flags

Create a make variable $(COMPILER) which is set to either `gcc' or
`clang' depending on the compiler used. Use this variable to filter out
command line options not supported by clang (for now only
-fno-delete-null-pointer-checks).

Compiler detection snippet extracted from the Linux kernel Makefile.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
flowtop: Simplify entry skip logic

Instead of testing three skip conditions for every entry, make use of
the short-circuit evaluation of the boolean OR operator to only test as
few conditions as necessary.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
flowtop: Use integer conversion to determine PID proc entries

Try to convert the directory entry name to an unsigned integer with
strtoul() instead of using strspn() to determine if a proc entry is a
PID. If it is a valid PID (i.e. strtoul returned a value != 0), we can
directly use it to pass into walk_process() and there set
flow_entry->proc_num.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
build: Don't overwrite CC variable

Don't reset the variable CC in the Makefile, but set it to gcc by
default (can be overriden when e.g. compiling with `make CC=clang').
This way we can also have non-verbose compiles with compilers other than
gcc. Furthermore make sure that the CC variable is also respected for
LD.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
netsniff-ng: Remove useless check for ctx.device_in

If ctx.device_in is NULL after option parsing, it is always set to
"any", which is before this check. Thus, it serves no purpose and can be
removed.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
sock: Error out if setting of the system socket memory fails

Currently we ignore the return value of the write() calls to
/proc/sys/net/core/{r,w}mem_{default,max} in set_system_socket_mem().
Better check the return value and notify the user about it.

This also fixes a clang compiler warning about a variable explicitely
assigned to itself.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
dissector: Don't re-initialize packet_types array

Both sparse and clang warn about the initializers overriding previous
initialization of the packet_types array. Since every access of the
packet_types array checks the value for NULL (the default value, since the
array is static) and prints a "?" if it isNULL, we don't need the prior
initialization with "?".

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
dissectors: 80211_mac_hdr: Fix clang warning

clang gives the following warning about function meas_type():

proto_80211_mac_hdr.c:1704:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^

Even though this is a false positive (since we check the entire range of
an u8 in the switch/case), fix it by turning the case 13 ... 255 into
default.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
dissectors: 80211_mac_hdr: Remove remaining binary constants

Commit 151fd88f7429 ("dissectors: 80211_mac_hdr: Remove usage of binary
constants") removed binary constants in a particular case that was
reported to cause a compile error. However, this module uses binary
constants in some other places. Replace them by hexadecimal constants,
which makes it easier to read and is C99 compatible.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
netsniff-ng: Unindent goto label

Stick to the usual style of having goto labels not indented.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
netsniff-ng: Remvoe unnecessary cast to void *

The iov_base member of struct iovec is already void *, so there is no
need to cast it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Merge remote-tracking branch 'upstream/master'