Right now we just write 16 0 es in this case which is far from ideal: src_ip->Append(fast_ntoh(packet.src_ip)); dst_ip->Append(fast_ntoh(packet.dst_ip)); std::string src_ip_in_string; src_ip_in_string.resize(16); if (packet.ip_protocol_version == 6) { // Copy data from internal structure to std::string memcpy(src_ip_in_string.data(), &packet.src_ipv6, sizeof(packet.src_ipv6)); } else { // Fill by zeros memset(src_ip_in_string.data(), 0, 16); } src_ip_v6->Append(src_ip_in_string);