Enable GeoIP lookups by default. Don't add GeoIP subtrees if we didn't
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 11 Oct 2011 17:57:09 +0000 (17:57 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 11 Oct 2011 17:57:09 +0000 (17:57 +0000)
find any databases.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39363 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-ip.c
epan/dissectors/packet-ipv6.c

index 68897e01da93d97d639bdfacad68270dffa26196..8c8bc650725b0dfb29610aac49df4fb677cc05b6 100644 (file)
@@ -80,7 +80,7 @@ static gboolean ip_tso_supported = TRUE;
 
 #ifdef HAVE_GEOIP
 /* Look up addresses in GeoIP */
-static gboolean ip_use_geoip = FALSE;
+static gboolean ip_use_geoip = TRUE;
 #endif /* HAVE_GEOIP */
 
 /* Interpret the reserved flag as security flag (RFC 3514) */
@@ -406,6 +406,7 @@ add_geoip_info(proto_tree *tree, tvbuff_t *tvb, gint offset, guint32 src32, guin
   guint item_cnt;
 
   num_dbs = geoip_db_num_dbs();
+  if (num_dbs < 1) return;
 
   geoip_info_item = proto_tree_add_text(tree, tvb, offset + IPH_SRC, 4, "Source GeoIP: ");
   geoip_info_tree = proto_item_add_subtree(geoip_info_item, ett_geoip_info);
@@ -1380,8 +1381,8 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
   /* if IP is not referenced from any filters we dont need to worry about
      generating any tree items.  We must do this after we created the actual
      protocol above so that proto hier stat still works though.
-     XXX: Note that because of the following optimization expert items must 
-          not be generated inside of an 'if (tree) ...' 
+     XXX: Note that because of the following optimization expert items must
+          not be generated inside of an 'if (tree) ...'
           so that Analyze ! Expert ...  will work.
   */
   if(!proto_field_is_referenced(parent_tree, proto_ip)){
@@ -1548,7 +1549,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                        if (tree==NULL) then item will be NULL
                        else item should be from the add_boolean(..., hf_ip_checksum_bad, ...) above */
       expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum");
-  } else { 
+  } else {
     ipsum = 0;
     if (tree) {
       item = proto_tree_add_uint_format(ip_tree, hf_ip_checksum, tvb, offset + 10, 2, iph->ip_sum,
index 84570660b5229e106170b9868b1224fad8213942..e1e1ec2910c460db609f76f9ec4f3bbf4c90ff7d 100644 (file)
@@ -285,7 +285,7 @@ static gboolean ipv6_summary_in_tree = TRUE;
 
 #ifdef HAVE_GEOIP_V6
 /* Look up addresses in GeoIP */
-static gboolean ipv6_use_geoip = FALSE;
+static gboolean ipv6_use_geoip = TRUE;
 #endif /* HAVE_GEOIP_V6 */
 
 #ifndef offsetof
@@ -412,6 +412,7 @@ add_geoip_info(proto_tree *tree, tvbuff_t *tvb, gint offset, struct e_in6_addr s
   guint item_cnt;
 
   num_dbs = geoip_db_num_dbs();
+  if (num_dbs < 1) return;
 
   geoip_info_item = proto_tree_add_text(tree, tvb, offset + IP6H_SRC, 16, "Source GeoIP: ");
   geoip_info_tree = proto_item_add_subtree(geoip_info_item, ett_geoip_info);