aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tcp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-06-02 01:28:47 +0000
committerGuy Harris <guy@alum.mit.edu>1999-06-02 01:28:47 +0000
commita8f72707e1b6f317615b2a60f9646f426e315a6a (patch)
tree98d00578902028cbd438caa59ca85840906964d2 /packet-tcp.c
parent885e4ddfcd9841eab2678ff31eee8ea641672937 (diff)
downloadwireshark-a8f72707e1b6f317615b2a60f9646f426e315a6a.tar.gz
wireshark-a8f72707e1b6f317615b2a60f9646f426e315a6a.tar.bz2
wireshark-a8f72707e1b6f317615b2a60f9646f426e315a6a.zip
When checking to see if a packet is of a given type by checking the
source and destination port numbers, check both port numbers against the specified port, rather than checking the lower of the two port numbers against the specified port, just in case you happen to either have 1) the port number for that type being high enough that you can get client sockets using it or 2) client sockets using it for some other reason. svn path=/trunk/; revision=301
Diffstat (limited to 'packet-tcp.c')
-rw-r--r--packet-tcp.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/packet-tcp.c b/packet-tcp.c
index 7fb3197db8..128ce65074 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.22 1999/05/12 20:44:59 deniel Exp $
+ * $Id: packet-tcp.c,v 1.23 1999/06/02 01:28:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -454,48 +454,32 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
/* Check the packet length to see if there's more data
(it could be an ACK-only packet) */
if (packet_max > offset) {
- switch(MIN(th.th_sport, th.th_dport)) {
-
- case TCP_PORT_PRINTER:
+ /* XXX - this should be handled the way UDP handles this, with a table
+ of port numbers to which stuff can be added */
+#define PORT_IS(port) (th.th_sport == port || th.th_dport == port)
+ if (PORT_IS(TCP_PORT_PRINTER))
dissect_lpd(pd, offset, fd, tree);
- break;
-
- case TCP_PORT_TELNET:
+ else if (PORT_IS(TCP_PORT_TELNET)) {
pi.match_port = TCP_PORT_TELNET;
dissect_telnet(pd, offset, fd, tree, payload);
- break;
-
- case TCP_PORT_FTPDATA:
+ } else if (PORT_IS(TCP_PORT_FTPDATA)) {
pi.match_port = TCP_PORT_FTPDATA;
dissect_ftpdata(pd, offset, fd, tree, payload);
- break;
-
- case TCP_PORT_FTP:
+ } else if (PORT_IS(TCP_PORT_FTP)) {
pi.match_port = TCP_PORT_FTP;
dissect_ftp(pd, offset, fd, tree, payload);
- break;
-
- case TCP_PORT_POP:
+ } else if (PORT_IS(TCP_PORT_POP)) {
pi.match_port = TCP_PORT_POP;
dissect_pop(pd, offset, fd, tree, payload);
- break;
-
- case TCP_PORT_NNTP:
+ } else if (PORT_IS(TCP_PORT_NNTP)) {
pi.match_port = TCP_PORT_NNTP;
dissect_nntp(pd, offset, fd, tree, payload);
- break;
-
- case TCP_PORT_HTTP:
- case TCP_ALT_PORT_HTTP:
- dissect_http(pd, offset, fd, tree);
- break;
-
- case TCP_PORT_NBSS:
+ } else if (PORT_IS(TCP_PORT_HTTP) || PORT_IS(TCP_ALT_PORT_HTTP))
+ dissect_http(pd, offset, fd, tree);
+ else if (PORT_IS(TCP_PORT_NBSS)) {
pi.match_port = TCP_PORT_NBSS;
dissect_nbss(pd, offset, fd, tree, payload);
- break;
-
- default:
+ } else {
/* check existence of high level protocols */
if (memcmp(&pd[offset], "GIOP", 4) == 0) {