diff options
-rw-r--r-- | packet-raw.c | 47 | ||||
-rw-r--r-- | packet-raw.h | 4 | ||||
-rw-r--r-- | packet.c | 4 |
3 files changed, 32 insertions, 23 deletions
diff --git a/packet-raw.c b/packet-raw.c index 5a3497751d..7730d27436 100644 --- a/packet-raw.c +++ b/packet-raw.c @@ -1,7 +1,7 @@ /* packet-raw.c * Routines for raw packet disassembly * - * $Id: packet-raw.c,v 1.15 2000/05/19 05:29:42 guy Exp $ + * $Id: packet-raw.c,v 1.16 2000/05/19 21:47:37 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -57,27 +57,31 @@ capture_raw( const u_char *pd, packet_counts *ld ) { } void -dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) { - proto_tree *fh_tree; - proto_item *ti; +dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *fh_tree; + proto_item *ti; + tvbuff_t *next_tvb; + const guint8 *next_pd; + int next_offset; /* 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, "Raw packet data" ); + if(check_col(pinfo->fd, COL_RES_DL_SRC)) + col_add_str(pinfo->fd, COL_RES_DL_SRC, "N/A" ); + if(check_col(pinfo->fd, COL_RES_DL_DST)) + col_add_str(pinfo->fd, COL_RES_DL_DST, "N/A" ); + if(check_col(pinfo->fd, COL_PROTOCOL)) + col_add_str(pinfo->fd, COL_PROTOCOL, "N/A" ); + if(check_col(pinfo->fd, COL_INFO)) + col_add_str(pinfo->fd, COL_INFO, "Raw packet data" ); /* populate a tree in the second pane with the status of the link layer (ie none) */ - if(tree) { - ti = proto_tree_add_text(tree, NullTVB, 0, 0, "Raw packet data" ); + if (tree) { + ti = proto_tree_add_text(tree, tvb, 0, 0, "Raw packet data" ); fh_tree = proto_item_add_subtree(ti, ett_raw); - proto_tree_add_text(fh_tree, NullTVB, 0, 0, "No link information available"); + proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available"); } /* So far, the only time we get raw connection types are with Linux and @@ -88,10 +92,15 @@ dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) { /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header * sometimes. This check should be removed when 2.2 is out. */ - if (pd[0] == 0xff && pd[1] == 0x03) - dissect_ip(pd, 4, fd, tree); - else - dissect_ip(pd, 0, fd, tree); + if (tvb_get_ntohs(tvb, 0) == 0xff03) { + next_tvb = tvb_new_subset(tvb, 4, -1, -1); + tvb_compat(next_tvb, &next_pd, &next_offset); + } + else { + tvb_compat(tvb, &next_pd, &next_offset); + } + + dissect_ip(next_pd, next_offset, pinfo->fd, tree); } void diff --git a/packet-raw.h b/packet-raw.h index 559c032c67..12c7835577 100644 --- a/packet-raw.h +++ b/packet-raw.h @@ -1,6 +1,6 @@ /* packet-raw.h * - * $Id: packet-raw.h,v 1.1 2000/02/15 21:02:58 gram Exp $ + * $Id: packet-raw.h,v 1.2 2000/05/19 21:47:37 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -23,4 +23,4 @@ */ void capture_raw(const u_char *, packet_counts *); -void dissect_raw(const u_char *, frame_data *, proto_tree *); +void dissect_raw(tvbuff_t *, packet_info *, proto_tree *); @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.86 2000/05/19 04:54:34 gram Exp $ + * $Id: packet.c,v 1.87 2000/05/19 21:47:38 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1196,7 +1196,7 @@ dissect_packet(union pseudo_header *pseudo_header, const u_char *pd, dissect_lapb(pseudo_header, pd, fd, tree); break; case WTAP_ENCAP_RAW_IP : - dissect_raw(pd, fd, tree); + dissect_raw(tvb, &pi, tree); break; case WTAP_ENCAP_LINUX_ATM_CLIP : dissect_clip(pd, fd, tree); |