Add packet_build.cpp support imitate_tcp_packet() / imitate_udp_packet()
This commit is contained in:
@@ -1487,10 +1487,7 @@ const struct raw_layer *packet_get_outermost_raw_layer(const struct packet *pkt,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// direction 1: E2I
|
||||
// direction 0: I2E
|
||||
uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, int direction)
|
||||
uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, enum packet_direction direction)
|
||||
{
|
||||
uint64_t temp = 0;
|
||||
uint64_t hash_value = 1;
|
||||
@@ -1549,7 +1546,7 @@ uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, int
|
||||
switch (method)
|
||||
{
|
||||
case LDBC_METHOD_HASH_INT_IP:
|
||||
if (direction)
|
||||
if (direction == PACKET_DIRECTION_INCOMING)
|
||||
{
|
||||
// direction 1: E2I
|
||||
HASH_VALUE(outer_dst_addr, outer_addr_len, hash_value);
|
||||
@@ -1561,7 +1558,7 @@ uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, int
|
||||
}
|
||||
break;
|
||||
case LDBC_METHOD_HASH_EXT_IP:
|
||||
if (direction)
|
||||
if (direction == PACKET_DIRECTION_INCOMING)
|
||||
{
|
||||
// direction 1: E2I
|
||||
HASH_VALUE(outer_src_addr, outer_addr_len, hash_value);
|
||||
@@ -1578,7 +1575,7 @@ uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, int
|
||||
hash_value = hash_value ^ temp;
|
||||
break;
|
||||
case LDBC_METHOD_HASH_INNERMOST_INT_IP:
|
||||
if (direction)
|
||||
if (direction == PACKET_DIRECTION_INCOMING)
|
||||
{
|
||||
// direction 1: E2I
|
||||
HASH_VALUE(inner_dst_addr, inner_addr_len, hash_value);
|
||||
@@ -1590,7 +1587,7 @@ uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, int
|
||||
}
|
||||
break;
|
||||
case LDBC_METHOD_HASH_INNERMOST_EXT_IP:
|
||||
if (direction)
|
||||
if (direction == PACKET_DIRECTION_INCOMING)
|
||||
{
|
||||
// direction 1: E2I
|
||||
HASH_VALUE(inner_src_addr, inner_addr_len, hash_value);
|
||||
|
||||
Reference in New Issue
Block a user