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;
^
RX: Fix 168 warnings as "declaration of 'x' shadows a previous local"
An example of these warnings is:
./print-rx.c: In function 'fs_print':
./print-rx.c:774:35: warning: declaration of 'i' shadows a previous local [-Wshadow]
#define UINTOUT() { unsigned long i; \
^
./print-rx.c:916:4: note: in expansion of macro 'UINTOUT'
UINTOUT();
^
./print-rx.c:883:16: warning: shadowed declaration is here [-Wshadow]
unsigned long i;
^
Gisle Vanem [Fri, 10 Jul 2015 10:39:10 +0000 (12:39 +0200)]
Update print-dccp.c
Fix warning:
```
print-dccp.c(500): warning C4456: declaration of 'cp' hides previous local declaration
print-dccp.c(277): note: see declaration of 'cp'
```
Denis Ovsienko [Mon, 29 Jun 2015 15:06:31 +0000 (16:06 +0100)]
BGP: add decoding of ADD-PATH capability
This implements the capability part of draft-ietf-idr-add-paths-10 and
seems to work for a packet capture I am looking into. The problem with
the "extended NLRI encodings" defined in the same document is that they
are going to use a different structure for the two previously assigned
path attributes, which makes decoding of an UPDATE difficult without
having both relevant OPENs from the same session.
Denis Ovsienko [Mon, 29 Jun 2015 14:53:06 +0000 (15:53 +0100)]
refine tok2str() buffer use
Switch RRCP and BGP functions from tok2strbuf() to tok2str() to avoid
unnecessary local buffer management. The latter function does it in a
way to allow up to 4 calls to itself from printf(). After that
tok2strbuf() remains used by tok2str() only and can be refined later.
Remove a duplicate macro and place the remaining definition into the
right file.
Francois-Xavier Le Bail [Fri, 19 Jun 2015 07:28:47 +0000 (09:28 +0200)]
Fix a non-reentrant code in a function
Delete the 'static char buf' array in ts_format().
buf is now a parameter of ts_format().
Moreover:
Decrease a too long string.
Fix a space in a comment.
Duane Wessels [Thu, 18 Jun 2015 17:27:34 +0000 (10:27 -0700)]
For DNS messages, represent the "DNSSEC OK" bit as "DO" instead of "OK"
"DO" is a better description of the DNSSEC OK bit in the EDNS0 OPT record. See RFC 3225 section 3. There may be other bits allocated in the future that call themselves "Something OK".
Guy Harris [Thu, 11 Jun 2015 22:47:44 +0000 (15:47 -0700)]
Do case-insensitive comparisons assuming ASCII strings.
Do the case-insensitive comparisons in a locale-independent fashion that
only maps ASCII letters, in the standard English-language fashion; that
way, we don't get bitten by, for example, Turkish having separate "i
with dot" and "i without dot" letters, with lower-case "i with dot" being
mapped to upper-case "I with dot" rather than being mapped to "I".