store RX interface changes

This commit is contained in:
Christian Giese
2024-04-22 16:14:31 +00:00
parent 26e2edc1cc
commit 5c8384cb2c
3 changed files with 13 additions and 1 deletions
+6 -1
View File
@@ -17,7 +17,12 @@ bbl_rx_stream_network(bbl_network_interface_s *interface,
if(!eth->bbl) return false;
stream = bbl_stream_rx(eth, interface->mac);
if(stream) {
if(stream->rx_network_interface == NULL) {
if(stream->rx_network_interface != interface) {
if(stream->rx_network_interface) {
/* RX interface has changed! */
stream->rx_interface_changes++;
stream->rx_interface_changed_epoch = eth->timestamp.tv_sec;
}
stream->rx_network_interface = interface;
}
return true;
+4
View File
@@ -2580,6 +2580,10 @@ bbl_stream_json(bbl_stream_s *stream, bool debug)
"rx-last-epoch", stream->rx_last_epoch
);
if(stream->rx_interface_changes) {
json_object_set(root, "rx-interface-changes", json_integer(stream->rx_interface_changes));
json_object_set(root, "rx-interface-changed-epoch", json_integer(stream->rx_interface_changed_epoch));
}
if(stream->config->rx_mpls1) {
json_object_set(root, "rx-mpls1-expected", json_integer(stream->config->rx_mpls1_label));
}
+3
View File
@@ -193,6 +193,9 @@ typedef struct bbl_stream_
__time_t rx_first_epoch;
__time_t rx_last_epoch;
__time_t rx_interface_changed_epoch;
uint8_t rx_interface_changes;
uint8_t rx_ttl; /* IPv4 or IPv6 TTL */
uint8_t rx_priority; /* IPv4 TOS or IPv6 TC */
uint8_t rx_outer_vlan_pbit;