Update the format of tuple to string output

This commit is contained in:
luwenpeng
2024-05-20 15:42:58 +08:00
parent 0e33a1b647
commit be9a68935b
17 changed files with 174 additions and 166 deletions

View File

@@ -355,7 +355,7 @@ void tuple2_to_str(const struct tuple2 *tuple, char *buf, uint32_t size)
inet_ntop(AF_INET6, &tuple->dst_addr.v6, dst_addr, INET6_ADDRSTRLEN);
}
snprintf(buf, size, "%s -> %s", src_addr, dst_addr);
snprintf(buf, size, "%s-%s", src_addr, dst_addr);
}
void tuple4_to_str(const struct tuple4 *tuple, char *buf, uint32_t size)
@@ -374,7 +374,7 @@ void tuple4_to_str(const struct tuple4 *tuple, char *buf, uint32_t size)
inet_ntop(AF_INET6, &tuple->dst_addr.v6, dst_addr, INET6_ADDRSTRLEN);
}
snprintf(buf, size, "%s:%u -> %s:%u",
snprintf(buf, size, "%s:%u-%s:%u",
src_addr, ntohs(tuple->src_port),
dst_addr, ntohs(tuple->dst_port));
}
@@ -395,7 +395,7 @@ void tuple5_to_str(const struct tuple5 *tuple, char *buf, uint32_t size)
inet_ntop(AF_INET6, &tuple->dst_addr.v6, dst_addr, INET6_ADDRSTRLEN);
}
snprintf(buf, size, "%s:%u -> %s:%u, proto: %u",
snprintf(buf, size, "%s:%u-%s:%u-%u",
src_addr, ntohs(tuple->src_port),
dst_addr, ntohs(tuple->dst_port),
tuple->ip_proto);
@@ -417,7 +417,7 @@ void tuple6_to_str(const struct tuple6 *tuple, char *buf, uint32_t size)
inet_ntop(AF_INET6, &tuple->dst_addr.v6, dst_addr, INET6_ADDRSTRLEN);
}
snprintf(buf, size, "%s:%u -> %s:%u, proto: %u, domain: %lu",
snprintf(buf, size, "%s:%u-%s:%u-%u-%lu",
src_addr, ntohs(tuple->src_port),
dst_addr, ntohs(tuple->dst_port),
tuple->ip_proto, tuple->domain);