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-ppp.c b/print-ppp.c
index 1e99c15..0ae8811 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.108.2.6 2005/12/05 11:40:36 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.114 2005-12-05 11:35:58 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -65,7 +65,7 @@
/* Protocol Codes defined in ppp.h */
-struct tok ppptype2str[] = {
+static const struct tok ppptype2str[] = {
{ PPP_IP, "IP" },
{ PPP_OSI, "OSI" },
{ PPP_NS, "NS" },
@@ -129,7 +129,7 @@
#define CPCODES_RESET_REQ 14 /* Reset-Request (CCP only) RFC1962 */
#define CPCODES_RESET_REP 15 /* Reset-Reply (CCP only) */
-struct tok cpcodes[] = {
+static const struct tok cpcodes[] = {
{CPCODES_VEXT, "Vendor-Extension"}, /* RFC2153 */
{CPCODES_CONF_REQ, "Conf-Request"},
{CPCODES_CONF_ACK, "Conf-Ack"},
@@ -243,7 +243,7 @@
/* 27-254 unassigned */
#define CCPOPT_RESV 255 /* RFC1962 */
-const struct tok ccpconfopts_values[] = {
+static const struct tok ccpconfopts_values[] = {
{ CCPOPT_OUI, "OUI" },
{ CCPOPT_PRED1, "Pred-1" },
{ CCPOPT_PRED2, "Pred-2" },
@@ -266,7 +266,7 @@
#define BACPOPT_FPEER 1 /* RFC2125 */
-const struct tok bacconfopts_values[] = {
+static const struct tok bacconfopts_values[] = {
{ BACPOPT_FPEER, "Favored-Peer" },
{0, NULL}
};
@@ -284,7 +284,7 @@
#define IPCPOPT_SECDNS 131 /* RFC1877 */
#define IPCPOPT_SECNBNS 132 /* RFC1877 */
-struct tok ipcpopt_values[] = {
+static const struct tok ipcpopt_values[] = {
{ IPCPOPT_2ADDR, "IP-Addrs" },
{ IPCPOPT_IPCOMP, "IP-Comp" },
{ IPCPOPT_ADDR, "IP-Addr" },
@@ -299,13 +299,13 @@
#define IPCPOPT_IPCOMP_HDRCOMP 0x61 /* rfc3544 */
#define IPCPOPT_IPCOMP_MINLEN 14
-struct tok ipcpopt_compproto_values[] = {
+static const struct tok ipcpopt_compproto_values[] = {
{ PPP_VJC, "VJ-Comp" },
{ IPCPOPT_IPCOMP_HDRCOMP, "IP Header Compression" },
{ 0, NULL }
};
-struct tok ipcpopt_compproto_subopt_values[] = {
+static const struct tok ipcpopt_compproto_subopt_values[] = {
{ 1, "RTP-Compression" },
{ 2, "Enhanced RTP-Compression" },
{ 0, NULL }
@@ -314,7 +314,7 @@
/* IP6CP Config Options */
#define IP6CP_IFID 1
-struct tok ip6cpopt_values[] = {
+static const struct tok ip6cpopt_values[] = {
{ IP6CP_IFID, "Interface-ID" },
{ 0, NULL }
};
@@ -333,7 +333,7 @@
#define AUTHALG_MSCHAP1 128 /* RFC2433 */
#define AUTHALG_MSCHAP2 129 /* RFC2795 */
-struct tok authalg_values[] = {
+static const struct tok authalg_values[] = {
{ AUTHALG_CHAPMD5, "MD5" },
{ AUTHALG_MSCHAP1, "MS-CHAPv1" },
{ AUTHALG_MSCHAP2, "MS-CHAPv2" },
@@ -358,7 +358,7 @@
#define CALLBACK_X500 4 /* X.500 distinguished name */
#define CALLBACK_CBCP 6 /* Location is determined during CBCP nego */
-struct tok ppp_callback_values[] = {
+static const struct tok ppp_callback_values[] = {
{ CALLBACK_AUTH, "UserAuth" },
{ CALLBACK_DSTR, "DialString" },
{ CALLBACK_LID, "LocalID" },
@@ -375,7 +375,7 @@
#define CHAP_SUCC 3
#define CHAP_FAIL 4
-struct tok chapcode_values[] = {
+static const struct tok chapcode_values[] = {
{ CHAP_CHAL, "Challenge" },
{ CHAP_RESP, "Response" },
{ CHAP_SUCC, "Success" },
@@ -389,7 +389,7 @@
#define PAP_AACK 2
#define PAP_ANAK 3
-struct tok papcode_values[] = {
+static const struct tok papcode_values[] = {
{ PAP_AREQ, "Auth-Req" },
{ PAP_AACK, "Auth-ACK" },
{ PAP_ANAK, "Auth-NACK" },
@@ -773,7 +773,7 @@
}
/* ML-PPP*/
-struct tok ppp_ml_flag_values[] = {
+static const struct tok ppp_ml_flag_values[] = {
{ 0x80, "begin" },
{ 0x40, "end" },
{ 0, NULL }
@@ -1303,11 +1303,11 @@
goto cleanup;
#ifdef INET6
case PPP_IPV6:
- ip6_print(b+1, t - b - 1);
- goto cleanup;
+ ip6_print(gndo, b+1, t - b - 1);
+ goto cleanup;
#endif
default: /* no luck - try next guess */
- break;
+ break;
}
proto = EXTRACT_16BITS(b); /* next guess - load two octets */
@@ -1368,7 +1368,7 @@
#ifdef INET6
case ETHERTYPE_IPV6: /*XXX*/
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case ETHERTYPE_IPX: /*XXX*/
@@ -1629,7 +1629,7 @@
hdrlength += 1;
} else {
/* Un-compressed protocol field */
- ptype = ntohs(*(u_int16_t *)p);
+ ptype = EXTRACT_16BITS(p);
if (eflag)
printf("%04x ", ptype);
p += 2;
@@ -1649,7 +1649,7 @@
&& ph->phdr_ctl == PPP_CONTROL) {
if (eflag)
printf("%02x %02x ", q[0], q[1]);
- ptype = ntohs(ph->phdr_type);
+ ptype = EXTRACT_16BITS(&ph->phdr_type);
if (eflag && (ptype == PPP_VJC || ptype == PPP_VJNC)) {
printf("%s ", tok2str(ppptype2str,
"proto-#%d", ptype));
@@ -1675,11 +1675,11 @@
p += hdrlength;
switch (ptype) {
case PPP_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case PPP_MPLS_UCAST:
@@ -1694,11 +1694,11 @@
p += hdrlength;
switch (ptype) {
case PPP_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case PPP_MPLS_UCAST:
@@ -1730,12 +1730,12 @@
break;
#ifdef INET6
case PPP_IPV6:
- ip6_print(p, length);
+ ip6_print(gndo, p, length);
break;
#endif
case PPP_MPLS_UCAST:
case PPP_MPLS_MCAST:
- mpls_print(p, length);
+ mpls_print(gndo, p, length);
break;
default:
printf("%s ", tok2str(ppptype2str, "unknown PPP protocol (0x%04x)", ptype));