packet parser suppoort skip IPv6 extension headers

This commit is contained in:
luwenpeng
2024-05-30 13:49:31 +08:00
parent 8092b3a90e
commit 1a7f74025b
6 changed files with 91 additions and 36 deletions

View File

@@ -224,9 +224,9 @@ static inline void calc_tcp_fingerprint(struct tcp_fingerprint *finger)
}
// return packet length
int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t ip_ttl,
uint32_t tcp_seq, uint32_t tcp_ack, uint8_t tcp_flags, uint16_t tcp_win,
const char *tcp_pld, int pld_len, char *pkt_buff, int buff_size)
static int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t ip_ttl,
uint32_t tcp_seq, uint32_t tcp_ack, uint8_t tcp_flags, uint16_t tcp_win,
const char *tcp_pld, int pld_len, char *pkt_buff, int buff_size)
{
int trim = 0;
struct tcphdr *tcphdr;
@@ -314,7 +314,7 @@ int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t ip_ttl,
}
// return packet length
int build_udp_packet(const struct packet *first, const char *udp_pld, int pld_len, char *pkt_buff, int buff_size)
static int build_udp_packet(const struct packet *first, const char *udp_pld, int pld_len, char *pkt_buff, int buff_size)
{
int trim = 0;
struct udphdr *udphdr;
@@ -386,7 +386,7 @@ int build_udp_packet(const struct packet *first, const char *udp_pld, int pld_le
return len - trim;
}
int inject_tcp_packet(struct stellar *st, const struct session *sess, enum flow_direction inject_dir, uint8_t tcp_flags, const char *payload, uint16_t len)
static int inject_tcp_packet(struct stellar *st, const struct session *sess, enum flow_direction inject_dir, uint8_t tcp_flags, const char *payload, uint16_t len)
{
#define TCP_FLAGS_LOG_FORMAT "URG:%d, ACK:%d, PSH:%d, RST:%d, SYN:%d, FIN:%d"
#define TCP_FLAGS_LOG_VALUE(flags) \
@@ -464,7 +464,7 @@ int inject_tcp_packet(struct stellar *st, const struct session *sess, enum flow_
}
}
int inject_udp_packet(struct stellar *st, const struct session *sess, enum flow_direction inject_dir, const char *payload, uint16_t len)
static int inject_udp_packet(struct stellar *st, const struct session *sess, enum flow_direction inject_dir, const char *payload, uint16_t len)
{
uint16_t thr_idx = stellar_get_current_thread_index();
uint64_t time_ms = stellar_get_monotonic_time_msec();