Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
trx-ecpri
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
nexedi
trx-ecpri
Commits
b27b6ce2
Commit
b27b6ce2
authored
Feb 12, 2025
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter packet on ether type
parent
b730271d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
trx_ecpri.c
trx_ecpri.c
+25
-1
No files found.
trx_ecpri.c
View file @
b27b6ce2
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#include <immintrin.h>
#include <immintrin.h>
#include <inttypes.h>
#include <inttypes.h>
#include <limits.h>
#include <limits.h>
#include <linux/filter.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/if_packet.h>
#include <math.h>
#include <math.h>
#include <netdb.h>
#include <netdb.h>
...
@@ -709,6 +711,19 @@ int start(TRXEcpriState * s) {
...
@@ -709,6 +711,19 @@ int start(TRXEcpriState * s) {
log_debug
(
"TRX_ECPRI"
,
"raw socket setup"
);
log_debug
(
"TRX_ECPRI"
,
"raw socket setup"
);
/* From the example above: tcpdump -i em1 port 22 -dd */
struct
sock_filter
code
[]
=
{
{
0x28
,
0
,
0
,
0x0000000c
},
{
0x15
,
0
,
1
,
0x0000aefe
},
{
0x06
,
0
,
0
,
0x00040000
},
{
0x06
,
0
,
0
,
0x00000000
},
};
struct
sock_fprog
bpf
=
{
.
len
=
4
,
.
filter
=
code
,
};
//set_latency_target();
//set_latency_target();
tx_seq_id
=
0
;
tx_seq_id
=
0
;
...
@@ -779,7 +794,16 @@ int start(TRXEcpriState * s) {
...
@@ -779,7 +794,16 @@ int start(TRXEcpriState * s) {
return
1
;
return
1
;
}
}
// Only receive incoming packets, don't capture packets we are sending
// Only receive incoming packets, don't capture packets we are sending
setsockopt
(
recv_sockfd
,
SOL_PACKET
,
PACKET_IGNORE_OUTGOING
,
&
(
int
){
1
},
sizeof
(
int
));
if
(
setsockopt
(
recv_sockfd
,
SOL_PACKET
,
PACKET_IGNORE_OUTGOING
,
&
(
int
){
1
},
sizeof
(
int
)))
{
perror
(
"setsockopt PACKET_IGNORE_OUTGOING: "
);
return
1
;
}
// Filter on MAC ADDRESS
if
(
setsockopt
(
recv_sockfd
,
SOL_SOCKET
,
SO_ATTACH_FILTER
,
&
bpf
,
sizeof
(
bpf
)))
{
perror
(
"setsockopt SO_ATTACH_FILTER: "
);
return
1
;
}
connect_sk_addr
.
sll_ifindex
=
if_index
;
connect_sk_addr
.
sll_ifindex
=
if_index
;
connect_sk_addr
.
sll_halen
=
ETH_ALEN
;
connect_sk_addr
.
sll_halen
=
ETH_ALEN
;
...
...
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