diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-04-13 00:02:55 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-04-13 00:02:55 +0000 |
commit | b811d2cbe8ea12c1391d79858cb7ddf3b5cfe692 (patch) | |
tree | 3fa48f1017393756f76b69b84c02be786d9bfe3d /packet-frame.c | |
parent | 661056aac4b7e2cea02d15bd175a1f0bb97c1ef3 (diff) | |
download | wireshark-b811d2cbe8ea12c1391d79858cb7ddf3b5cfe692.tar.gz wireshark-b811d2cbe8ea12c1391d79858cb7ddf3b5cfe692.tar.bz2 wireshark-b811d2cbe8ea12c1391d79858cb7ddf3b5cfe692.zip |
"pinfo->pseudo_header" might be null, even for link-layer types such as
WTAP_ENCAP_CHDLC; check whether it's null before using it.
Use FROM_DCE rather than 0x80 to check the "this is DCE->DTE" bit in
"x25.flags".
svn path=/trunk/; revision=5148
Diffstat (limited to 'packet-frame.c')
-rw-r--r-- | packet-frame.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/packet-frame.c b/packet-frame.c index dd8b9cf9f7..b0ac92ee3f 100644 --- a/packet-frame.c +++ b/packet-frame.c @@ -2,7 +2,7 @@ * * Top-most dissector. Decides dissector based on Wiretap Encapsulation Type. * - * $Id: packet-frame.c,v 1.23 2002/04/08 20:30:52 gram Exp $ + * $Id: packet-frame.c,v 1.24 2002/04/13 00:02:55 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -72,16 +72,23 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->current_proto = "Frame"; - if (pinfo->fd->lnk_t == WTAP_ENCAP_LAPD || - pinfo->fd->lnk_t == WTAP_ENCAP_CHDLC || - pinfo->fd->lnk_t == WTAP_ENCAP_PPP_WITH_PHDR) { - - pinfo->p2p_dir = pinfo->pseudo_header->p2p.sent ? P2P_DIR_SENT : P2P_DIR_RECV; - } - else if (pinfo->fd->lnk_t == WTAP_ENCAP_LAPB || - pinfo->fd->lnk_t == WTAP_ENCAP_FRELAY) { - - pinfo->p2p_dir = (pinfo->pseudo_header->x25.flags & 0x80) ? P2P_DIR_RECV : P2P_DIR_SENT; + if (pinfo->pseudo_header != NULL) { + switch (pinfo->fd->lnk_t) { + + case WTAP_ENCAP_LAPD: + case WTAP_ENCAP_CHDLC: + case WTAP_ENCAP_PPP_WITH_PHDR: + pinfo->p2p_dir = pinfo->pseudo_header->p2p.sent ? + P2P_DIR_SENT : P2P_DIR_RECV; + break; + + case WTAP_ENCAP_LAPB: + case WTAP_ENCAP_FRELAY: + pinfo->p2p_dir = + (pinfo->pseudo_header->x25.flags & FROM_DCE) ? + P2P_DIR_RECV : P2P_DIR_SENT; + break; + } } /* Put in frame header information. */ |