4 * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that: (1) source code distributions
9 * retain the above copyright notice and this paragraph in its entirety, (2)
10 * distributions including binary code include the above copyright notice and
11 * this paragraph in its entirety in the documentation or other materials
12 * provided with the distribution, and (3) all advertising materials mentioning
13 * features or use of this software display the following acknowledgement:
14 * ``This product includes software developed by the University of California,
15 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
16 * the University nor the names of its contributors may be used to endorse
17 * or promote products derived from this software without specific prior
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
28 #include <sys/cdefs.h>
31 static const char rcsid
[] _U_
=
32 "@(#) Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.15 2004/03/25 03:31:17 mcr Exp (LBL)";
34 __RCSID("$NetBSD: tcpdump2rcsid.ex,v 1.1 2001/06/25 20:09:58 itojun Exp $");
38 #include <tcpdump-stdinc.h>
43 #include "interface.h"
44 #include "addrtoname.h"
46 #include "slcompress.h"
50 * XXX - for BSD/OS PPP, what packets get supplied with a PPP header type
51 * of PPP_VJC and what packets get supplied with a PPP header type of
52 * PPP_VJNC? PPP_VJNC is for "UNCOMPRESSED_TCP" packets, and PPP_VJC
53 * is for COMPRESSED_TCP packets (PPP_IP is used for TYPE_IP packets).
55 * RFC 1144 implies that, on the wire, the packet type is *not* needed
56 * for PPP, as different PPP protocol types can be used; it only needs
57 * to be put on the wire for SLIP.
59 * It also indicates that, for compressed SLIP:
61 * If the COMPRESSED_TCP bit is set in the first byte, it's
62 * a COMPRESSED_TCP packet; that byte is the change byte, and
63 * the COMPRESSED_TCP bit, 0x80, isn't used in the change byte.
65 * If the upper 4 bits of the first byte are 7, it's an
66 * UNCOMPRESSED_TCP packet; that byte is the first byte of
67 * the UNCOMPRESSED_TCP modified IP header, with a connection
68 * number in the protocol field, and with the version field
71 * Otherwise, the packet is an IPv4 packet (where the upper 4 bits
72 * of the packet are 4).
74 * So this routine looks as if it's sort-of intended to handle
75 * compressed SLIP, although it doesn't handle UNCOMPRESSED_TCP
76 * correctly for that (it doesn't fix the version number and doesn't
77 * do anything to the protocol field), and doesn't check for COMPRESSED_TCP
78 * packets correctly for that (you only check the first bit - see
81 * But it's called for BSD/OS PPP, not SLIP - perhaps BSD/OS does weird
82 * things with the headers?
84 * Without a BSD/OS VJC-compressed PPP trace, or knowledge of what the
85 * BSD/OS VJC code does, we can't say what's the case.
87 * We therefore leave "proto" - which is the PPP protocol type - in place,
88 * *not* marked as unused, for now, so that GCC warnings about the
89 * unused argument remind us that we should fix this some day.
92 vjc_print(register const char *bp
, u_short proto _U_
)
96 switch (bp
[0] & 0xf0) {
99 printf("(vjc type=IP) ");
101 case TYPE_UNCOMPRESSED_TCP
:
103 printf("(vjc type=raw TCP) ");
105 case TYPE_COMPRESSED_TCP
:
107 printf("(vjc type=compressed TCP) ");
108 for (i
= 0; i
< 8; i
++) {
109 if (bp
[1] & (0x80 >> i
))
110 printf("%c", "?CI?SAWU"[i
]);
114 printf("C=0x%02x ", bp
[2]);
115 printf("sum=0x%04x ", *(u_short
*)&bp
[3]);
119 printf("(vjc type=error) ");
123 printf("(vjc type=0x%02x) ", bp
[0] & 0xf0);