Patches from Thierry Andry to support Classical IP captures from systems

with the ATM on Linux software from <http://lrcwww.epfl.ch/linux-atm/>.

svn path=/trunk/; revision=401
This commit is contained in:
Guy Harris 1999-07-28 23:16:42 +00:00
parent c4717a95d9
commit 6f1d3a3be8
8 changed files with 112 additions and 8 deletions

View File

@ -117,6 +117,10 @@ Olivier Abad <Olivier.Abad@capway.com> {
X.25 support in iptrace files
}
Thierry Andry <Thierry.Andry@advalvas.be> {
Linux ATM Classical IP support
}
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to
give his permission to use his version of snprintf.c.

View File

@ -37,6 +37,7 @@ ethereal_SOURCES = \
packet-atalk.c \
packet-bootp.c \
packet-cdp.c \
packet-clip.c \
packet-data.c \
packet-dns.c \
packet-dns.h \

View File

@ -1,6 +1,6 @@
/* ethereal.c
*
* $Id: ethereal.c,v 1.66 1999/07/28 03:29:01 guy Exp $
* $Id: ethereal.c,v 1.67 1999/07/28 23:16:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -167,6 +167,7 @@ about_ethereal( GtkWidget *w, gpointer data ) {
"Jason Lango <jal@netapp.com>\n"
"Johan Feyaerts <Johan.Feyaerts@siemens.atea.be>\n"
"Olivier Abad <Olivier.Abad@capway.com>\n"
"Thierry Andry <Thierry.Andry@advalvas.be>\n"
"\nSee http://ethereal.zing.org for more information",
VERSION, comp_info_str);

77
packet-clip.c Normal file
View File

@ -0,0 +1,77 @@
/* packet-clip.c
* Routines for clip packet disassembly
*
* $Id: packet-clip.c,v 1.1 1999/07/28 23:16:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
*
* This file created by Thierry Andry <Thierry.Andry@advalvas.be>
* from nearly-the-same packet-raw.c created by Mike Hall <mlh@io.com>
* Copyright 1999
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <glib.h>
#include "packet.h"
void
capture_clip( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
capture_ip(pd, 0, cap_len, ld);
}
void
dissect_clip( const u_char *pd, frame_data *fd, proto_tree *tree ) {
proto_tree *fh_tree;
proto_item *ti;
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
if(check_col(fd, COL_RES_DL_SRC))
col_add_str(fd, COL_RES_DL_SRC, "N/A" );
if(check_col(fd, COL_RES_DL_DST))
col_add_str(fd, COL_RES_DL_DST, "N/A" );
if(check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "N/A" );
if(check_col(fd, COL_INFO))
col_add_str(fd, COL_INFO, "Classical IP frame" );
/* populate a tree in the second pane with the status of the link
layer (ie none)
XXX - the ATM on Linux code includes a patch to "tcpdump"
that compares the first few bytes of the packet with the
LLC header that Classical IP frames may have and, if there's
a SNAP LLC header at the beginning of the packet, it gets
the packet type from that header and uses that, otherwise
it treats the packet as being raw IP with no link-level
header. */
if(tree) {
ti = proto_tree_add_text(tree, 0, 0, "Classical IP frame" );
fh_tree = proto_item_add_subtree(ti, ETT_CLIP);
proto_tree_add_text(fh_tree, 0, 0, "No link information available");
}
dissect_ip(pd, 0, fd, tree);
}

View File

@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
* $Id: packet.c,v 1.32 1999/07/22 16:03:51 gram Exp $
* $Id: packet.c,v 1.33 1999/07/28 23:16:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -684,6 +684,9 @@ dissect_packet(const u_char *pd, frame_data *fd, proto_tree *tree)
case WTAP_ENCAP_RAW_IP :
dissect_raw(pd, fd, tree);
break;
case WTAP_ENCAP_LINUX_ATM_CLIP :
dissect_clip(pd, fd, tree);
break;
}
}

View File

@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet.h,v 1.74 1999/07/28 03:29:00 guy Exp $
* $Id: packet.h,v 1.75 1999/07/28 23:16:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -203,6 +203,7 @@ enum {
ETT_OSPF_LSA,
ETT_LPD,
ETT_RAW,
ETT_CLIP,
ETT_BOOTP,
ETT_BOOTP_OPTION,
ETT_IPv6,
@ -354,6 +355,7 @@ void dissect_packet(const u_char *, frame_data *, proto_tree *);
* Routines should take three args: packet data *, cap_len, packet_counts *
* They should never modify the packet data.
*/
void capture_clip(const u_char *, guint32, packet_counts *);
void capture_eth(const u_char *, guint32, packet_counts *);
void capture_fddi(const u_char *, guint32, packet_counts *);
void capture_null(const u_char *, guint32, packet_counts *);
@ -375,6 +377,7 @@ void capture_ip(const u_char *, int, guint32, packet_counts *);
* Routines should take three args: packet data *, frame_data *, tree *
* They should never modify the packet data.
*/
void dissect_clip(const u_char *, frame_data *, proto_tree *);
void dissect_eth(const u_char *, frame_data *, proto_tree *);
void dissect_fddi(const u_char *, frame_data *, proto_tree *);
void dissect_null(const u_char *, frame_data *, proto_tree *);

View File

@ -1,6 +1,6 @@
/* libpcap.c
*
* $Id: libpcap.c,v 1.5 1999/07/13 02:53:24 gram Exp $
* $Id: libpcap.c,v 1.6 1999/07/28 23:16:42 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -87,7 +87,14 @@ int libpcap_open(wtap *wth)
WTAP_ENCAP_PPP,
WTAP_ENCAP_FDDI,
WTAP_ENCAP_ATM_RFC1483,
WTAP_ENCAP_RAW_IP
WTAP_ENCAP_RAW_IP,
WTAP_ENCAP_NONE,
WTAP_ENCAP_NONE,
WTAP_ENCAP_NONE,
WTAP_ENCAP_NONE,
WTAP_ENCAP_NONE,
WTAP_ENCAP_NONE,
WTAP_ENCAP_LINUX_ATM_CLIP
};
#define NUM_PCAP_ENCAPS (sizeof pcap_encap / sizeof pcap_encap[0])
int byte_swapped = 0;

View File

@ -1,6 +1,6 @@
/* wtap.h
*
* $Id: wtap.h,v 1.20 1999/07/13 02:53:26 gram Exp $
* $Id: wtap.h,v 1.21 1999/07/28 23:16:42 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -25,7 +25,14 @@
#define __WTAP_H__
/* Encapsulation types. Choose names that truly reflect
* what is contained in the packet trace file. */
* what is contained in the packet trace file.
*
* WTAP_ENCAP_LINUX_ATM_CLIP is the encapsulation you get with the
* ATM on Linux code from <http://lrcwww.epfl.ch/linux-atm/>;
* that code adds a DLT_ATM_CLIP DLT_ code of 19, and that
* encapsulation isn't the same as the DLT_ATM_RFC1483 encapsulation
* presumably used on some BSD systems, which we turn into
* WTAP_ENCAP_ATM_RFC1483. */
#define WTAP_ENCAP_NONE 0
#define WTAP_ENCAP_ETHERNET 1
#define WTAP_ENCAP_TR 2
@ -35,9 +42,10 @@
#define WTAP_ENCAP_RAW_IP 6
#define WTAP_ENCAP_ARCNET 7
#define WTAP_ENCAP_ATM_RFC1483 8
#define WTAP_ENCAP_LINUX_ATM_CLIP 9
/* last WTAP_ENCAP_ value + 1 */
#define WTAP_NUM_ENCAP_TYPES 9
#define WTAP_NUM_ENCAP_TYPES 10
/* File types that can be read by wiretap */
#define WTAP_FILE_UNKNOWN 0