aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packet-ip.c53
-rw-r--r--packet-tcp.c16
2 files changed, 34 insertions, 35 deletions
diff --git a/packet-ip.c b/packet-ip.c
index eb2933a7f3..562b451c1a 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.21 1999/04/05 21:54:39 guy Exp $
+ * $Id: packet-ip.c,v 1.22 1999/05/12 20:44:58 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -604,32 +604,33 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
col_add_str(fd, COL_RES_NET_DST, get_hostname(iph.ip_dst));
if (check_col(fd, COL_UNRES_NET_DST))
col_add_str(fd, COL_UNRES_NET_DST, ip_to_str((guint8 *) &iph.ip_dst));
-
- switch (IPTOS_TOS(iph.ip_tos)) {
- case IPTOS_NONE:
- strcpy(tos_str, "None");
- break;
- case IPTOS_LOWCOST:
- strcpy(tos_str, "Minimize cost");
- break;
- case IPTOS_RELIABILITY:
- strcpy(tos_str, "Maximize reliability");
- break;
- case IPTOS_THROUGHPUT:
- strcpy(tos_str, "Maximize throughput");
- break;
- case IPTOS_LOWDELAY:
- strcpy(tos_str, "Minimize delay");
- break;
- case IPTOS_SECURITY:
- strcpy(tos_str, "Maximize security");
- break;
- default:
- strcpy(tos_str, "Unknown. Malformed?");
- break;
- }
-
+
if (tree) {
+
+ switch (IPTOS_TOS(iph.ip_tos)) {
+ case IPTOS_NONE:
+ strcpy(tos_str, "None");
+ break;
+ case IPTOS_LOWCOST:
+ strcpy(tos_str, "Minimize cost");
+ break;
+ case IPTOS_RELIABILITY:
+ strcpy(tos_str, "Maximize reliability");
+ break;
+ case IPTOS_THROUGHPUT:
+ strcpy(tos_str, "Maximize throughput");
+ break;
+ case IPTOS_LOWDELAY:
+ strcpy(tos_str, "Minimize delay");
+ break;
+ case IPTOS_SECURITY:
+ strcpy(tos_str, "Maximize security");
+ break;
+ default:
+ strcpy(tos_str, "Unknown. Malformed?");
+ break;
+ }
+
ti = proto_tree_add_item(tree, offset, hlen, "Internet Protocol");
ip_tree = proto_tree_new();
proto_item_add_subtree(ti, ip_tree, ETT_IP);
diff --git a/packet-tcp.c b/packet-tcp.c
index 8793c62fe9..7fb3197db8 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.21 1999/04/30 03:16:02 guy Exp $
+ * $Id: packet-tcp.c,v 1.22 1999/05/12 20:44:59 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -430,18 +430,16 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
}
/* Decode TCP options, if any. */
- if (hlen > sizeof (e_tcphdr)) {
+ if (tree && hlen > sizeof (e_tcphdr)) {
/* There's more than just the fixed-length header. Decode the
options. */
optlen = hlen - sizeof (e_tcphdr); /* length of options, in bytes */
- if (tree) {
- tf = proto_tree_add_item(tcp_tree, offset + 20, optlen,
- "Options: (%d bytes)", optlen);
- field_tree = proto_tree_new();
- proto_item_add_subtree(tf, field_tree, ETT_TCP_OPTIONS);
- }
+ tf = proto_tree_add_item(tcp_tree, offset + 20, optlen,
+ "Options: (%d bytes)", optlen);
+ field_tree = proto_tree_new();
+ proto_item_add_subtree(tf, field_tree, ETT_TCP_OPTIONS);
dissect_ip_tcp_options(field_tree, &pd[offset + 20], offset + 20, optlen,
- tcpopts, N_TCP_OPTS, TCPOPT_EOL);
+ tcpopts, N_TCP_OPTS, TCPOPT_EOL);
}
if (check_col(fd, COL_INFO))