Simon Nicolussi [Mon, 21 Sep 2015 20:12:20 +0000 (22:12 +0200)]
Default to first interface from pcap_findalldevs()
Only call (deprecated) pcap_lookupdev() as a last resort, as it doesn't
necessarily agree with pcap_findalldevs() on the order of interfaces and
the -D and -i options already rely upon the latter function's behaviour.
Adjust the TLV infinite loop check to require the right amount of bytes
for T and L; do it after printing the TLV header so it is easier to
understand what was wrong. Check if the TLV V is within the capture. Use
the new "invalid" exit label to indicate a packet anomaly and add more
checks for the length value into the type-specific case blocks. Print
the domain string with fn_printzp().
Guy Harris [Sat, 19 Sep 2015 00:24:23 +0000 (17:24 -0700)]
Additional Windows cleanups.
Don't import stuff from WinPcap that it really shouldn't be exporting.
Define HAVE_U_INT{N}_T,to suppress definition of intN_t in bittypes.h, as
included by <pcap/pcap.h> on Windows.
Define HAVE_OS_IPV6_SUPPORT if AF_INET6 is defined, so that if we're
building with a VC+SDK combination that defines it and struct in6_addr,
we don't define them ourselves.
Guy Harris [Fri, 18 Sep 2015 19:39:05 +0000 (12:39 -0700)]
Update Visual Studio files.
Update the list of source files, and the command-line flags (for
example, don't define INET6, as we no longer check it, or WIN32, as we
no longer check it - we check the standard _WIN32 instead).
Guy Harris [Thu, 17 Sep 2015 21:56:44 +0000 (14:56 -0700)]
Don't require IPv6 library support in order to support IPv6 addresses.
Have our own routines to convert between IPv4/IPv6 addresses and
strings; that helps if, for example, we want to build binary versions of
tcpdump for Windows that can run both on NT 5 (W2K/WXP), which doesn't
have inet_ntop() or inet_pton(), and NT 6 (Vista/7/8/10), which do. It
also means that we don't require IPv6 library support on UN*X to print
addresses (if somebody wants to build tcpdump for older UN*Xes lacking
IPv6 support in the system library or in add-on libraries).
Get rid of files in the missing directory that we don't need, and
various no-longer-necessary autoconf tests.
The problem shows itself because 'configure' displays
"checking whether the compiler supports the -Wstrict-prototypes option... no"
even if '-Wstrict-prototypes' option is supported.
Moreover:
Update configure accordingly.
Fix a trailing space.
Even if frontend/backend separation is ongoing, keep coherence between
option name and flag name at the moment.
Option name is 'm', thus s/ndo_sflag/ndo_mflag/.
When I needed to print a string and didn't remember which of the three
functions fn_print(), fn_printn() and fn_printzp() was the right one
for the data, every time it would end up in reading through all of them
and forgetting the difference shortly after the commit.
Just having it explained in the comments should work better.
Guy Harris [Tue, 1 Sep 2015 00:16:07 +0000 (17:16 -0700)]
Keep the two line numbers in esp_print_decode_onesecret() separate.
Have the line number for the file we're opening for "file" be separate
from the line number we're passed. That avoids warnings, and makes it
clearer *which* line number we're using.
Guy Harris [Mon, 31 Aug 2015 23:57:07 +0000 (16:57 -0700)]
Avoid collison with error(), clean up code a bit.
Rename the variable to "error_status", as that's what it represents, and
as that doesn't collide with the error() function. Don't set it and
then not use the resulting value.
Guy Harris [Mon, 31 Aug 2015 23:12:43 +0000 (16:12 -0700)]
Get rid of warnings on systems that provide index().
Rename the variable "index" to "idx", so that if the environment in
which we're compiling tcpdump happens to declare the index() function
(the old V7 name for the function called strchr() in S3/S5 and ANSI C),
we don't get compiler warnings.
Francois-Xavier Le Bail [Tue, 18 Aug 2015 18:59:31 +0000 (20:59 +0200)]
Fix a warning as "ISO C90 forbids mixed declarations and code"
The warning was:
./tcpdump.c: In function 'droproot':
./tcpdump.c:496:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int ret = capng_change_id(pw->pw_uid, pw->pw_gid, CAPNG_NO_FLAG);
^
Guy Harris [Wed, 29 Jul 2015 16:17:30 +0000 (09:17 -0700)]
Give more details about packet time stamps.
Don't speak of "Ethernet" and "wire", as you might not be sniffing an
Ethernet or, indeed, any form of wired network.
Note that not only could there be a delay between the point at which the
interface is finished receiving the packet and when an interrupt is
delivered (whether due to bus delays, polling rather than immediate
interrupts being used, or delays in the CPU responding to the interrupt,
or more than one of those) but also a delay between the point at which
the kernel responds to the interrupt and the point at which it actually
applies a time stamp to the packet.
Merge pull request #470 from qnet-herwin/radius_rfc3580
I haven't included any unit tests, because the trivial change this is. It has been tested locally and it has been seen working there. It doesn't break any existing unit tests either.
Fun fact: this value is used to assign a VLAN to a port or WLAN user, I wouldn't be surprised if it's the most common used value for Tunnel-Type.
The warnings were:
./print-isoclns.c: In function 'osi_print_cksum':
./print-isoclns.c:3107:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
|| length > ndo->ndo_snaplen
^
./print-isoclns.c:3108:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
|| checksum_offset > ndo->ndo_snaplen
^
Guy Harris [Mon, 13 Jul 2015 19:50:01 +0000 (12:50 -0700)]
We're not doing setjmp/longjmp, so no need for static variables.
We stopped doing setjmp/longjmp a while ago (it could cause issues on
multiple platforms), so we don't need to make pointer variables static
in the lookup routines.
Move the port number #define's to the TCP and UDP files such that they
don't require nameser.h anymore. Update the TCP printer to disregard the
multicast DNS port as it is UDP-only.
Fix warnings as "declaration of 'x' shadows a global declaration"
The warnings were:
./tcpdump.c: In function 'show_tstamp_types_and_exit':
./tcpdump.c:220:56: warning: declaration of 'pd' shadows a global declaration [-Wshadow]
show_tstamp_types_and_exit(const char *device, pcap_t *pd)
^
./tcpdump.c:200:16: warning: shadowed declaration is here [-Wshadow]
static pcap_t *pd;
^
./tcpdump.c: In function 'show_dlts_and_exit':
./tcpdump.c:253:48: warning: declaration of 'pd' shadows a global declaration [-Wshadow]
show_dlts_and_exit(const char *device, pcap_t *pd)
^
./tcpdump.c:200:16: warning: shadowed declaration is here [-Wshadow]
static pcap_t *pd;
^