Merge remote-tracking branch 'goog/tcpdump'
* goog/tcpdump: (3066 commits)
Remove old version. Getting ready for new tcpdump 4.5
Support -Q for setting the capture direction.
Clean up the TLV processing loop.
With -A and -AA, don't send CRs to the standard output.
Use the new libpcap <pcap/nflog.h> for NFLOG definitions and declarations.
Do our own isascii(), isprint(), isgraph(), and toascii().
Fix a compiler warning.
Don't use the __attribute__((packed)) on most platforms.
The interval in an AODV HELLO extension is not aligned on a 4-byte boundary.
As with memcpy, so with memcmp.
More UNALIGNED_MEM{CPY,CMP} on IP addresses.
Another case where UNALIGNED_MEMCPY() is probably necessary.
No need for casting back and forth.
Only do the unaligned_mem{cpy,cmp} hack if necessary.
No need to declare unaligned_mem{cpy,cmp} in netdissect.h *and* interface.h.
More possibly-unaligned memcpy()s and assignments - use unaligned_memcpy().
Check for compiling for IPv6; don't check whether we can create an IPv6 socket.
Use unaligned_memcmp() to compare with IPv{4,6} addresses in a packet.
Use EXTRACT_nBITS even when just testing against zero.
Fix some more unaligned accesses.
...
Change-Id: I9e98707d30c989b9e32dcd5af798bd0746ab4434
diff --git a/print-syslog.c b/print-syslog.c
old mode 100755
new mode 100644
index 099d027..f213cf2
--- a/print-syslog.c
+++ b/print-syslog.c
@@ -16,7 +16,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-syslog.c,v 1.1 2004/10/29 11:42:53 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-syslog.c,v 1.1 2004-10-29 11:42:53 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,9 +30,8 @@
#include "interface.h"
#include "extract.h"
-#include "addrtoname.h"
-/*
+/*
* tokenlists and #defines taken from Ethereal - Network traffic analyzer
* by Gerald Combs <gerald@ethereal.com>
*/
@@ -94,31 +93,22 @@
* severity and facility values
*/
- if (!TTEST2(*pptr, 1))
- goto trunc;
-
+ TCHECK2(*pptr, 1);
if (*(pptr+msg_off) == '<') {
msg_off++;
-
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
-
+ TCHECK2(*(pptr+msg_off), 1);
while ( *(pptr+msg_off) >= '0' &&
*(pptr+msg_off) <= '9' &&
msg_off <= SYSLOG_MAX_DIGITS) {
-
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
-
pri = pri * 10 + (*(pptr+msg_off) - '0');
msg_off++;
-
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
-
- if (*(pptr+msg_off) == '>')
- msg_off++;
+ TCHECK2(*(pptr+msg_off), 1);
}
+ if (*(pptr+msg_off) != '>') {
+ printf("[|syslog]");
+ return;
+ }
+ msg_off++;
} else {
printf("[|syslog]");
return;
@@ -127,7 +117,6 @@
facility = (pri & SYSLOG_FACILITY_MASK) >> 3;
severity = pri & SYSLOG_SEVERITY_MASK;
-
if (vflag < 1 )
{
printf("SYSLOG %s.%s, length: %u",
@@ -136,7 +125,7 @@
len);
return;
}
-
+
printf("SYSLOG, length: %u\n\tFacility %s (%u), Severity %s (%u)\n\tMsg: ",
len,
tok2str(syslog_facility_values, "unknown (%u)", facility),
@@ -146,16 +135,13 @@
/* print the syslog text in verbose mode */
for (; msg_off < len; msg_off++) {
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
- safeputchar(*(pptr+msg_off));
+ TCHECK2(*(pptr+msg_off), 1);
+ safeputchar(*(pptr+msg_off));
}
- if (vflag > 1) {
- if(!print_unknown_data(pptr,"\n\t",len))
- return;
- }
-
+ if (vflag > 1)
+ print_unknown_data(pptr,"\n\t",len);
+
return;
trunc: