Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
U
udpdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ywj
udpdk
Commits
9a713ebc
Commit
9a713ebc
authored
Nov 19, 2020
by
Leonardo Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dump the content of non-ip packets for debug purposes
parent
cd3adee2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
1 deletion
+66
-1
udpdk/Makefile
udpdk/Makefile
+1
-0
udpdk/udpdk_api.symlist
udpdk/udpdk_api.symlist
+1
-0
udpdk/udpdk_dump.c
udpdk/udpdk_dump.c
+46
-0
udpdk/udpdk_dump.h
udpdk/udpdk_dump.h
+15
-0
udpdk/udpdk_poller.c
udpdk/udpdk_poller.c
+3
-1
No files found.
udpdk/Makefile
View file @
9a713ebc
...
...
@@ -40,6 +40,7 @@ UDPDK_C= ${CC} -c $(DPDK_CFLAGS) $(UDPDK_CFLAGS) ${CFLAGS} ${WERROR} $<
UDPDK_CORE_SRCS
+=
\
udpdk_args.c
\
udpdk_dump.c
\
udpdk_globals.c
\
udpdk_init.c
\
udpdk_bind_table.c
\
...
...
udpdk/udpdk_api.symlist
View file @
9a713ebc
...
...
@@ -8,3 +8,4 @@ udpdk_bind
udpdk_sendto
udpdk_recvfrom
udpdk_close
udpdk_dump_payload
udpdk/udpdk_dump.c
0 → 100644
View file @
9a713ebc
//
// Created by leoll2 on 11/19/20.
// Copyright (c) 2020 Leonardo Lai. All rights reserved.
//
// The following code derives in part from netmap pkt-gen.c
//
#include <ctype.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <rte_mbuf.h>
#include "udpdk_dump.h"
/* Print the content of the packet in hex and ASCII */
void
udpdk_dump_payload
(
const
char
*
payload
,
int
len
)
{
char
buf
[
128
];
int
i
,
j
,
i0
;
const
unsigned
char
*
p
=
(
const
unsigned
char
*
)
payload
;
printf
(
"Dumping payload [len = %d]:
\n
"
,
len
);
/* hexdump routine */
for
(
i
=
0
;
i
<
len
;
)
{
memset
(
buf
,
' '
,
sizeof
(
buf
));
sprintf
(
buf
,
"%5d: "
,
i
);
i0
=
i
;
for
(
j
=
0
;
j
<
16
&&
i
<
len
;
i
++
,
j
++
)
sprintf
(
buf
+
7
+
j
*
3
,
"%02x "
,
(
uint8_t
)(
p
[
i
]));
i
=
i0
;
for
(
j
=
0
;
j
<
16
&&
i
<
len
;
i
++
,
j
++
)
sprintf
(
buf
+
7
+
j
+
48
,
"%c"
,
isprint
(
p
[
i
])
?
p
[
i
]
:
'.'
);
printf
(
"%s
\n
"
,
buf
);
}
}
void
udpdk_dump_mbuf
(
struct
rte_mbuf
*
m
)
{
udpdk_dump_payload
(
rte_pktmbuf_mtod
(
m
,
char
*
),
rte_pktmbuf_data_len
(
m
));
}
udpdk/udpdk_dump.h
0 → 100644
View file @
9a713ebc
//
// Created by leoll2 on 11/19/20.
// Copyright (c) 2020 Leonardo Lai. All rights reserved.
//
// The following code derives in part from netmap pkt-gen.c
//
#ifndef UDPDK_DUMP_H
#define UDPDK_DUMP_H
void
udpdk_dump_payload
(
const
char
*
payload
,
int
len
);
void
udpdk_dump_mbuf
(
struct
rte_mbuf
*
m
);
#endif // UDPDK_DUMP_H
udpdk/udpdk_poller.c
View file @
9a713ebc
...
...
@@ -26,6 +26,7 @@
#include "udpdk_constants.h"
#include "udpdk_bind_table.h"
#include "udpdk_dump.h"
#include "udpdk_shmalloc.h"
#include "udpdk_sync.h"
#include "udpdk_types.h"
...
...
@@ -359,7 +360,8 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queu
}
}
}
else
{
RTE_LOG
(
WARNING
,
POLLBODY
,
"Received non-IPv4 packet.
\n
"
);
RTE_LOG
(
WARNING
,
POLLBODY
,
"Received non-IPv4 packet, showing content below:
\n
"
);
udpdk_dump_mbuf
(
m
);
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment