]> The Tcpdump Group git mirrors - tcpdump/log
tcpdump
9 years agoFix capsicum support to work with zerocopy buffers in bpf. 486/head
Luiz Otavio O Souza [Wed, 14 Oct 2015 15:05:24 +0000 (10:05 -0500)] 
Fix capsicum support to work with zerocopy buffers in bpf.

Zerocopcy buffers in bpf was broken until recently in FreeBSD and now that
it is fixed, tcpdump is failing with insuficient capabilities when trying to
use the BIOCROTZBUF ioctl.

This commit adds BIOCROTZBUF to the list of allowed ioctls.

9 years agoAdd missing output files for LSP-Ping capture files
Francois-Xavier Le Bail [Tue, 13 Oct 2015 14:31:45 +0000 (16:31 +0200)] 
Add missing output files for LSP-Ping capture files

9 years agoFix the error handling in 'ndo_printf' function
Francois-Xavier Le Bail [Mon, 12 Oct 2015 20:17:01 +0000 (22:17 +0200)] 
Fix the error handling in 'ndo_printf' function

Moreover:
Replace strerror() calls with pcap_strerror() calls, in case some platform
lacks strerror().

9 years agoAdd test files for pcap-ng invalid versions
Francois-Xavier Le Bail [Sat, 10 Oct 2015 16:54:46 +0000 (18:54 +0200)] 
Add test files for pcap-ng invalid versions

9 years agoAdd test files for pcap invalid versions
Francois-Xavier Le Bail [Sat, 10 Oct 2015 16:22:22 +0000 (18:22 +0200)] 
Add test files for pcap invalid versions

9 years agoFix the pcap version in tests/cve2015-0261-crash.pcap
Francois-Xavier Le Bail [Sat, 10 Oct 2015 12:24:41 +0000 (14:24 +0200)] 
Fix the pcap version in tests/cve2015-0261-crash.pcap

It will be always usable with the upcoming libpcap versions sanity checks.
(old version: 12336.12336, new version: 2.4)

9 years agoGet rid of "TCPDUMP" in some libnetdissect codes
Francois-Xavier Le Bail [Thu, 8 Oct 2015 14:36:23 +0000 (16:36 +0200)] 
Get rid of "TCPDUMP" in some libnetdissect codes

9 years agoFix a comment
Francois-Xavier Le Bail [Thu, 8 Oct 2015 14:26:36 +0000 (16:26 +0200)] 
Fix a comment

Moreover:
s/tcpdump/netdissect/

9 years agoUse the nd_uintN_t types more.
Guy Harris [Wed, 7 Oct 2015 07:14:20 +0000 (00:14 -0700)] 
Use the nd_uintN_t types more.

Define them in netdissect.h.

Use them in ip.h, and *don't* mark the structures as UNALIGNED; that
should no longer be necessary.

Add a new nd_ipv4 type to use as an IPv4 address; it represents the 4
bytes of IPv4 address as an array of unsigned chars, so that its natural
alignment is only on a byte boundary.

Those changes found some places where we weren't using
UNALIGNED_MEMCPY() to extract IPv4 addresses from packets; use it.

9 years agoSquelch some "constness casted away" warnings.
Guy Harris [Wed, 7 Oct 2015 05:48:09 +0000 (22:48 -0700)] 
Squelch some "constness casted away" warnings.

9 years agoIntroduce data types to use for integral values in packet structures.
Guy Harris [Tue, 6 Oct 2015 16:41:01 +0000 (09:41 -0700)] 
Introduce data types to use for integral values in packet structures.

They are defined as arrays of bytes, so

1) no padding is inserted before them to put them on natural
   boundaries, so they can be used if the values *aren't* so
   aligned;

2) you have to use EXTRACT_ macros with them - which you should
   be doing *anyway*, to avoid explicitly or implicitly making
   assumptions about byte order or alignment safety on the
   platform for which your code is being built (it'd better work
   when built for little-endian x86 or for big-endian *and*
   strict-alignment-requiring SPARC).

Use them in the LISP (no, not the programming language!) dissector;
UNALIGNED means "this structure is not guaranteed to be aligned as a
whole, so don't generate code that assumes it is", not "this structure's
individual members shouldn't have padding to put them on natural
boundaries", so it's not sufficient to do that.  (Using these types
*might* suffice to ensure that code that assumes alignment not be
generated, but never underestimate SPARC compilers' eagerness to use
single load and store instructions to fetch big-endian 16-bit, 32-bit,
and 64-bit values from packets that really aren't guaranteed to be
aligned.)

9 years agoRSVP: Fix an infinite loop
Francois-Xavier Le Bail [Tue, 6 Oct 2015 14:21:19 +0000 (16:21 +0200)] 
RSVP: Fix an infinite loop

9 years agoFix a trailing tab
Francois-Xavier Le Bail [Mon, 5 Oct 2015 12:41:18 +0000 (14:41 +0200)] 
Fix a trailing tab

9 years agoLISP: Fix a Clang warning
Francois-Xavier Le Bail [Mon, 5 Oct 2015 09:03:15 +0000 (11:03 +0200)] 
LISP: Fix a Clang warning

The warning was:
./print-lisp.c:401:11: warning: variable 'xtr_present' is used uninitialized
      whenever 'if' condition is false [-Wsometimes-uninitialized]
        else if (type == LISP_MAP_NOTIFY)
                 ^~~~~~~~~~~~~~~~~~~~~~~

./print-lisp.c:404:9: note: uninitialized use occurs here
        return xtr_present;
               ^~~~~~~~~~~

Moreover:
Remove unused 'interface.h' include.

9 years agoLISP: We always support IPv6 addresses now
Francois-Xavier Le Bail [Sun, 4 Oct 2015 15:20:21 +0000 (17:20 +0200)] 
LISP: We always support IPv6 addresses now

INET6 is no more used.

9 years agoInitial commit for support of Type 3 and Type 4 LISP packets.
ritsz [Fri, 14 Aug 2015 16:06:52 +0000 (21:36 +0530)] 
Initial commit for support of Type 3 and Type 4 LISP packets.

Fixing Travis CI build for LISP commit

Adding testcases for lisp notify and register

Fixing build warnings

Added ND_TCHECK for relevant headers

Fixing ND_TCHECK2 issues

Adding support for multiple LOC records for same EID entry

Fixing review issues, adding detailed tests

Adding support for verbose outputs

Adding RFC information for UDP PORT defination

Removing Spaces in type names

Print EID record related flags in verbose mode

Using tok2str

Fixing -Wpedantic issues

Negative testcases, Packet structure comments, verbose mode flag printing

Printing Map Version

Print auth_data, decouple type and xtr_present extraction, handle malformed packets correctly

Tests for latest code changes

Printing useful info incase not built with IPv6 support

9 years agoCONTRIBUTING: Index the remarks with letters for later references
Francois-Xavier Le Bail [Fri, 2 Oct 2015 21:47:17 +0000 (23:47 +0200)] 
CONTRIBUTING: Index the remarks with letters for later references

9 years agoWe need -Werror when testing whether -f or -m flags work.
Guy Harris [Tue, 29 Sep 2015 08:15:53 +0000 (01:15 -0700)] 
We need -Werror when testing whether -f or -m flags work.

Thank you, clang, for treating unknown -f flags as warnings, only
failing with them if run with -Werror, and spewing out warning messages
whenever they're used.

9 years agoFix check for MCS field being present.
Guy Harris [Tue, 29 Sep 2015 03:09:53 +0000 (20:09 -0700)] 
Fix check for MCS field being present.

Fix test file while we're at it.

9 years agoUpdate tests for 11n fix.
Guy Harris [Tue, 29 Sep 2015 01:50:40 +0000 (18:50 -0700)] 
Update tests for 11n fix.

9 years agoIf we have the MCS field, it's 11n.
Guy Harris [Tue, 29 Sep 2015 01:19:31 +0000 (18:19 -0700)] 
If we have the MCS field, it's 11n.

Pass print_chaninfo() the presence flags, and, if IEEE80211_RADIOTAP_MCS
is set, report it as 11n, rather than looking at the channel flags to
figure out whether it's FHSS or 11b/11a/11g.

Fix typo while we're at it ("long GI", not "lon GI").

9 years agoMore whitespace cleanup.
Guy Harris [Mon, 28 Sep 2015 23:03:24 +0000 (16:03 -0700)] 
More whitespace cleanup.

9 years agoClean up white space.
Guy Harris [Mon, 28 Sep 2015 23:02:42 +0000 (16:02 -0700)] 
Clean up white space.

9 years agoShuffle some stuff around a bit.
Guy Harris [Mon, 28 Sep 2015 23:01:16 +0000 (16:01 -0700)] 
Shuffle some stuff around a bit.

There were two places with radiotap stuff; move them together.

9 years agoDon't check for libcrypto if we don't have its headers.
Guy Harris [Mon, 28 Sep 2015 07:41:01 +0000 (00:41 -0700)] 
Don't check for libcrypto if we don't have its headers.

Thanks, Apple.

9 years agoClean up some variable names.
Guy Harris [Thu, 24 Sep 2015 22:47:47 +0000 (15:47 -0700)] 
Clean up some variable names.

"devlist" is a pointer to the first in a list of devices; "dev" is a
pointer into that list.

9 years agoMerge pull request #483 from sinic/master
Guy Harris [Thu, 24 Sep 2015 22:06:36 +0000 (15:06 -0700)] 
Merge pull request #483 from sinic/master

Free all and entire lists pcap_findalldevs() returns

9 years agoFree the list of devices after printing it (-D) 483/head
Simon Nicolussi [Thu, 24 Sep 2015 19:45:59 +0000 (21:45 +0200)] 
Free the list of devices after printing it (-D)

It doesn't make much of a difference because of the exit(0) right
afterwards, but prevents Valgrind from complaining about a leak.

9 years agoFree the entire list of devices, not just its tail
Simon Nicolussi [Thu, 24 Sep 2015 19:42:47 +0000 (21:42 +0200)] 
Free the entire list of devices, not just its tail

9 years agoFree up lists we get from pcap_findalldevs().
Guy Harris [Mon, 21 Sep 2015 22:35:42 +0000 (15:35 -0700)] 
Free up lists we get from pcap_findalldevs().

That means we need to make a copy of a name we get from the list.

9 years agoMerge pull request #482 from sinic/master
Guy Harris [Mon, 21 Sep 2015 22:25:58 +0000 (15:25 -0700)] 
Merge pull request #482 from sinic/master

Use pcap_findalldevs() to find the default interface, if available.

This defaults to the correct interface on Windows.

It also means that, if you're unlucky enough to have only a loopback
interface, it'll find that interface.  (This is a feature, not a bug.)

9 years agoDefault to first interface from pcap_findalldevs() 482/head
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.

9 years agoDTP: improve packet integrity checks
Denis Ovsienko [Sat, 5 Sep 2015 20:17:30 +0000 (21:17 +0100)] 
DTP: improve packet integrity checks

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().

9 years agoAdditional Windows cleanups.
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.

9 years agoEliminate remaining uses of u_int8_t and u_int16_t.
Guy Harris [Fri, 18 Sep 2015 22:15:52 +0000 (15:15 -0700)] 
Eliminate remaining uses of u_int8_t and u_int16_t.

9 years agoEliminate some remaining uses of u_int32_t.
Guy Harris [Fri, 18 Sep 2015 22:11:43 +0000 (15:11 -0700)] 
Eliminate some remaining uses of u_int32_t.

9 years agoWe don't define our own inet_aton() any more, so don't declare it.
Guy Harris [Fri, 18 Sep 2015 20:19:32 +0000 (13:19 -0700)] 
We don't define our own inet_aton() any more, so don't declare it.

9 years agoUpdate Visual Studio files.
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).

9 years agoReorganize netdissect.h
Francois-Xavier Le Bail [Fri, 18 Sep 2015 13:14:31 +0000 (15:14 +0200)] 
Reorganize netdissect.h

Group together:
- DLT printers (sorted)
- other printers (sorted)
- utilities

9 years agoRename print_data() to smb_print_data()
Francois-Xavier Le Bail [Fri, 18 Sep 2015 11:04:24 +0000 (13:04 +0200)] 
Rename print_data() to smb_print_data()

9 years agoTravis: The '--disable-ipv6' configure option was eliminated
Francois-Xavier Le Bail [Fri, 18 Sep 2015 10:00:57 +0000 (12:00 +0200)] 
Travis: The '--disable-ipv6' configure option was eliminated

9 years agoDon't require IPv6 library support in order to support IPv6 addresses.
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.

9 years agoDon't fetch statistics in verbose_stats_dump().
Guy Harris [Thu, 17 Sep 2015 19:59:12 +0000 (12:59 -0700)] 
Don't fetch statistics in verbose_stats_dump().

It only prints *our* (tcpdump's) count of packets seen, so it doesn't
need to fetch statistics from libpcap/WinPcap.

9 years agoRename a variable to avoid collision with stat().
Guy Harris [Thu, 17 Sep 2015 19:23:46 +0000 (12:23 -0700)] 
Rename a variable to avoid collision with stat().

This eliminates a warning with some compilers.

9 years agoRename variable to avoid collision with poll().
Guy Harris [Thu, 17 Sep 2015 19:19:22 +0000 (12:19 -0700)] 
Rename variable to avoid collision with poll().

That eliminates some compiler warnings.

9 years agoUse hex constants so compilers don't whine about negative initializers.
Guy Harris [Thu, 17 Sep 2015 19:17:02 +0000 (12:17 -0700)] 
Use hex constants so compilers don't whine about negative initializers.

9 years agoFix the maximum snaplen value in the man page
Francois-Xavier Le Bail [Thu, 17 Sep 2015 09:13:21 +0000 (11:13 +0200)] 
Fix the maximum snaplen value in the man page

9 years agoInclude ipproto.h to make sure IPPROTO_PIM is defined.
Guy Harris [Thu, 17 Sep 2015 08:48:36 +0000 (01:48 -0700)] 
Include ipproto.h to make sure IPPROTO_PIM is defined.

We use it, but it's not necessarily defined by OS headers; make sure
it's defined, by including our header.

9 years agoThe Option -n is useless in TESTLIST
Francois-Xavier Le Bail [Wed, 16 Sep 2015 21:37:54 +0000 (23:37 +0200)] 
The Option -n is useless in TESTLIST

This option is already set in TESTonce.

9 years agoAdd CONTRIBUTING file
Francois-Xavier Le Bail [Wed, 16 Sep 2015 17:18:56 +0000 (19:18 +0200)] 
Add CONTRIBUTING file

9 years agoNobody uses off_t, either. (ftell(), and pcap_dump_ftell(), return long.)
Guy Harris [Mon, 14 Sep 2015 23:28:37 +0000 (16:28 -0700)] 
Nobody uses off_t, either.  (ftell(), and pcap_dump_ftell(), return long.)

9 years agoWe don't use uint, so no need to define it on Windows.
Guy Harris [Mon, 14 Sep 2015 22:42:18 +0000 (15:42 -0700)] 
We don't use uint, so no need to define it on Windows.

9 years agohdrlen is never > INT_MAX, and we negate it, so make it an int.
Guy Harris [Mon, 14 Sep 2015 22:38:02 +0000 (15:38 -0700)] 
hdrlen is never > INT_MAX, and we negate it, so make it an int.

This squelches some compiler warnings.

9 years agoUse double rather than float.
Guy Harris [Mon, 14 Sep 2015 22:12:28 +0000 (15:12 -0700)] 
Use double rather than float.

That means we can fit a 32-bit integer into a floating-point value
without losing precision.

Also, put in explicit casts when we convert a floating-point value to an
integral value, to suppress compiler warnings.

9 years agoConsistently use float constants.
Guy Harris [Mon, 14 Sep 2015 22:06:33 +0000 (15:06 -0700)] 
Consistently use float constants.

9 years agoMake pduid a u_short consistently.
Guy Harris [Mon, 14 Sep 2015 22:04:12 +0000 (15:04 -0700)] 
Make pduid a u_short consistently.

9 years agoInclude <ctype.h> to make sure we have all the isXXX() functions.
Guy Harris [Mon, 14 Sep 2015 21:50:39 +0000 (14:50 -0700)] 
Include <ctype.h> to make sure we have all the isXXX() functions.

9 years agoDon't rely on uint being defined.
Guy Harris [Mon, 14 Sep 2015 21:37:52 +0000 (14:37 -0700)] 
Don't rely on uint being defined.

9 years agoFix for *pcaps without pcap_create()/pcap_activate().
Guy Harris [Mon, 14 Sep 2015 21:24:38 +0000 (14:24 -0700)] 
Fix for *pcaps without pcap_create()/pcap_activate().

9 years agoGet rid of some unneeded #defines and #includes.
Gisle Vanem [Mon, 14 Sep 2015 19:07:44 +0000 (12:07 -0700)] 
Get rid of some unneeded #defines and #includes.

Those lines are not needed since "netdissect-stdinc.h" has:

#include <winsock2.h>
#include <ws2tcpip.h>

This will ensure <winsock.h> is not included in a later <windows.h>.

SIZE_BUF is not used anywhere AFAICS.

9 years agoRemove non-dissection related fields from struct netdissect_options
Francois-Xavier Le Bail [Mon, 14 Sep 2015 17:19:43 +0000 (19:19 +0200)] 
Remove non-dissection related fields from struct netdissect_options

Remove 'ndo_dlt' and 'ndo_dltname' from netdissect_options, only
used is frontend.
Use instead 'yflag_dlt' and 'yflag_dlt_name' variables in frontend.

Moreover:
Fix style

9 years agoRemove a non-dissection related field from struct netdissect_options
Francois-Xavier Le Bail [Mon, 14 Sep 2015 15:16:26 +0000 (17:16 +0200)] 
Remove a non-dissection related field from struct netdissect_options

Remove 'ndo_immediate' from netdissect_options, only used is frontend.
Use instead 'immediate_mode' variable in frontend.

9 years agoMove if_printer to structure netdissect_options
Francois-Xavier Le Bail [Mon, 14 Sep 2015 13:34:13 +0000 (15:34 +0200)] 
Move if_printer to structure netdissect_options

The structure 'netdissect_options' can hold if_printer.
Thus the structure 'print_info' is useless now.

Moreover:
Delete useless blank lines
Fix indent

9 years agoCall pcap_wsockinit(), not wsockinit(), and print a message if it fails.
Guy Harris [Fri, 11 Sep 2015 18:09:35 +0000 (11:09 -0700)] 
Call pcap_wsockinit(), not wsockinit(), and print a message if it fails.

Get rid of w32_fzs.h while we're at it.

9 years agolibnetdissect code must include 'netdissect.h', not 'interface.h'
Francois-Xavier Le Bail [Fri, 11 Sep 2015 11:22:56 +0000 (13:22 +0200)] 
libnetdissect code must include 'netdissect.h', not 'interface.h'

Moreover:
Remove netdissect.h include in interface.h
Move thiszone declaration in netdissect.h
Update a comment

9 years agoRename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Francois-Xavier Le Bail [Wed, 9 Sep 2015 20:42:38 +0000 (22:42 +0200)] 
Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'

Get the full log via: git log --follow netdissect-stdinc.h

9 years ago'-pedantic' option is supported by Travis, '-Wpedantic' is not
Francois-Xavier Le Bail [Wed, 9 Sep 2015 06:06:39 +0000 (08:06 +0200)] 
'-pedantic' option is supported by Travis, '-Wpedantic' is not

9 years agoCompile with '-Wold-style-definition' in devel mode
Francois-Xavier Le Bail [Wed, 9 Sep 2015 05:42:39 +0000 (07:42 +0200)] 
Compile with '-Wold-style-definition' in devel mode

9 years agoFix incorrect detection of '-Wstrict-prototypes' option
Francois-Xavier Le Bail [Wed, 9 Sep 2015 05:04:28 +0000 (07:04 +0200)] 
Fix incorrect detection of '-Wstrict-prototypes' option

Revert "Simplify AC_LBL_CHECK_COMPILER_OPT a bit."
(commit 43e88cd5b8e9d9d643bbad585743123492452041)

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.

9 years agoFix warnings as "old-style function definition"
Francois-Xavier Le Bail [Wed, 9 Sep 2015 16:28:02 +0000 (18:28 +0200)] 
Fix warnings as "old-style function definition"

9 years agoUpdate a ndo flag name
Francois-Xavier Le Bail [Wed, 9 Sep 2015 11:26:34 +0000 (13:26 +0200)] 
Update a ndo flag name

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/.

9 years agoUpdate a comment
Francois-Xavier Le Bail [Tue, 8 Sep 2015 20:37:54 +0000 (22:37 +0200)] 
Update a comment

9 years agoGet rid of "tcpdump" in some libnetdissect codes
Francois-Xavier Le Bail [Tue, 8 Sep 2015 19:05:46 +0000 (21:05 +0200)] 
Get rid of "tcpdump" in some libnetdissect codes

9 years agoFix a comment
Francois-Xavier Le Bail [Tue, 8 Sep 2015 17:51:03 +0000 (19:51 +0200)] 
Fix a comment

Moreover:
s/tcpdump/netdissect/

9 years agoFix a typo
Francois-Xavier Le Bail [Tue, 8 Sep 2015 17:36:16 +0000 (19:36 +0200)] 
Fix a typo

9 years agoUpdate tcpdump summary comment
Francois-Xavier Le Bail [Tue, 8 Sep 2015 17:24:28 +0000 (19:24 +0200)] 
Update tcpdump summary comment

9 years agoGet rid of "tcpdump" in some libnetdissect codes
Francois-Xavier Le Bail [Tue, 8 Sep 2015 16:01:26 +0000 (18:01 +0200)] 
Get rid of "tcpdump" in some libnetdissect codes

9 years agoPrint program_name instead of "tcpdump"
Francois-Xavier Le Bail [Tue, 8 Sep 2015 15:43:21 +0000 (17:43 +0200)] 
Print program_name instead of "tcpdump"

Moreover:
Fix indent

9 years agoRemove useless include
Francois-Xavier Le Bail [Tue, 8 Sep 2015 10:32:29 +0000 (12:32 +0200)] 
Remove useless include

9 years agoRemove obsolete comment
Francois-Xavier Le Bail [Tue, 8 Sep 2015 10:26:38 +0000 (12:26 +0200)] 
Remove obsolete comment

9 years ago"tcpdump" should not be used in any libnetdissect code.
Guy Harris [Tue, 8 Sep 2015 07:53:38 +0000 (00:53 -0700)] 
"tcpdump" should not be used in any libnetdissect code.

Libnetdissect could be used by programs not named "tcpdump".  Rename
"tcpdump_printf()" to "ndo_printf()".

9 years agoRemove no longer used option 'R'
Francois-Xavier Le Bail [Tue, 8 Sep 2015 07:14:13 +0000 (09:14 +0200)] 
Remove no longer used option 'R'

9 years agoAdd program_name field in the netdissect_options structure
Francois-Xavier Le Bail [Mon, 7 Sep 2015 17:04:50 +0000 (19:04 +0200)] 
Add program_name field in the netdissect_options structure

A program that use the library should set it. Done for tcpdump.
ndo_error() and ndo_warning() print now 'ndo->program_name'.

Moreover:
Fix indent

9 years agoRemove obsolete comments
Francois-Xavier Le Bail [Mon, 7 Sep 2015 13:01:46 +0000 (15:01 +0200)] 
Remove obsolete comments

9 years agoFix a comment
Francois-Xavier Le Bail [Sun, 6 Sep 2015 20:03:23 +0000 (22:03 +0200)] 
Fix a comment

9 years agoRename cstr[] to istr[] like invalid string
Francois-Xavier Le Bail [Sun, 6 Sep 2015 18:05:50 +0000 (20:05 +0200)] 
Rename cstr[] to istr[] like invalid string

Moreover:
Hamonise the output for error messages
Add istr[] in print-babel.c

9 years agoDHCPv6: Update Status Codes with RFCs/IANA names
Francois-Xavier Le Bail [Sun, 6 Sep 2015 12:20:37 +0000 (14:20 +0200)] 
DHCPv6: Update Status Codes with RFCs/IANA names

9 years agoUse the word 'invalid' for 'malformed' or 'corrupted' packets
Francois-Xavier Le Bail [Sun, 6 Sep 2015 11:34:05 +0000 (13:34 +0200)] 
Use the word 'invalid' for 'malformed' or 'corrupted' packets

An invalid packet could be:
1) built malformed originally by the sender or a fuzz tester,
2) became corrupted in transit.

9 years agoPrinters must include 'netdissect.h', not 'interface.h'
Francois-Xavier Le Bail [Sat, 5 Sep 2015 21:35:58 +0000 (23:35 +0200)] 
Printers must include 'netdissect.h', not 'interface.h'

9 years agoFunctions in libnetdissect must use ndo_error() function
Francois-Xavier Le Bail [Sat, 5 Sep 2015 20:28:04 +0000 (22:28 +0200)] 
Functions in libnetdissect must use ndo_error() function

9 years agoamend some comments in util-print.c
Denis Ovsienko [Sat, 5 Sep 2015 18:39:20 +0000 (19:39 +0100)] 
amend some comments in util-print.c

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.

9 years agoPrinters must use ndo_error() function (via ndo->ndo_error)
Francois-Xavier Le Bail [Sat, 5 Sep 2015 18:11:12 +0000 (20:11 +0200)] 
Printers must use ndo_error() function (via ndo->ndo_error)

9 years agoKeep the two line numbers in esp_print_decode_onesecret() separate.
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.

9 years agoAvoid collison with error(), clean up code a bit.
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.

9 years agoAvoid collisions with isascii().
Guy Harris [Mon, 31 Aug 2015 23:19:09 +0000 (16:19 -0700)] 
Avoid collisions with isascii().

Those variables are counts, so just give them names that reflects that.

9 years agoAvoid colliding with a tcpdump routine's name.
Guy Harris [Mon, 31 Aug 2015 23:17:03 +0000 (16:17 -0700)] 
Avoid colliding with a tcpdump routine's name.

Just call the variable "data", not "print_data"; we're obviously
printing it.

9 years agoDon't collide with strlen().
Guy Harris [Mon, 31 Aug 2015 23:15:32 +0000 (16:15 -0700)] 
Don't collide with strlen().

strlen() is a standard C function, so don't use its name for a variable.

9 years agoGet rid of warnings on systems that provide index().
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.

9 years agoThe official #define for 32-bit and 64-bit Windows is _WIN32.
Guy Harris [Mon, 31 Aug 2015 21:43:15 +0000 (14:43 -0700)] 
The official #define for 32-bit and 64-bit Windows is _WIN32.

It's _WIN32, with a leading underscore, not WIN32.  See, for example:

https://sourceforge.net/p/predef/wiki/OperatingSystems/

and

https://msdn.microsoft.com/en-us/library/b0084kay.aspx

*Some* environments may also define WIN32, but we shouldn't depend on
that.

9 years agoFix to reflect dBm radiotap values now being displayed as "dBm" rather than "dB".
Guy Harris [Wed, 26 Aug 2015 19:01:28 +0000 (12:01 -0700)] 
Fix to reflect dBm radiotap values now being displayed as "dBm" rather than "dB".