--- ntop/report.c 2005-02-27 16:15:50.000000000 -0600
+++ ntop/report.c 2005-03-17 10:30:52.365000054 -0600
@@ -3542,6 +3542,7 @@ void printIpProtocolUsage(void) {
   u_short clientPorts[MAX_ASSIGNED_IP_PORTS], serverPorts[MAX_ASSIGNED_IP_PORTS];
   u_int j, idx1, hostsNum=0, numPorts=0, maxHosts;
   char buf[LEN_GENERAL_WORK_BUFFER], portBuf[32], hostLinkBuf[LEN_GENERAL_WORK_BUFFER];
+  PortUsage *ports;
 
   printHTMLheader("TCP/UDP: Local Protocol Usage", NULL, 0);
 
@@ -3562,10 +3563,14 @@ void printIpProtocolUsage(void) {
       hosts[hostsNum++] = el;
 
       if(el->portsUsage != NULL) {
-	PortUsage *ports = el->portsUsage;
+	ports = el->portsUsage;
 	while(ports) {
-	  clientPorts[j] += ports->clientUses, serverPorts[j] += ports->serverUses;
-	  numPorts++, ports = ports->next;
+          j = ports->port;
+	  if((clientPorts[j] == 0) && (serverPorts[j] == 0)) 
+	    numPorts++;
+	  clientPorts[j] += ports->clientUses;
+          serverPorts[j] += ports->serverUses;
+          ports = ports->next;
 	}
       }
     }
@@ -3579,6 +3584,11 @@ void printIpProtocolUsage(void) {
     return;
   }
 
+  safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
+                "<center><p>Reporting on actual traffic for %d host(s) on %d service port(s)</p></center>\n",
+                hostsNum, numPorts);
+  sendString(buf);
+
   /* Hosts are now in a contiguous structure (hosts[])... */
 
   sendString("<CENTER>\n");
@@ -3594,16 +3603,16 @@ void printIpProtocolUsage(void) {
       sendString(buf);
 
       if(clientPorts[j] > 0) {
-	PortUsage *ports = getPortsUsage(hosts[idx1], j, 0);
-
 	sendString("<UL>");
-	for(idx1=0; idx1<hostsNum; idx1++)
+	for(idx1=0; idx1<hostsNum; idx1++) {
+	  ports = getPortsUsage(hosts[idx1], j, 0);
 	  if((hosts[idx1]->portsUsage != NULL)
 	     && ports && (ports->clientUses > 0)) {
 	    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<li>%s\n",
 			makeHostLink(hosts[idx1], FLAG_HOSTLINK_TEXT_FORMAT, 1, 0, hostLinkBuf, sizeof(hostLinkBuf)));
 	    sendString(buf);
 	  }
+        }
 	sendString("</UL>");
       } else
 	sendString("&nbsp;");
@@ -3611,16 +3620,16 @@ void printIpProtocolUsage(void) {
       sendString("</TD><TD "TD_BG">");
 
       if(serverPorts[j] > 0) {
-	PortUsage *ports = getPortsUsage(hosts[idx1], j, 0);
-
 	sendString("<UL>");
-	for(idx1=0; idx1<hostsNum; idx1++)
+	for(idx1=0; idx1<hostsNum; idx1++) {
+	  ports = getPortsUsage(hosts[idx1], j, 0);
 	  if((hosts[idx1]->portsUsage != NULL)
 	     && ports && (ports->serverUses > 0)) {
 	    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<li>%s\n",
 			makeHostLink(hosts[idx1], FLAG_HOSTLINK_TEXT_FORMAT, 1, 0, hostLinkBuf, sizeof(hostLinkBuf)));
 	    sendString(buf);
 	  }
+        }
 	sendString("</UL>");
       } else
 	sendString("&nbsp;");
--- ntop/sessions.c 2005-01-25 02:31:16.000000000 -0600
+++ ntop/sessions.c 2005-03-17 10:10:45.762567392 -0600
@@ -250,8 +250,5 @@ void updateUsedPorts(HostTraffic *srcHos
      broadcastHost(srcHost) || broadcastHost(dstHost))
     return;
 
-  if((srcHost->portsUsage == NULL) || (dstHost->portsUsage == NULL))
-    return;
-  
   if(sport < MAX_ASSIGNED_IP_PORTS) {
     ports = getPortsUsage(srcHost, sport, 1);
