Don't loop infinitely if we see a Host Address or unknown Forwarding
authorGuy Harris <guy@alum.mit.edu>
Mon, 4 Dec 2000 06:05:49 +0000 (06:05 -0000)
committerGuy Harris <guy@alum.mit.edu>
Mon, 4 Dec 2000 06:05:49 +0000 (06:05 -0000)
Equivalence Class.

Set "pinfo->current_proto", so that if we run past the end of the data
the problem is noted as being with LDP.

svn path=/trunk/; revision=2743

packet-ldp.c

index 2966e886e5d3ae1552b53edac7f70f93b77a2a6c..70a4add32dbc0f7f7ce09ab098e26949c145acc1 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ldp.c
  * Routines for ldp packet disassembly
  *
- * $Id: packet-ldp.c,v 1.8 2000/12/03 02:37:56 sharpe Exp $
+ * $Id: packet-ldp.c,v 1.9 2000/12/04 06:05:49 guy Exp $
  * 
  * Copyright (c) November 2000 by Richard Sharpe <rsharpe@ns.aus.com>
  *
@@ -295,6 +295,8 @@ int dissect_tlv(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
 
          offset += 1;
 
+         /* XXX - the address family length should be extracted and used to
+            dissect the prefix field. */
          proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_af, tvb, offset, 2, FALSE);
          offset += 2;
 
@@ -311,10 +313,21 @@ int dissect_tlv(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
 
        case 3:   /* Host address */
 
+         /* XXX - write me. */
+
+         fec_len -= 8;
+
+         offset += 8;
+
          break;
 
        default:  /* Unknown */
 
+          /* XXX - do all FEC's have a length that's a multiple of 4? */
+
+         fec_len -= 4;
+
+         offset += 4;
 
          break;
 
@@ -518,6 +531,8 @@ dissect_ldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
   CHECK_DISPLAY_AS_DATA(proto_ldp, tvb, pinfo, tree);
 
+  pinfo->current_proto = "LDP";
+
   if (check_col(pinfo->fd, COL_PROTOCOL))
 
     col_add_str(pinfo->fd, COL_PROTOCOL, "LDP");