Mining: lru cache is ipv4 only (for the time being) (#1159)
Fix memory error with ipv6 traffic
This commit is contained in:
@@ -61,6 +61,7 @@ void ndpi_search_mining_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
else {
|
else {
|
||||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
||||||
|
if(packet->iph) /* TODO: ipv6 */
|
||||||
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -96,6 +97,7 @@ void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
if((*to_match == magic) || (*to_match == magic1)) {
|
if((*to_match == magic) || (*to_match == magic1)) {
|
||||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
||||||
|
if(packet->iph) /* TODO: ipv6 */
|
||||||
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -108,6 +110,7 @@ void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
if(isEthPort(ntohs(packet->tcp->dest)) /* Ethereum port */) {
|
if(isEthPort(ntohs(packet->tcp->dest)) /* Ethereum port */) {
|
||||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
||||||
|
if(packet->iph) /* TODO: ipv6 */
|
||||||
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
@@ -128,6 +131,7 @@ void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
*/
|
*/
|
||||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
||||||
|
if(packet->iph) /* TODO: ipv6 */
|
||||||
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
||||||
return;
|
return;
|
||||||
} else if(ndpi_strnstr((const char *)packet->payload, "{", packet->payload_packet_len)
|
} else if(ndpi_strnstr((const char *)packet->payload, "{", packet->payload_packet_len)
|
||||||
@@ -151,6 +155,7 @@ void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
*/
|
*/
|
||||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ZCash/Monero");
|
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ZCash/Monero");
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN);
|
||||||
|
if(packet->iph) /* TODO: ipv6 */
|
||||||
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
cacheMiningHostTwins(ndpi_struct, flow->packet.iph->saddr + flow->packet.iph->daddr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user