Update the format of tuple to string output
This commit is contained in:
@@ -192,14 +192,14 @@ static inline void calc_tcp_seq_ack(const struct session *sess, enum flow_direct
|
||||
if (inject_dir == curr_dir)
|
||||
{
|
||||
*seq = uint32_add(tcp_curr_half->seq, tcp_curr_half->inject_inc_seq_offset);
|
||||
*ack = uint32_add(tcp_curr_half->ack, tcp_curr_half->inject_inc_ack_offset);
|
||||
*ack = tcp_curr_half->ack;
|
||||
|
||||
tcp_curr_half->inject_inc_seq_offset += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
*seq = uint32_add(tcp_curr_half->ack, tcp_curr_half->inject_inc_ack_offset);
|
||||
*ack = uint32_add(tcp_curr_half->seq, tcp_curr_half->inject_inc_seq_offset + tcp_curr_half->len + (tcp_curr_half->flags & TH_SYN ? 1 : 0));
|
||||
*ack = uint32_add(tcp_curr_half->seq, tcp_curr_half->len + (tcp_curr_half->flags & TH_SYN ? 1 : 0));
|
||||
|
||||
tcp_curr_half->inject_inc_ack_offset += len;
|
||||
}
|
||||
@@ -392,8 +392,9 @@ int inject_tcp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
if (session_get_type(sess) != SESSION_TYPE_TCP)
|
||||
{
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld is not a TCP session, cannot inject TCP packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d)",
|
||||
session_get_id(sess), TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s is not a TCP session, cannot inject TCP packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d)",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -401,8 +402,9 @@ int inject_tcp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
if (pkt == NULL)
|
||||
{
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld has no %s first packet, cannot inject TCP packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d)",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s has no %s first packet, cannot inject TCP packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d)",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -416,8 +418,9 @@ int inject_tcp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
int pkt_len = build_tcp_packet(pkt, finger.ipid, finger.ttl, tcp_seq, tcp_ack, tcp_flags, finger.win, payload, len, buff, sizeof(buff));
|
||||
if (pkt_len <= 0)
|
||||
{
|
||||
INJECT_PACKET_LOG_ERROR("session %ld build TCP %s packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d) failed, %s",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len, strerror(len));
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s build TCP %s packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d) failed, %s",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len, strerror(len));
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
return 0;
|
||||
}
|
||||
@@ -436,14 +439,16 @@ int inject_tcp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
{
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_SUCCESS, 1);
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_BYTES_SUCCESS, pkt_len);
|
||||
INJECT_PACKE_LOG_DEBUG("session %ld inject TCP %s packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d) success",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
INJECT_PACKE_LOG_DEBUG("session %ld %s inject TCP %s packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d) success",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
return pkt_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
INJECT_PACKET_LOG_ERROR("session %ld inject TCP %s packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d) failed, packet I/O nospace",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s inject TCP %s packet (" TCP_FLAGS_LOG_FORMAT ", payload len:%d) failed, packet I/O nospace",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), TCP_FLAGS_LOG_VALUE(tcp_flags), len);
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
return 0;
|
||||
}
|
||||
@@ -457,8 +462,8 @@ int inject_udp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
if (session_get_type(sess) != SESSION_TYPE_UDP)
|
||||
{
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld is not a UDP session, cannot inject UDP packet (payload len:%d)",
|
||||
session_get_id(sess), len);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s is not a UDP session, cannot inject UDP packet (payload len:%d)",
|
||||
session_get_id(sess), session_get0_readable_addr(sess), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -466,8 +471,9 @@ int inject_udp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
if (pkt == NULL)
|
||||
{
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld has no %s first packet, cannot inject UDP packet (payload len:%d)",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), len);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s has no %s first packet, cannot inject UDP packet (payload len:%d)",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -475,8 +481,9 @@ int inject_udp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
int pkt_len = build_udp_packet(pkt, payload, len, buff, sizeof(buff));
|
||||
if (pkt_len <= 0)
|
||||
{
|
||||
INJECT_PACKET_LOG_ERROR("session %ld build UDP %s packet (payload len:%d) failed, %s",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), len, strerror(len));
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s build UDP %s packet (payload len:%d) failed, %s",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), len, strerror(len));
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
return 0;
|
||||
}
|
||||
@@ -495,14 +502,16 @@ int inject_udp_packet(const struct session *sess, enum flow_direction inject_dir
|
||||
{
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_SUCCESS, 1);
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_BYTES_SUCCESS, pkt_len);
|
||||
INJECT_PACKE_LOG_DEBUG("session %ld inject UDP %s packet (payload len:%d) success",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), len);
|
||||
INJECT_PACKE_LOG_DEBUG("session %ld %s inject UDP %s packet (payload len:%d) success",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), len);
|
||||
return pkt_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
INJECT_PACKET_LOG_ERROR("session %ld inject UDP %s packet (payload len:%d) failed, packet I/O nospace",
|
||||
session_get_id(sess), flow_direction_to_str(inject_dir), len);
|
||||
INJECT_PACKET_LOG_ERROR("session %ld %s inject UDP %s packet (payload len:%d) failed, packet I/O nospace",
|
||||
session_get_id(sess), session_get0_readable_addr(sess),
|
||||
flow_direction_to_str(inject_dir), len);
|
||||
session_inc_stat((struct session *)sess, inject_dir, STAT_INJECTED_PACKETS_FAILED, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user