Additional stat tracking for data processing.
[distributedratelimiting.git] / drl / standard.c
index 5b9632e..f035215 100644 (file)
@@ -106,7 +106,7 @@ standard_flow *standard_table_lookup(standard_flow_table table, const key_flow *
         dst.s_addr = ntohl(flow->dest_ip);
         strcpy(sip, inet_ntoa(src));
         strcpy(dip, inet_ntoa(dst));
-        printlog(LOG_DEBUG, "ALLOC:%s:%hd -> %s:%hd\n", sip,
+        printlog(LOG_DEBUG, "ALLOC:%s:%hu -> %s:%hu\n", sip,
                 flow->source_port, dip, flow->dest_port);
     }
 
@@ -242,6 +242,7 @@ void standard_table_update_flows(standard_flow_table table, struct timeval now,
     standard_flow *current;
     struct in_addr src, dst;
     char sip[22], dip[22];
+    key_flow largest_flow_info;
 
     /* Reset statistics. */
     table->common->num_flows = 0;
@@ -301,6 +302,11 @@ void standard_table_update_flows(standard_flow_table table, struct timeval now,
 
         if (current->rate > maxflowrate) {
             maxflowrate = current->rate;
+            largest_flow_info.source_ip = current->source_ip;
+            largest_flow_info.dest_ip = current->dest_ip;
+            largest_flow_info.source_port = current->source_port;
+            largest_flow_info.dest_port = current->dest_port;
+            largest_flow_info.protocol = current->protocol;
         }
 
         if (current->rate > 51200) {
@@ -342,4 +348,5 @@ void standard_table_update_flows(standard_flow_table table, struct timeval now,
     printlog(LOG_DEBUG, "FLOW:--\n--\n");
 
     table->common->max_flow_rate = maxflowrate;
+    table->common->max_flow_rate_flow_hash = table->hash_function(&largest_flow_info);
 }