diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2006-11-24 06:04:01 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2006-11-24 06:04:01 +0000 |
commit | b667477f8cebb22aa87821a2f4a42896815ef0c6 (patch) | |
tree | 7bf6dd6a7af11abb8d7079f52b7ba84a6934eab2 /epan/dissectors/packet-hsrp.c | |
parent | 2cca9d7f55ac87f1f01937870a392e5637793b1a (diff) |
Fix for bug #940. Convert HSRP to a new-style dissector so that it can
reject datagrams that don't have both the source and destination port
of UDP_PORT_HSRP (1985).
svn path=/trunk/; revision=19969
Diffstat (limited to 'epan/dissectors/packet-hsrp.c')
-rw-r--r-- | epan/dissectors/packet-hsrp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/dissectors/packet-hsrp.c b/epan/dissectors/packet-hsrp.c index 01c2372dc1..ace081dd7d 100644 --- a/epan/dissectors/packet-hsrp.c +++ b/epan/dissectors/packet-hsrp.c @@ -159,12 +159,17 @@ static const value_string hsrp_adv_state_vals[] = { {0, NULL}, }; -static void +static int dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 opcode, state = 0; tvbuff_t *next_tvb; + /* Return if this isn't really HSRP traffic + * (source and destination port must be UDP_PORT_HSRP) */ + if(pinfo->destport != UDP_PORT_HSRP) + return 0; + if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "HSRP"); @@ -253,7 +258,7 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - return; + return tvb_length(tvb); } void proto_register_hsrp(void) @@ -364,6 +369,6 @@ proto_reg_handoff_hsrp(void) dissector_handle_t hsrp_handle; data_handle = find_dissector("data"); - hsrp_handle = create_dissector_handle(dissect_hsrp, proto_hsrp); + hsrp_handle = new_create_dissector_handle(dissect_hsrp, proto_hsrp); dissector_add("udp.port", UDP_PORT_HSRP, hsrp_handle); } |