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
ceba7d84
Commit
ceba7d84
authored
Oct 07, 2020
by
Leonardo Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth addr now configurable, not hardcoded
parent
721dbbba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
udpdk/udpdk_syscall.c
udpdk/udpdk_syscall.c
+4
-5
No files found.
udpdk/udpdk_syscall.c
View file @
ceba7d84
...
...
@@ -15,6 +15,7 @@
#define RTE_LOGTYPE_SYSCALL RTE_LOGTYPE_USER1
extern
int
interrupted
;
extern
configuration
config
;
extern
htable_item
*
udp_port_table
;
extern
struct
exch_zone_info
*
exch_zone_desc
;
extern
struct
exch_slot
*
exch_slots
;
...
...
@@ -194,9 +195,7 @@ ssize_t udpdk_sendto(int sockfd, const void *buf, size_t len, int flags,
void
*
udp_data
;
const
struct
sockaddr_in
*
dest_addr_in
=
(
struct
sockaddr_in
*
)
dest_addr
;
static
struct
rte_ether_addr
src_eth_addr
=
{
{
0x68
,
0x05
,
0xca
,
0x95
,
0xf8
,
0xec
}
};
// TODO from configuration
static
uint32_t
src_ip_addr
=
RTE_IPV4
(
2
,
100
,
31
,
172
);
// TODO from bind (reversed for endianness)
static
struct
rte_ether_addr
dst_eth_addr
=
{
{
0x68
,
0x05
,
0xca
,
0x95
,
0xfa
,
0x64
}
};
// TODO from configuration
static
uint32_t
src_ip_addr
=
RTE_IPV4
(
2
,
100
,
31
,
172
);
// TODO from bind (reversed for endianness)
// Validate the arguments
if
(
sendto_validate_args
(
sockfd
,
buf
,
len
,
flags
,
dest_addr
,
addrlen
)
<
0
)
{
...
...
@@ -226,8 +225,8 @@ ssize_t udpdk_sendto(int sockfd, const void *buf, size_t len, int flags,
// Initialize the Ethernet header
eth_hdr
=
rte_pktmbuf_mtod
(
pkt
,
struct
rte_ether_hdr
*
);
rte_ether_addr_copy
(
&
src_eth
_addr
,
&
eth_hdr
->
s_addr
);
rte_ether_addr_copy
(
&
dst_eth
_addr
,
&
eth_hdr
->
d_addr
);
rte_ether_addr_copy
(
&
config
.
src_mac
_addr
,
&
eth_hdr
->
s_addr
);
rte_ether_addr_copy
(
&
config
.
dst_mac
_addr
,
&
eth_hdr
->
d_addr
);
eth_hdr
->
ether_type
=
rte_cpu_to_be_16
(
RTE_ETHER_TYPE_IPV4
);
// Initialize the IP header
...
...
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