Commit Graph

4101 Commits

Author SHA1 Message Date
Guy Harris
32a34e8e3b Work around pcap_create() failures fetching time stamp type lists.
Normally, it succeeds whether the device actually exists or not, but, in
some versions (but not the latest version), it may fail on Linux trying
to fetch the list of time stamp types.  Check for that failure and, if
that's the reason for pcap_create() failing, return from
open_interface() so the caller can see if the interface name is actually
an interface index.
2016-08-10 11:45:18 -07:00
Guy Harris
0d1a405289 Don't print the "listening on" message differently on Windows and UN*X.
Print it *after* we actually start listening and *after* we've possibly
converted an interface index to an interface name.
2016-08-10 11:10:26 -07:00
Francois-Xavier Le Bail
ad1b99d59a HNCP: Fix a warning on Solaris
The warning was:
"./print-hncp.c", line 367: warning: initializer will be sign-extended: -1
2016-08-10 15:41:20 +02:00
Guy Harris
ad0fc6bb89 Remvoe util.c; it's no longer used. 2016-08-09 11:56:23 -07:00
Guy Harris
953081ba22 Update to reflect some recent changes.
It probably needs more updates for new protocols.
2016-08-09 11:56:03 -07:00
Guy Harris
d4876278a7 Note that interfaces may have numerical names.
If N is a number, and is the name of an interface on the system, "-i N"
will now attempt to open that interface, not the Nth interface in the
list of interfaces.  See GitHub issue #522.
2016-08-09 11:40:02 -07:00
Guy Harris
0bc8e0e01e Try opening interfaces by name first, then by name-as-index.
Some UN*Xes apparently can have purely numeric interface names, so we
can't unconditionally treat purely numeric interface names as interface
indices.  Do so only for "names" that don't correspond to interfaces.

Fixes GitHub issue #522.
2016-08-09 11:12:35 -07:00
Guy Harris
9e9347f3dc Do the addrtostr6() bounds checking while we're generating the string.
That obviates the need for a temporary buffer, and eliminates complaints
about using sprintf().
2016-08-07 17:48:27 -07:00
Guy Harris
3ac642ee4c Let strlcpy() do the truncation check. 2016-08-07 16:55:08 -07:00
Guy Harris
3ac4e726be Squelch a warning and get rid of a duplicate assignment. 2016-08-07 16:00:04 -07:00
Guy Harris
62d52f2ea8 Squelch a signed array subscript warning.
As the string in question is passed as a constant from a printer, it
*shouldn't* contain any non-ASCII characters, but squelching the warning
is harmless and, on modern processors, a non-sign-extending byte load
shouldn't be any worse than a sign-extending byte load.
2016-08-07 15:35:54 -07:00
Guy Harris
688a79e7cb Use strlcpy(), rather than snprintf(), to avoid null format string warnings.
Include the appropriate headers to declare strlcpy() and snprintf().
2016-08-06 15:05:30 -07:00
Gisle Vanem
c4ae1ca64b add a missing declaration in netdissect.c 2016-08-06 16:29:40 +01:00
Guy Harris
6080cff326 Move more libsmi stuff to netdissect.c.
Have the call to smiLoadModule() be in a nd_load_smi_module() routine.
Have it set a *global* flag indicating whether a module has been loaded;
that's not per-netdissect_options.  Use that global flag in print-snmp.c
- and don't test it once per loop iteration, it's not going to change
while the loop is running.

Have a routine to return the version of the library if we're built with
it or NULL if we're not.

That removes the last of the code that tests USE_LIBSMI or uses libsmi
from tcpdump.c.
2016-08-04 14:35:35 -07:00
Guy Harris
bab54e3e56 Add netdissect.c. 2016-08-04 13:25:04 -07:00
Guy Harris
91e08f888d Move some code around.
Move stuff to initialize and clean up libraries that are used by
netdissect code into nd_init() and nd_cleanup() routines in
libnetdissect; this includes Winsock (which is used on Windows by, for
example, the code to get names for IP addresses) and libsmi.

Call nd_init() when tcpdump starts up, and call nd_cleanup() when it
exits.

Move util.c routines to tcpdump.c, and make them static.

Use ndo->ndo_error to report a failure to open a file in print-esp.c.
2016-08-04 13:19:57 -07:00
Guy Harris
d04b4e4b88 Squelch a signed vs. unsigned comparison warning.
Multiplying a uint8_t by an int results in an int, not an unsigned int;
make NSH_HDR_WORD_SIZE an unsigned constant so the multiplication is
uint8_t times unsigned int.
2016-08-02 13:03:34 -07:00
Guy Harris
79a0579b3a Squelch a warning.
time() is a standard C function; don't use time as the name of a
variable.
2016-08-02 12:59:47 -07:00
Guy Harris
174b3ec974 Use PRIx64 to print a 64-bit number in hex.
"lx" doesn't work on ILP32 or LLP64 platforms.
2016-07-29 13:00:48 -07:00
Michael Richardson
db752b7f79 Merge pull request #534 from MisterDA/hncp-20160728
HNCP support (RFCs 7787 and 7788)
2016-07-29 16:38:05 +02:00
Jean-Raphaël GAGLIONE
0a9a602a8c Add test for HNCP. 2016-07-28 21:22:31 +02:00
Jean-Raphaël GAGLIONE
75b7aeef9c Printer for HNCP (RFCs 7787 and 7788).
This is joint work with Antonin Décimo.
2016-07-28 21:09:41 +02:00
Michael Richardson
4fe8841dce bumped version 2016-07-21 14:32:52 +02:00
Francois-Xavier Le Bail
1b1522840f RPKI/Router: Add a return value check for "fn_printn" call 2016-07-19 15:49:49 +02:00
Francois-Xavier Le Bail
978b1f72d9 RESP: Fix Coverity warnings
The warnings were:
Calling "fn_printn" without checking return value (as is done elsewhere
52 out of 56 times)
2016-07-19 14:37:47 +02:00
Guy Harris
119ee49153 Allow building with libcrypto not in the default directory.
Add support for an argument to --with-crypto, so that if you have one
version of libcrypto installed under /usr and another version installed
under /usr/local, you can force tcpdump to be built with the /usr/local
version.

Also, refer both to OpenSSL and libressl in comments and messages.
2016-07-13 17:24:15 -07:00
Jesse Gross
aa50abdef6 Update list of Geneve option classes.
Newer versions of the Geneve protocol draft have defined additional
option classes. This updates the list so we can show the class name
instead of unknown.
2016-07-11 13:05:39 -07:00
Jesse Gross
9d4fd4450d Fix error message with invalid Geneve option length. 2016-07-11 10:24:46 -07:00
Denis Ovsienko
865ce57cf6 ICMP6 RPL: don't use inet_ntop()
No other code uses it, there is the ip6addr_string() wrapper. This
switch also makes it possible to avoid some array management.
2016-07-11 12:00:01 +01:00
Denis Ovsienko
f991a6948d use a mnemonic constant in rpl_daoack_print() 2016-07-11 11:57:20 +01:00
Denis Ovsienko
bd2b067d7b call ipaddr_string() instead of getname()
Same as in the previous commit.
2016-07-11 11:56:53 +01:00
Denis Ovsienko
d2aa4eec28 call ip6addr_string() instead of getname6()
This replaces a few explicit type casts with one type cast in the macro
and makes the source code mean one thing with one term instead of two.
2016-07-11 11:56:29 +01:00
Michael Richardson
5083bfccc0 Merge pull request #528 from mcr/master
the ROLL RPL DAGID is an IPv6 address
2016-07-10 10:42:54 -04:00
Michael Richardson
a9f4d1c299 added some minor protection against multiple inclusion 2016-07-09 17:22:18 -04:00
Michael Richardson
292d58b784 dagid is always an IPv6 address, not an opaque 128-bit string 2016-07-09 17:22:18 -04:00
Francois-Xavier Le Bail
2bdecbfb10 RSVP: Add bounds and length checks 2016-07-04 22:17:34 +02:00
Francois-Xavier Le Bail
d739da09bc OSPF: Do more bounds checking 2016-07-04 21:28:22 +02:00
Francois-Xavier Le Bail
58aeb476df OSPF: Fix printing 'ospf_topology_values' default
Moreover:
Fix spaces in ospf_topology_values[]
2016-07-04 21:23:15 +02:00
Francois-Xavier Le Bail
b62aefa71e RSVP: Add a bounds check 2016-07-04 12:11:20 +02:00
Guy Harris
5912e4f9ec Don't use strcasecmp(), use ascii_strcasecmp().
Not all platforms have strcasecmp() (yes, it's in the Single UNIX
Specification, but not all platforms are UNIX or even UN*X; there's some
obscure company in Redmond, Washington who have an OS on which we run),
and on those that do, there's no guarantee that strcasecmp() will treate
A-Z and a-z as being equivalent ("I" and "i" aren't equivalent in a
Turkish locale, for example).

Fix indentation while we're at it.
2016-07-01 13:58:52 -07:00
Guy Harris
545a67f69a Merge pull request #526 from superjamie/Cflag-Wflag-nonzero
Don't accept zero -C or -W options
2016-06-29 17:36:08 -07:00
Jamie Bainbridge
68a0f9980d Don't accept zero -C or -W options
Rolling over into zero filesize makes no sense. Creating a rotating
buffer of zero files makes no sense.

Modify the checks for -C and -W to accept greater than one, not greater
than zero.

Signed-off-by: Jamie Bainbridge <jamie.bainbiridge@gmail.com>
2016-06-30 09:15:33 +10:00
Guy Harris
0e34f5d742 Squelch a compiler warning.
It may not be necessary, but it makes the code a bit cleaner, even if
you spend a few extra microseconds per file fetching the name of the
link-layer header type even if the new file has the same header type.
2016-06-26 18:02:12 -07:00
Guy Harris
066ee5ae71 Minor coding style tweak. 2016-06-22 21:38:06 -07:00
Guy Harris
b1f305da3d Handle OpenSSL 1.1.x.
In 1.1.x, EVP_CIPHER_CTX is an opaque structure, so we can't declare it
on the stack.

Instead, if we don't have EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free()
in libcrypto, define our own versions, with the same signatures as the
ones in OpenSSL 1.1.x's libcrypto, and have the code use
EVP_CIPHER_CTX_new() to allocate the structure and EVP_CIPHER_CTX_free()
to free it.
2016-06-22 21:14:40 -07:00
Gisle Vanem
6334c9435e amend integer argument type (GH#521) 2016-06-02 11:26:07 +01:00
Guy Harris
2c69156f46 Merge pull request #519 from dionbosschieter/updatePostrotateCommandHelpText
Change -z command help text to -z postrotate-command
2016-05-16 11:42:28 -07:00
Dion Bosschieter
d33c541ea4 Change -z command help text to -z postrotate-command 2016-05-16 20:22:33 +02:00
Denis Ovsienko
405beede37 update CREDITS 2016-04-26 22:07:10 +01:00
Guy Harris
1f1e8ecc07 Merge pull request #515 from adarqui/typos
Just fixes a few typos and grammatical issues
2016-04-26 12:05:44 -07:00