r4039 bugfix for recent change: duplicate IP networks were shown on vlan search results
authorAlexey Andriyanov <alan@al-an.info>
Fri, 3 Dec 2010 12:24:52 +0000 (12:24 +0000)
committerAlexey Andriyanov <alan@al-an.info>
Fri, 3 Dec 2010 12:24:52 +0000 (12:24 +0000)
Changed:
inc/interface.php, renderSearchResults

inc/interface.php

index b80ca42..2fc0b2f 100644 (file)
@@ -3678,20 +3678,23 @@ function renderSearchResults ()
                        $nhits += count ($tmp);
                        $lasthit = 'vlan';
                        $summary['vlan'] = $tmp;
-       
+
+                       $seen_networks = array();
                        // find IP networks connected to vlan
                        foreach ($tmp as $vlan_ck)
                        {
                                $vlan_info = getVLANInfo ($vlan_ck);
                                foreach (array (4, 6) as $ipv)
                                        foreach ($vlan_info["ipv${ipv}nets"] as $net_id)
-                                       {
-                                               ++$nhits;
-                                               $lasthit = "ipv${ipv}network";
-                                               if (! isset ($summary["ipv${ipv}network"]))
-                                                       $summary["ipv${ipv}network"] = array();
-                                               $summary["ipv${ipv}network"][] = spotEntity ("ipv${ipv}net", $net_id);
-                                       }
+                                               if (! isset ($seen_networks["$ipv-$net_id"]))
+                                               {
+                                                       $seen_networks["$ipv-$net_id"] = 1;
+                                                       ++$nhits;
+                                                       $lasthit = "ipv${ipv}network";
+                                                       if (! isset ($summary["ipv${ipv}network"]))
+                                                               $summary["ipv${ipv}network"] = array();
+                                                       $summary["ipv${ipv}network"][] = spotEntity ("ipv${ipv}net", $net_id);
+                                               }
                        }
                }
        }