Function ndpi_flowv6_flow_hash

Function Documentation

int ndpi_flowv6_flow_hash(u_int8_t l4_proto, const struct ndpi_in6_addr *src_ip, const struct ndpi_in6_addr *dst_ip, u_int16_t src_port, u_int16_t dst_port, u_int8_t icmp_type, u_int8_t icmp_code, u_char *hash_buf, u_int8_t hash_buf_len)

Compute the Community ID hash for an IPv6 flow. Community ID is a standard for flow hashing that enables correlation of network traffic across different monitoring tools. Specification: https://github.com/corelight/community-id-spec

Parameters:
  • l4_proto – Layer 4 protocol (e.g., IPPROTO_TCP, IPPROTO_UDP)

  • src_ip – Source IPv6 address

  • dst_ip – Destination IPv6 address

  • src_port – Source port (host byte order), or 0 for non-port protocols

  • dst_port – Destination port (host byte order), or 0 for non-port protocols

  • icmp_type – ICMPv6 type (for ICMPv6), or 0 otherwise

  • icmp_code – ICMPv6 code (for ICMPv6), or 0 otherwise

  • hash_buf – Buffer to store the resulting hash

  • hash_buf_len – Length of hash_buf (must be at least 20 bytes for SHA1)

Returns:

0 on success, -1 on error