rename security_zone to domain
This commit is contained in:
@@ -210,7 +210,7 @@ TEST(TUPLE, TUPLE6)
|
||||
tuple_a.src_port = htons(1234);
|
||||
tuple_a.dst_port = htons(5678);
|
||||
tuple_a.ip_proto = IPPROTO_TCP;
|
||||
tuple_a.security_zone = 0;
|
||||
tuple_a.domain = 0;
|
||||
|
||||
tuple_b.ip_type = IP_TYPE_V6;
|
||||
inet_pton(AF_INET6, "2001:db8::ff00:42:8329", &tuple_b.src_addr.v6);
|
||||
@@ -218,25 +218,25 @@ TEST(TUPLE, TUPLE6)
|
||||
tuple_b.src_port = htons(1234);
|
||||
tuple_b.dst_port = htons(5678);
|
||||
tuple_b.ip_proto = IPPROTO_UDP;
|
||||
tuple_b.security_zone = 0;
|
||||
tuple_b.domain = 0;
|
||||
|
||||
// tostring
|
||||
memset(buf, 0, sizeof(buf));
|
||||
tuple6_tostring(&tuple_a, buf, sizeof(buf));
|
||||
EXPECT_STREQ(buf, "192.168.1.2:1234 -> 192.168.1.3:5678, proto: 6, zone: 0");
|
||||
EXPECT_STREQ(buf, "192.168.1.2:1234 -> 192.168.1.3:5678, proto: 6, domain: 0");
|
||||
memset(buf, 0, sizeof(buf));
|
||||
tuple6_tostring(&tuple_b, buf, sizeof(buf));
|
||||
EXPECT_STREQ(buf, "2001:db8::ff00:42:8329:1234 -> 2001:db8::ff00:42:832a:5678, proto: 17, zone: 0");
|
||||
EXPECT_STREQ(buf, "2001:db8::ff00:42:8329:1234 -> 2001:db8::ff00:42:832a:5678, proto: 17, domain: 0");
|
||||
|
||||
// reverse
|
||||
tuple6_reverse(&tuple_a, &reversed_tuple_a);
|
||||
tuple6_reverse(&tuple_b, &reversed_tuple_b);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
tuple6_tostring(&reversed_tuple_a, buf, sizeof(buf));
|
||||
EXPECT_STREQ(buf, "192.168.1.3:5678 -> 192.168.1.2:1234, proto: 6, zone: 0");
|
||||
EXPECT_STREQ(buf, "192.168.1.3:5678 -> 192.168.1.2:1234, proto: 6, domain: 0");
|
||||
memset(buf, 0, sizeof(buf));
|
||||
tuple6_tostring(&reversed_tuple_b, buf, sizeof(buf));
|
||||
EXPECT_STREQ(buf, "2001:db8::ff00:42:832a:5678 -> 2001:db8::ff00:42:8329:1234, proto: 17, zone: 0");
|
||||
EXPECT_STREQ(buf, "2001:db8::ff00:42:832a:5678 -> 2001:db8::ff00:42:8329:1234, proto: 17, domain: 0");
|
||||
|
||||
// hash
|
||||
EXPECT_TRUE(tuple6_hash(&tuple_a) == tuple6_hash(&reversed_tuple_a));
|
||||
|
||||
@@ -88,7 +88,7 @@ uint32_t tuple6_hash(const struct tuple6 *tuple)
|
||||
uint32_t dst_port_hash = 0;
|
||||
uint32_t hash = crc32_hash(&tuple->ip_type, sizeof(tuple->ip_type), 0);
|
||||
hash = crc32_hash(&tuple->ip_proto, sizeof(tuple->ip_proto), hash);
|
||||
hash = crc32_hash(&tuple->security_zone, sizeof(tuple->security_zone), hash);
|
||||
hash = crc32_hash(&tuple->domain, sizeof(tuple->domain), hash);
|
||||
|
||||
if (tuple->ip_type == IP_TYPE_V4)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ int tuple5_cmp(const struct tuple5 *tuple_a, const struct tuple5 *tuple_b)
|
||||
|
||||
int tuple6_cmp(const struct tuple6 *tuple_a, const struct tuple6 *tuple_b)
|
||||
{
|
||||
if (tuple_a->security_zone != tuple_b->security_zone)
|
||||
if (tuple_a->domain != tuple_b->domain)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -351,7 +351,7 @@ void tuple6_reverse(const struct tuple6 *in, struct tuple6 *out)
|
||||
{
|
||||
out->ip_type = in->ip_type;
|
||||
out->ip_proto = in->ip_proto;
|
||||
out->security_zone = in->security_zone;
|
||||
out->domain = in->domain;
|
||||
out->src_port = in->dst_port;
|
||||
out->dst_port = in->src_port;
|
||||
|
||||
@@ -445,8 +445,8 @@ void tuple6_tostring(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, zone: %lu",
|
||||
snprintf(buf, size, "%s:%u -> %s:%u, proto: %u, domain: %lu",
|
||||
src_addr, ntohs(tuple->src_port),
|
||||
dst_addr, ntohs(tuple->dst_port),
|
||||
tuple->ip_proto, tuple->security_zone);
|
||||
tuple->ip_proto, tuple->domain);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ struct tuple6
|
||||
uint16_t dst_port; /* network order */
|
||||
|
||||
uint16_t ip_proto; /* network order */
|
||||
uint64_t security_zone;
|
||||
uint64_t domain;
|
||||
};
|
||||
|
||||
uint32_t tuple2_hash(const struct tuple2 *tuple);
|
||||
|
||||
Reference in New Issue
Block a user