mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
selftests/xsk: print correct payload for packet dump
[ Upstream commit2d0b2ae287
] Print the correct payload when the packet dump option is selected. The network to host conversion was forgotten and the payload was erronously declared to be an int instead of an unsigned int. Fixes:facb7cb2e9
("selftests/bpf: Xsk selftests - SKB POLL, NOPOLL") Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://lore.kernel.org/r/20230111093526.11682-2-magnus.karlsson@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
550802b8ed
commit
af76543a84
1 changed files with 2 additions and 2 deletions
|
@ -767,7 +767,7 @@ static void pkt_dump(void *pkt, u32 len)
|
|||
struct ethhdr *ethhdr;
|
||||
struct udphdr *udphdr;
|
||||
struct iphdr *iphdr;
|
||||
int payload, i;
|
||||
u32 payload, i;
|
||||
|
||||
ethhdr = pkt;
|
||||
iphdr = pkt + sizeof(*ethhdr);
|
||||
|
@ -792,7 +792,7 @@ static void pkt_dump(void *pkt, u32 len)
|
|||
fprintf(stdout, "DEBUG>> L4: udp_hdr->src: %d\n", ntohs(udphdr->source));
|
||||
fprintf(stdout, "DEBUG>> L4: udp_hdr->dst: %d\n", ntohs(udphdr->dest));
|
||||
/*extract L5 frame */
|
||||
payload = *((uint32_t *)(pkt + PKT_HDR_SIZE));
|
||||
payload = ntohl(*((u32 *)(pkt + PKT_HDR_SIZE)));
|
||||
|
||||
fprintf(stdout, "DEBUG>> L5: payload: %d\n", payload);
|
||||
fprintf(stdout, "---------------------------------------\n");
|
||||
|
|
Loading…
Reference in a new issue