🔧 build(enable cppcheck on build): eliminate cppcheck error

This commit is contained in:
yangwei
2024-08-07 13:07:00 +08:00
committed by luwenpeng
parent 526171618f
commit f1b3928c70
6 changed files with 42 additions and 13 deletions

View File

@@ -722,11 +722,11 @@ static inline const char *parse_udp(struct packet *pkt, const char *data, uint16
{
return data;
}
const struct udphdr *hdr = (struct udphdr *)data;
const struct udphdr *udp_hdr = (struct udphdr *)data;
SET_LAYER(pkt, layer, LAYER_PROTO_UDP, sizeof(struct udphdr), data, len, 0);
uint16_t src_port = udp_hdr_get_src_port(hdr);
uint16_t dst_port = udp_hdr_get_dst_port(hdr);
uint16_t src_port = udp_hdr_get_src_port(udp_hdr);
uint16_t dst_port = udp_hdr_get_dst_port(udp_hdr);
if (dst_port == 4789)
{
@@ -772,8 +772,8 @@ static inline const char *parse_udp(struct packet *pkt, const char *data, uint16
{
return layer->pld_ptr;
}
const struct ip6_hdr *hdr = (const struct ip6_hdr *)layer->pld_ptr;
if (ip6_hdr_get_version(hdr) != 6)
const struct ip6_hdr *ipv6_hdr = (const struct ip6_hdr *)layer->pld_ptr;
if (ip6_hdr_get_version(ipv6_hdr) != 6)
{
return layer->pld_ptr;
}