Ethereal-dev: [Ethereal-dev] [patch] PIM hello options decode (again)
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: "Kevin Humphries" <khumphries@xxxxxxxxxxxx>
Date: Wed, 17 Apr 2002 22:45:26 -0600
The last message word wrapped some of the lines, so lets try it again. Kevin Index: packet-pim.c =================================================================== RCS file: /cvsroot/ethereal/packet-pim.c,v retrieving revision 1.39 diff -u -r1.39 packet-pim.c --- packet-pim.c 2002/02/01 07:06:32 1.39 +++ packet-pim.c 2002/04/18 03:47:24 @@ -749,17 +749,65 @@ case 0: /*hello*/ { while (tvb_reported_length_remaining(tvb, offset) >= 2) { - if (tvb_get_ntohs(tvb, offset) == 1 && - tvb_get_ntohs(tvb, offset + 2) == 2) { - guint16 holdtime; + guint16 hello_opt, opt_len; + guint16 holdtime; + guint16 lan_delay; + guint16 override_interval; + guint32 priority; + guint32 opt_value = 0; - holdtime = tvb_get_ntohs(tvb, offset + 4); - proto_tree_add_text(pimopt_tree, tvb, offset, 6, - "Holdtime: %u%s", holdtime, - holdtime == 0xffff ? " (infty)" : ""); - offset += 6; - } else - break; + hello_opt = tvb_get_ntohs(tvb, offset); + opt_len = tvb_get_ntohs(tvb, offset + 2); + + if(opt_len == 2) + opt_value = tvb_get_ntohs(tvb, offset + 4); + if(opt_len == 4) + opt_value = tvb_get_ntohl(tvb, offset + 4); + + switch(hello_opt) { + case 1: /* holdtime */ + holdtime = opt_value; + proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, + "Holdtime: %u%s", holdtime, + holdtime == 0xffff ? " (infty)" : ""); + break; + case 2: /* LAN prune delay */ + { + proto_tree *sub_tree = NULL; + proto_item *landelay_option; + + landelay_option = proto_tree_add_text(pim_tree, tvb, offset, -1, + "LAN Prune Delay"); + sub_tree = proto_item_add_subtree(landelay_option, ett_pim); + + lan_delay = (opt_value & 0x7f00) >> 8; + override_interval = opt_value & 0xff; + proto_tree_add_text(sub_tree, tvb, offset, 4 + opt_len, + "T bit is %s", + opt_value & 0x8000 ? "set" : "not set"); + proto_tree_add_text(sub_tree, tvb, offset, 4 + opt_len, + "LAN Delay: %u", lan_delay); + proto_tree_add_text(sub_tree, tvb, offset, 4 + opt_len, + "Override Interval: %u", override_interval); + break; + } + case 19: /* priority */ + priority = opt_value; + proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, + "DR Priority: %u", priority); + break; + case 20: /* generation ID */ + proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, + "Generation ID: %d", opt_value); + break; + + default: + proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, + "Unknown option: %d len: %d value: 0x%x", + hello_opt, opt_len, opt_value); + break; + } + offset += 4 + opt_len; } break; }
- Follow-Ups:
- Re: [Ethereal-dev] [patch] PIM hello options decode (again)
- From: Guy Harris
- Re: [Ethereal-dev] [patch] PIM hello options decode (again)
- Prev by Date: [Ethereal-dev] [patch] PIM hello options decode
- Next by Date: Re: [Ethereal-dev] [patch] PIM hello options decode (again)
- Previous by thread: [Ethereal-dev] [patch] PIM hello options decode
- Next by thread: Re: [Ethereal-dev] [patch] PIM hello options decode (again)
- Index(es):