feature: add GTP utils, support overwrite message length of GTP header
This commit is contained in:
@@ -9,8 +9,8 @@ extern "C"
|
||||
|
||||
#include "udp_utils.h"
|
||||
#include "tcp_utils.h"
|
||||
#include "ipv4_utils.h"
|
||||
#include "ipv6_utils.h"
|
||||
#include "ip4_utils.h"
|
||||
#include "ip6_utils.h"
|
||||
#include "ip_reassembly.h"
|
||||
#include "packet_def.h"
|
||||
#include "packet_utils.h"
|
||||
@@ -22,7 +22,7 @@ static inline void packet_set_ipv4_src_addr(struct packet *pkt, uint32_t saddr)
|
||||
const struct raw_layer *ipv4_layer = packet_get_innermost_raw_layer(pkt, LAYER_PROTO_IPV4);
|
||||
EXPECT_TRUE(ipv4_layer);
|
||||
struct ip *hdr = (struct ip *)ipv4_layer->hdr_ptr;
|
||||
ipv4_hdr_set_src_addr(hdr, saddr);
|
||||
ip4_hdr_set_src_addr(hdr, saddr);
|
||||
}
|
||||
|
||||
static inline void packet_set_ipv6_src_addr(struct packet *pkt, struct in6_addr saddr)
|
||||
@@ -30,7 +30,7 @@ static inline void packet_set_ipv6_src_addr(struct packet *pkt, struct in6_addr
|
||||
const struct raw_layer *ipv6_layer = packet_get_innermost_raw_layer(pkt, LAYER_PROTO_IPV6);
|
||||
EXPECT_TRUE(ipv6_layer);
|
||||
struct ip6_hdr *hdr = (struct ip6_hdr *)ipv6_layer->hdr_ptr;
|
||||
ipv6_hdr_set_src_in6_addr(hdr, saddr);
|
||||
ip6_hdr_set_src_in6_addr(hdr, saddr);
|
||||
}
|
||||
|
||||
static inline void packet_set_ipv6_frag_offset(struct packet *pkt, uint16_t offset)
|
||||
@@ -38,7 +38,7 @@ static inline void packet_set_ipv6_frag_offset(struct packet *pkt, uint16_t offs
|
||||
const struct raw_layer *ipv6_layer = packet_get_innermost_raw_layer(pkt, LAYER_PROTO_IPV6);
|
||||
EXPECT_TRUE(ipv6_layer);
|
||||
struct ip6_hdr *hdr = (struct ip6_hdr *)ipv6_layer->hdr_ptr;
|
||||
struct ip6_frag *frag_hdr = ipv6_hdr_get_frag_ext(hdr);
|
||||
struct ip6_frag *frag_hdr = ip6_hdr_get_frag_ext(hdr);
|
||||
EXPECT_TRUE(frag_hdr);
|
||||
ipv6_frag_set_offset(frag_hdr, offset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user