Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
93c5d5d3
Commit
93c5d5d3
authored
Dec 14, 2020
by
Vincent van Beveren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added TCP/IP to packet filter rules
parent
501fe048
Pipeline
#713
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
pfilter-builder.c
tools/pfilter-builder.c
+10
-16
No files found.
tools/pfilter-builder.c
View file @
93c5d5d3
...
...
@@ -221,18 +221,15 @@ enum pf_symbolic_regs {
FRAME_TYPE_PTP2
,
FRAME_TYPE_LATENCY
,
FRAME_TYPE_ARP
,
FRAME_ICMP
,
FRAME_UDP
,
FRAME_FOR_2ND_IPV4
,
PORT_UDP_HOST
,
PORT_UDP_ETHERBONE
,
R_TMP
,
/* These are results of logic over the previous bits */
FRAME_IP_UNI
,
FRAME_IP_OK
,
/* unicast or broadcast */
/* A temporary register, and the CPU target */
FRAME_FOR_2ND
,
FRAME_FOR_CPU
,
/* must be last */
};
...
...
@@ -379,6 +376,8 @@ void pfilter_init_novlan(char *fname)
* After these instructions, the whole Eth header is there
*/
#define FRAME_FOR_2ND R_CLASS(7)
/* Local frame, using fake MAC: 12:34:56:78:9a:bc */
pfilter_cmp
(
0
,
0x1234
,
0xffff
,
MOV
,
FRAME_MAC_OK
);
pfilter_cmp
(
1
,
0x5678
,
0xffff
,
AND
,
FRAME_MAC_OK
);
...
...
@@ -410,14 +409,10 @@ void pfilter_init_novlan(char *fname)
pfilter_cmp
(
6
,
0x0800
,
0xffff
,
MOV
,
FRAME_TYPE_IPV4
);
pfilter_cmp
(
6
,
0x0806
,
0xffff
,
MOV
,
FRAME_TYPE_ARP
);
/* Mark one bits for ip-valid (unicast or broadcast) */
pfilter_logic3
(
FRAME_IP_OK
,
FRAME_BROADCAST
,
OR
,
FRAME_MAC_OK
,
AND
,
FRAME_TYPE_IPV4
);
/* Ethernet = 14 bytes, Offset to type in IP: 8 bytes = 22/2 = 11 */
pfilter_cmp
(
11
,
0x0001
,
0x00ff
,
MOV
,
FRAME_ICMP
);
pfilter_cmp
(
11
,
0x0011
,
0x00ff
,
MOV
,
FRAME_UDP
);
pfilter_logic2
(
FRAME_UDP
,
FRAME_UDP
,
AND
,
FRAME_IP_OK
);
pfilter_logic2
(
FRAME_ICMP
,
FRAME_ICMP
,
AND
,
FRAME_IP_OK
);
pfilter_cmp
(
11
,
0x0001
,
0x00ff
,
MOV
,
FRAME_FOR_2ND_IPV4
);
pfilter_cmp
(
11
,
0x0011
,
0x00ff
,
OR
,
FRAME_FOR_2ND_IPV4
);
pfilter_cmp
(
11
,
0x0006
,
0x00ff
,
OR
,
FRAME_FOR_2ND_IPV4
);
#ifdef CONFIG_WR_NIC_CPU
/* For CPU: icmp unicast or ptp (or latency) */
...
...
@@ -429,12 +424,11 @@ void pfilter_init_novlan(char *fname)
/* For CPU: just ptp (or latency) */
pfilter_logic2
(
FRAME_FOR_CPU
,
FRAME_MAC_PTP
,
OR
,
FRAME_TYPE_PTP2
);
//pfilter_logic3(FRAME_FOR_CPU, FRAME_IP_OK, AND, FRAME_ICMP, OR, FRAME_FOR_CPU);
/* For LM32_2ND: arp or icmp or udp */
pfilter_logic3
(
FRAME_FOR_2ND
,
FRAME_
TYPE_ARP
,
OR
,
FRAME_ICMP
,
OR
,
FRAME_UD
P
);
/* For LM32_2ND: arp or icmp or udp
or TCP
*/
pfilter_logic3
(
FRAME_FOR_2ND
,
FRAME_
FOR_2ND_IPV4
,
AND
,
FRAME_TYPE_IPV4
,
OR
,
FRAME_TYPE_AR
P
);
#endif
/* Now look in UDP ports: at offset 18 (14 + 20 + 8 = 36) */
pfilter_cmp
(
18
,
0x0000
,
0xff00
,
MOV
,
PORT_UDP_HOST
);
/* ports 0-255 */
pfilter_cmp
(
18
,
0x0100
,
0xff00
,
OR
,
PORT_UDP_HOST
);
/* ports 256-511 */
...
...
@@ -451,7 +445,7 @@ void pfilter_init_novlan(char *fname)
//pfilter_logic2(R_CLASS(7), FRAME_UDP, AND, PORT_UDP_ETHERBONE);
//pfilter_logic2(R_CLASS(6), FRAME_UDP, NAND, PORT_UDP_ETHERBONE);
/* For LM32_2ND: arp or icmp or udp */
pfilter_logic2
(
R_CLASS
(
7
),
FRAME_FOR_2ND
,
OR
,
FRAME_FOR_2ND
);
//
pfilter_logic2(R_CLASS(7), FRAME_FOR_2ND, OR, FRAME_FOR_2ND);
/* drop anything else */
pfilter_logic3
(
R_DROP
,
FRAME_FOR_CPU
,
OR
,
FRAME_FOR_2ND
,
NOT
,
R_ZERO
);
...
...
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