Ethereal-dev: Re: [Ethereal-dev] HSRP Undocumented Opcode
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Sat, 24 Sep 2005 00:29:13 +0200
On Thu, Sep 22, 2005 at 06:17:16PM +0200, Joerg Mayer wrote: > OK, now I've understood what you want :) I'll look into it - it shouldn't > be too hard. Please test the attached patch, both with normal and with opcode 3 packets. The only test I've done is "it compiles for me". Ciao Joerg -- Joerg Mayer <jmayer@xxxxxxxxx> We are stuck with technology when what we really want is just stuff that works. Some say that should read Microsoft instead of technology.
Index: epan/dissectors/packet-hsrp.c =================================================================== --- epan/dissectors/packet-hsrp.c (revision 15982) +++ epan/dissectors/packet-hsrp.c (working copy) @@ -30,7 +30,7 @@ /* TODO: Looks like there is some new opcode 3, which has a different * packet layout. For some discussion on the new type, see * http://www.atm.tut.fi/list-archive/cisco-nsp/msg08882.html and - * http://www.cisco.com/en/US/products/sw/iosswrel/ps1834/products_feature_guide09186a00800e9763.html#xtocid5 + * http://www.cisco.com/en/US/products/sw/iosswrel/ps1834/products_feature_guide09186a00800e9763.html */ @@ -43,6 +43,7 @@ #include <epan/packet.h> static gint proto_hsrp = -1; +static dissector_handle_t data_handle; static gint hf_hsrp_version = -1; static gint hf_hsrp_opcode = -1; @@ -105,6 +106,7 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 opcode, state; + tvbuff_t *next_tvb; if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "HSRP"); @@ -134,36 +136,40 @@ offset++; proto_tree_add_uint(hsrp_tree, hf_hsrp_opcode, tvb, offset, 1, opcode); offset++; - proto_tree_add_uint(hsrp_tree, hf_hsrp_state, tvb, offset, 1, state); - offset++; - hellotime = tvb_get_guint8(tvb, offset); - proto_tree_add_uint_format(hsrp_tree, hf_hsrp_hellotime, tvb, offset, 1, hellotime, + if (opcode < 3) { + proto_tree_add_uint(hsrp_tree, hf_hsrp_state, tvb, offset, 1, state); + offset++; + hellotime = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(hsrp_tree, hf_hsrp_hellotime, tvb, offset, 1, hellotime, "Hellotime: %sDefault (%u)", (hellotime == HSRP_DEFAULT_HELLOTIME) ? "" : "Non-", hellotime); - offset++; - holdtime = tvb_get_guint8(tvb, offset); - proto_tree_add_uint_format(hsrp_tree, hf_hsrp_holdtime, tvb, offset, 1, holdtime, + offset++; + holdtime = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(hsrp_tree, hf_hsrp_holdtime, tvb, offset, 1, holdtime, "Holdtime: %sDefault (%u)", (holdtime == HSRP_DEFAULT_HOLDTIME) ? "" : "Non-", holdtime); - offset++; - proto_tree_add_item(hsrp_tree, hf_hsrp_priority, tvb, offset, 1, FALSE); - offset++; - proto_tree_add_item(hsrp_tree, hf_hsrp_group, tvb, offset, 1, FALSE); - offset++; - proto_tree_add_item(hsrp_tree, hf_hsrp_reserved, tvb, offset, 1, FALSE); - offset++; - tvb_memcpy(tvb, auth_buf, offset, 8); - auth_buf[sizeof auth_buf - 1] = '\0'; - proto_tree_add_string_format(hsrp_tree, hf_hsrp_auth_data, tvb, offset, 8, auth_buf, + offset++; + proto_tree_add_item(hsrp_tree, hf_hsrp_priority, tvb, offset, 1, FALSE); + offset++; + proto_tree_add_item(hsrp_tree, hf_hsrp_group, tvb, offset, 1, FALSE); + offset++; + proto_tree_add_item(hsrp_tree, hf_hsrp_reserved, tvb, offset, 1, FALSE); + offset++; + tvb_memcpy(tvb, auth_buf, offset, 8); + auth_buf[sizeof auth_buf - 1] = '\0'; + proto_tree_add_string_format(hsrp_tree, hf_hsrp_auth_data, tvb, offset, 8, auth_buf, "Authentication Data: %sDefault (%s)", (tvb_strneql(tvb, offset, "cisco", strlen("cisco"))) == 0 ? "" : "Non-", auth_buf); - offset += 8; - proto_tree_add_item(hsrp_tree, hf_hsrp_virt_ip_addr, tvb, offset, 4, FALSE); - offset += 4; - + offset += 8; + proto_tree_add_item(hsrp_tree, hf_hsrp_virt_ip_addr, tvb, offset, 4, FALSE); + offset += 4; + } else { + next_tvb = tvb_new_subset(tvb, offset, -1, -1); + call_dissector(data_handle, next_tvb, pinfo, hsrp_tree); + } } return; @@ -241,6 +247,7 @@ { dissector_handle_t hsrp_handle; + data_handle = find_dissector("data"); hsrp_handle = create_dissector_handle(dissect_hsrp, proto_hsrp); dissector_add("udp.port", UDP_PORT_HSRP, hsrp_handle); }
- References:
- RE: [Ethereal-dev] HSRP Undocumented Opcode
- From: Baldwin, Nick
- Re: [Ethereal-dev] HSRP Undocumented Opcode
- From: Joerg Mayer
- RE: [Ethereal-dev] HSRP Undocumented Opcode
- Prev by Date: [Ethereal-dev] [Patch] to packet-stun.c
- Next by Date: Re: [Ethereal-dev] Should "dissect_tpkt_encap()" check only its "desegment" argument, rather than sometimes directly checking tpkt_desegment?
- Previous by thread: Re: [Ethereal-dev] HSRP Undocumented Opcode
- Next by thread: RE: [Ethereal-dev] HSRP Undocumented Opcode
- Index(es):