Removed obsoleted PoC IPv6 logic
This commit is contained in:
parent
dac452abbf
commit
cc63c04334
File diff suppressed because it is too large
Load Diff
@ -108,12 +108,6 @@
|
|||||||
#include <hiredis/hiredis.h>
|
#include <hiredis/hiredis.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #define IPV6_HASH_COUNTERS
|
|
||||||
|
|
||||||
#ifdef IPV6_HASH_COUNTERS
|
|
||||||
#include "concurrentqueue.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FASTNETMON_API
|
#ifdef FASTNETMON_API
|
||||||
using fastmitigation::BanListReply;
|
using fastmitigation::BanListReply;
|
||||||
using fastmitigation::BanListRequest;
|
using fastmitigation::BanListRequest;
|
||||||
@ -1303,55 +1297,6 @@ bool load_our_networks_list() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IPV6_HASH_COUNTERS
|
|
||||||
|
|
||||||
moodycamel::ConcurrentQueue<simple_packet_t> multi_process_queue_for_ipv6_counters;
|
|
||||||
|
|
||||||
void ipv6_traffic_processor() {
|
|
||||||
simple_packet_t packets_from_queue[32];
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
std::size_t count = 0;
|
|
||||||
|
|
||||||
while ((count = multi_process_queue_for_ipv6_counters.try_dequeue_bulk(packets_from_queue, 32)) != 0) {
|
|
||||||
for (std::size_t i = 0; i != count; ++i) {
|
|
||||||
#ifdef USE_NEW_ATOMIC_BUILTINS
|
|
||||||
__atomic_add_fetch(&total_ipv6_packets, 1, __ATOMIC_RELAXED);
|
|
||||||
#else
|
|
||||||
__sync_fetch_and_add(&total_ipv6_packets, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
direction packet_direction = packets_from_queue[i].packet_direction;
|
|
||||||
|
|
||||||
uint64_t sampled_number_of_packets =
|
|
||||||
packets_from_queue[i].number_of_packets * packets_from_queue[i].sample_ratio;
|
|
||||||
uint64_t sampled_number_of_bytes =
|
|
||||||
packets_from_queue[i].length * packets_from_queue[i].sample_ratio;
|
|
||||||
|
|
||||||
#ifdef USE_NEW_ATOMIC_BUILTINS
|
|
||||||
__atomic_add_fetch(&total_counters[packet_direction].packets,
|
|
||||||
sampled_number_of_packets, __ATOMIC_RELAXED);
|
|
||||||
__atomic_add_fetch(&total_counters[packet_direction].bytes, sampled_number_of_bytes, __ATOMIC_RELAXED);
|
|
||||||
#else
|
|
||||||
__sync_fetch_and_add(&total_counters[packet_direction].packets, sampled_number_of_packets);
|
|
||||||
__sync_fetch_and_add(&total_counters[packet_direction].bytes, sampled_number_of_bytes);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (packet_direction != OTHER) {
|
|
||||||
#ifdef USE_NEW_ATOMIC_BUILTINS
|
|
||||||
__atomic_add_fetch(&our_ipv6_packets, 1, __ATOMIC_RELAXED);
|
|
||||||
#else
|
|
||||||
__sync_fetch_and_add(&our_ipv6_packets, 1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GEOIP
|
#ifdef GEOIP
|
||||||
unsigned int get_asn_for_ip(uint32_t ip) {
|
unsigned int get_asn_for_ip(uint32_t ip) {
|
||||||
char* asn_raw = GeoIP_org_by_name(geo_ip, convert_ip_as_uint_to_string(remote_ip).c_str());
|
char* asn_raw = GeoIP_org_by_name(geo_ip, convert_ip_as_uint_to_string(remote_ip).c_str());
|
||||||
@ -1726,10 +1671,6 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPV6_HASH_COUNTERS
|
|
||||||
service_thread_group.add_thread(new boost::thread(ipv6_traffic_processor));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FASTNETMON_API
|
#ifdef FASTNETMON_API
|
||||||
if (enable_api) {
|
if (enable_api) {
|
||||||
service_thread_group.add_thread(new boost::thread(RunApiServer));
|
service_thread_group.add_thread(new boost::thread(RunApiServer));
|
||||||
|
@ -2643,21 +2643,13 @@ void process_packet(simple_packet_t& current_packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current_packet.ip_protocol_version == 6) {
|
if (current_packet.ip_protocol_version == 6) {
|
||||||
#ifdef IPV6_HASH_COUNTERS
|
|
||||||
current_packet.packet_direction =
|
current_packet.packet_direction =
|
||||||
get_packet_direction_ipv6(lookup_tree_ipv6, current_packet.src_ipv6, current_packet.dst_ipv6);
|
get_packet_direction_ipv6(lookup_tree_ipv6, current_packet.src_ipv6, current_packet.dst_ipv6);
|
||||||
|
|
||||||
// TODO: move to bulk operations here!
|
|
||||||
multi_process_queue_for_ipv6_counters.enqueue(current_packet);
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_NEW_ATOMIC_BUILTINS
|
#ifdef USE_NEW_ATOMIC_BUILTINS
|
||||||
__atomic_add_fetch(&total_ipv6_packets, 1, __ATOMIC_RELAXED);
|
__atomic_add_fetch(&total_ipv6_packets, 1, __ATOMIC_RELAXED);
|
||||||
#else
|
#else
|
||||||
__sync_fetch_and_add(&total_ipv6_packets, 1);
|
__sync_fetch_and_add(&total_ipv6_packets, 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user