summaryrefslogtreecommitdiff
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-02-10 22:57:47 -0500
committerMichael Mann <mmann78@netscape.net>2015-02-11 14:54:42 +0000
commit9db51dfc706c757a1ec184d3d6c0bbaa89bc06a3 (patch)
tree7ad8c5696c80037ba76f70164325a5e231a2bc6b /epan/dissectors
parenta822d85e040b10461c6bbe6c2179e6b9b944b064 (diff)
downloadwireshark-9db51dfc706c757a1ec184d3d6c0bbaa89bc06a3.tar.gz
Remove address_to_str_buf from hsrp dissector "heuristics" as its much faster to just compare the IPv4 address as a 32-bit value.
Change-Id: If5a819b74112e92636d036509cb30ea15b2d5e3d Reviewed-on: https://code.wireshark.org/review/7067 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-hsrp.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/epan/dissectors/packet-hsrp.c b/epan/dissectors/packet-hsrp.c
index b59947c5f5..8a47974ebc 100644
--- a/epan/dissectors/packet-hsrp.c
+++ b/epan/dissectors/packet-hsrp.c
@@ -197,8 +197,8 @@ static gint ett_hsrp2_md5_auth_tlv = -1;
#define UDP_PORT_HSRP 1985
#define UDP_PORT_HSRP2_V6 2029
-#define HSRP_DST_IP_ADDR "224.0.0.2"
-#define HSRP2_DST_IP_ADDR "224.0.0.102"
+#define HSRP_DST_IP_ADDR 0xE0000002
+#define HSRP2_DST_IP_ADDR 0xE0000066
struct hsrp_packet { /* Multicast to 224.0.0.2, TTL 1, UDP, port 1985 */
guint8 version; /* RFC2281 describes version 0 */
@@ -326,7 +326,8 @@ static int
dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
tvbuff_t *next_tvb;
- gchar dst[16];
+ guint32 hsrpv1 = g_htonl(HSRP_DST_IP_ADDR),
+ hsrpv2 = g_htonl(HSRP2_DST_IP_ADDR);
/* Return if this isn't really HSRP traffic
* (source and destination port must be UDP_PORT_HSRP on HSRPv1 or HSRPv2(IPv4))
@@ -338,9 +339,7 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/*
* To check whether this is an HSRPv1 packet or HSRPv2 on dest IPv4 addr.
*/
- address_to_str_buf(&(pinfo->dst), dst, sizeof dst);
-
- if (pinfo->dst.type == AT_IPv4 && strcmp(dst,HSRP_DST_IP_ADDR) == 0) {
+ if (pinfo->dst.type == AT_IPv4 && memcmp(pinfo->dst.data, &hsrpv1, 4) == 0) {
/* HSRPv1 */
guint8 opcode, state = 0;
@@ -425,7 +424,7 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
call_dissector(data_handle, next_tvb, pinfo, hsrp_tree);
}
}
- } else if ((pinfo->dst.type == AT_IPv4 && strcmp(dst,HSRP2_DST_IP_ADDR) == 0) ||
+ } else if ((pinfo->dst.type == AT_IPv4 && memcmp(pinfo->dst.data, &hsrpv2, 4) == 0) ||
(pinfo->dst.type == AT_IPv6 && pinfo->destport == UDP_PORT_HSRP2_V6)) {
/* HSRPv2 */
guint offset = 0, offset2;