2 * Routines for ppp packet disassembly
4 * $Id: packet-ppp.c,v 1.10 1999/03/23 03:14:43 gram Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
9 * This file created and by Mike Hall <mlh@io.com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #ifdef HAVE_SYS_TYPES_H
32 # include <sys/types.h>
38 /* PPP structs and definitions */
40 typedef struct _e_ppphdr {
47 /* Protocol types, from Linux "ppp_defs.h" and
49 http://www.isi.edu/in-notes/iana/assignments/ppp-numbers
52 #define PPP_IP 0x21 /* Internet Protocol */
53 #define PPP_AT 0x29 /* AppleTalk Protocol */
54 #define PPP_IPX 0x2b /* IPX protocol */
55 #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
56 #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
57 #define PPP_VINES 0x35 /* Banyan Vines */
58 #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
59 #define PPP_COMP 0xfd /* compressed packet */
60 #define PPP_IPCP 0x8021 /* IP Control Protocol */
61 #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
62 #define PPP_IPXCP 0x802b /* IPX Control Protocol */
63 #define PPP_CCP 0x80fd /* Compression Control Protocol */
64 #define PPP_LCP 0xc021 /* Link Control Protocol */
65 #define PPP_PAP 0xc023 /* Password Authentication Protocol */
66 #define PPP_LQR 0xc025 /* Link Quality Report protocol */
67 #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
68 #define PPP_CBCP 0xc029 /* Callback Control Protocol */
71 capture_ppp( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
72 switch (pntohs(&pd[2])) {
74 capture_ip(pd, 4, cap_len, ld);
83 dissect_ppp( const u_char *pd, frame_data *fd, proto_tree *tree ) {
88 static const value_string ppp_vals[] = {
90 {PPP_AT, "Appletalk" },
91 {PPP_IPX, "Netware IPX/SPX"},
92 {PPP_VINES, "Vines" },
98 ph.ppp_prot = pntohs(&pd[2]);
100 /* load the top pane info. This should be overwritten by
101 the next protocol in the stack */
102 if(check_col(fd, COL_RES_DL_SRC))
103 col_add_str(fd, COL_RES_DL_SRC, "N/A" );
104 if(check_col(fd, COL_RES_DL_DST))
105 col_add_str(fd, COL_RES_DL_DST, "N/A" );
106 if(check_col(fd, COL_PROTOCOL))
107 col_add_str(fd, COL_PROTOCOL, "N/A" );
108 if(check_col(fd, COL_INFO))
109 col_add_str(fd, COL_INFO, "PPP" );
111 /* populate a tree in the second pane with the status of the link
114 ti = proto_tree_add_item(tree, 0, 4, "Point-to-Point Protocol" );
115 fh_tree = proto_tree_new();
116 proto_item_add_subtree(ti, fh_tree, ETT_PPP);
117 proto_tree_add_item(fh_tree, 0, 1, "Address: %02x", ph.ppp_addr);
118 proto_tree_add_item(fh_tree, 1, 1, "Control: %02x", ph.ppp_ctl);
119 proto_tree_add_item(fh_tree, 2, 2, "Protocol: %s (0x%04x)",
120 val_to_str(ph.ppp_prot, ppp_vals, "Unknown"), ph.ppp_prot);
123 switch (ph.ppp_prot) {
125 dissect_ip(pd, 4, fd, tree);
128 dissect_ddp(pd, 4, fd, tree);
131 dissect_ipx(pd, 4, fd, tree);
134 dissect_vines(pd, 4, fd, tree);
137 dissect_ipv6(pd, 4, fd, tree);
140 dissect_data(pd, 4, fd, tree);
141 if (check_col(fd, COL_PROTOCOL))
142 col_add_fstr(fd, COL_PROTOCOL, "0x%04x", ph.ppp_prot);