diff options
Diffstat (limited to 'epan/dissectors/packet-communityid.c')
-rw-r--r-- | epan/dissectors/packet-communityid.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/epan/dissectors/packet-communityid.c b/epan/dissectors/packet-communityid.c index 6e72a602b6..6b5c3816a7 100644 --- a/epan/dissectors/packet-communityid.c +++ b/epan/dissectors/packet-communityid.c @@ -141,7 +141,7 @@ static void communityid_sha1_dbg(const gchar *msg, const void* data, gsize len) gsize i; for (i = 0; i < len; i++, ptr += 2) { - g_snprintf(ptr, 3, "%02x", ((guchar*)data)[i]); + snprintf(ptr, 3, "%02x", ((guchar*)data)[i]); } fprintf(stderr, "Community ID dbg [%s]: %s\n", msg, buf); @@ -160,7 +160,7 @@ static gboolean communityid_tuple_lt(guint8 addr_len, const guint16 *sport, const guint16 *dport) { int addrcmp = memcmp(saddr, daddr, addr_len); - int ports_lt = (sport != NULL && dport != NULL) ? *sport < *dport : TRUE; + int ports_lt = (sport != NULL && dport != NULL) ? GUINT16_FROM_BE(*sport) < GUINT16_FROM_BE(*dport) : TRUE; return addrcmp < 0 || (addrcmp == 0 && ports_lt); } @@ -379,7 +379,7 @@ static gboolean communityid_calc(communityid_cfg_t *cfg, guint8 proto, gsize len = strlen(CID_VERSION_PREFIX) + strlen(str) + 1; *result = (gchar*) g_malloc(len); - g_snprintf(*result, (gulong) len, "%s%s", CID_VERSION_PREFIX, str); + snprintf(*result, len, "%s%s", CID_VERSION_PREFIX, str); g_free(str); } else { /* Convert binary SHA-1 to ASCII representation. @@ -392,7 +392,7 @@ static gboolean communityid_calc(communityid_cfg_t *cfg, guint8 proto, memcpy(*result, CID_VERSION_PREFIX, strlen(CID_VERSION_PREFIX)); ptr = *result + strlen(CID_VERSION_PREFIX); for (i = 0; i < sha1_buf_len; i++, ptr += 2) { - g_snprintf(ptr, 3, "%02x", sha1_buf[i]); + snprintf(ptr, 3, "%02x", sha1_buf[i]); } } @@ -405,13 +405,13 @@ static gboolean communityid_calc(communityid_cfg_t *cfg, guint8 proto, void proto_register_communityid(void); -static int proto_communityid = -1; -static int proto_ip = -1; -static int proto_ipv6 = -1; -static int proto_icmp = -1; -static int proto_icmpv6 = -1; +static int proto_communityid; +static int proto_ip; +static int proto_ipv6; +static int proto_icmp; +static int proto_icmpv6; -static int hf_communityid_hash = -1; +static int hf_communityid_hash; static dissector_handle_t communityid_handle; @@ -472,7 +472,7 @@ static int communityid_dissector(tvbuff_t *tvb, packet_info *pinfo, cid_cfg.cfg_seed = (guint16) pref_cid_seed; /* If not yet done, establish global handles for required protocols. */ - if (proto_ip < 0) { + if (proto_ip <= 0) { proto_ip = proto_get_id_by_filter_name("ip"); proto_ipv6 = proto_get_id_by_filter_name("ipv6"); proto_icmp = proto_get_id_by_filter_name("icmp"); @@ -485,7 +485,7 @@ static int communityid_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_ip_found = proto_ipv6; /* If this frame isn't IP at all, we're done. */ - if (proto_ip_found < 0) + if (proto_ip_found <= 0) return 0; /* Next, look specifically for ICMP state stored by dissectors: */ @@ -606,7 +606,7 @@ void proto_register_communityid(void) proto_register_field_array(proto_communityid, hf, array_length(hf)); proto_disable_by_default(proto_communityid); - communityid_handle = create_dissector_handle(communityid_dissector, + communityid_handle = register_dissector("communityid", communityid_dissector, proto_communityid); register_postdissector(communityid_handle); |