Wireshark-dev: [Wireshark-dev] [PATCH] BFD dissector flag fixes

From: Bálint Réczey (IJ/ETH) <balint.reczey@xxxxxxxxxxxx>
Date: Tue, 8 Aug 2006 14:49:39 +0200
Hi,

The attached patch fixes decoding of message flags in BFD control packets.
Could someone commmit it?

Cheers,
Balint
Index: epan/dissectors/packet-bfd.c
===================================================================
--- epan/dissectors/packet-bfd.c	(revision 18852)
+++ epan/dissectors/packet-bfd.c	(working copy)
@@ -85,6 +85,8 @@
 static gint hf_bfd_flags_a = -1;
 static gint hf_bfd_flags_d = -1;
 static gint hf_bfd_flags_d_v0 = -1;
+static gint hf_bfd_flags_p_v0 = -1;
+static gint hf_bfd_flags_f_v0 = -1;
 static gint hf_bfd_detect_time_multiplier = -1;
 static gint hf_bfd_my_discriminator = -1;
 static gint hf_bfd_your_discriminator = -1;
@@ -159,6 +161,8 @@
     gint bfd_flags_a = -1;
     gint bfd_flags_d = -1;
     gint bfd_flags_d_v0 = -1;
+    gint bfd_flags_p_v0 = -1;
+    gint bfd_flags_f_v0 = -1;
     gint bfd_detect_time_multiplier = -1;
     gint bfd_length = -1;
     gint bfd_my_discriminator = -1;
@@ -183,6 +187,8 @@
 	bfd_flags = tvb_get_guint8(tvb, 1 );
         bfd_flags_h = (tvb_get_guint8(tvb, 1) & 0x80);
         bfd_flags_d_v0 = (tvb_get_guint8(tvb, 1) & 0x40);
+        bfd_flags_p_v0 = (tvb_get_guint8(tvb, 1) & 0x20);
+        bfd_flags_f_v0 = (tvb_get_guint8(tvb, 1) & 0x10);
 	break;
     case 1:
     default:
@@ -248,19 +254,21 @@
             ti = proto_tree_add_text ( bfd_tree, tvb, 1, 1, "Message Flags: 0x%02x",
 			               bfd_flags);
 	    bfd_flags_tree = proto_item_add_subtree(bfd_tree, ett_bfd_flags);
-	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_h, tvb, 8, 1, bfd_flags_h);
-	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_d_v0, tvb, 8, 1, bfd_flags_d_v0);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_h, tvb, 1, 1, bfd_flags_h);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_d_v0, tvb, 1, 1, bfd_flags_d_v0);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_p_v0, tvb, 1, 1, bfd_flags_p_v0);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_f_v0, tvb, 1, 1, bfd_flags_f_v0);
 	    break;
 	case 1:
 	default:
             ti = proto_tree_add_text ( bfd_tree, tvb, 1, 1, "Message Flags: 0x%02x",
 			               bfd_flags);
 	    bfd_flags_tree = proto_item_add_subtree(bfd_tree, ett_bfd_flags);
-	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_p, tvb, 6, 1, bfd_flags_p);
-	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_f, tvb, 6, 1, bfd_flags_f);
-	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_c, tvb, 6, 1, bfd_flags_c);
-	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_a, tvb, 6, 1, bfd_flags_a);
-	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_d, tvb, 6, 1, bfd_flags_d);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_p, tvb, 1, 1, bfd_flags_p);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_f, tvb, 1, 1, bfd_flags_f);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_c, tvb, 1, 1, bfd_flags_c);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_a, tvb, 1, 1, bfd_flags_a);
+	    ti =  proto_tree_add_boolean(bfd_flags_tree, hf_bfd_flags_d, tvb, 1, 1, bfd_flags_d);
 	    break;
 	}
 
@@ -333,6 +341,16 @@
             FT_BOOLEAN, 8, TFS(&flags_set_truth), 0x40,
             "", HFILL }
         },
+        { &hf_bfd_flags_p_v0,
+          { "Poll", "bfd.flags.p",
+            FT_BOOLEAN, 8, TFS(&flags_set_truth), 0x20,
+            "", HFILL }
+        },
+        { &hf_bfd_flags_f_v0,
+          { "Final", "bfd.flags.f",
+            FT_BOOLEAN, 8, TFS(&flags_set_truth), 0x10,
+            "", HFILL }
+        },
         { &hf_bfd_flags_p,
           { "Poll", "bfd.flags.p",
             FT_BOOLEAN, 6, TFS(&flags_set_truth), 0x20,