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
6
Merge Requests
6
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
851090af
Commit
851090af
authored
Sep 07, 2018
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KM3NeT pfilter rules: ptp only => LM32_wrpc; arp or icmp or udp => LM32_2ND; drop anything else
parent
a92722d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
pfilter-builder.c
tools/pfilter-builder.c
+20
-7
No files found.
tools/pfilter-builder.c
View file @
851090af
...
@@ -229,6 +229,7 @@ enum pf_symbolic_regs {
...
@@ -229,6 +229,7 @@ enum pf_symbolic_regs {
FRAME_IP_OK
,
/* unicast or broadcast */
FRAME_IP_OK
,
/* unicast or broadcast */
/* A temporary register, and the CPU target */
/* A temporary register, and the CPU target */
FRAME_FOR_2ND
,
FRAME_FOR_CPU
,
/* must be last */
FRAME_FOR_CPU
,
/* must be last */
};
};
...
@@ -393,7 +394,8 @@ void pfilter_init_novlan(char *fname)
...
@@ -393,7 +394,8 @@ void pfilter_init_novlan(char *fname)
/* PTP UDP (peer-to-p: 01:00:5e:00:00:6b 224.0.0.197) */
/* PTP UDP (peer-to-p: 01:00:5e:00:00:6b 224.0.0.197) */
pfilter_cmp
(
2
,
0x006b
,
0xffff
,
OR
,
R_TMP
);
pfilter_cmp
(
2
,
0x006b
,
0xffff
,
OR
,
R_TMP
);
pfilter_logic3
(
FRAME_MAC_OK
,
FRAME_MAC_PTP
,
AND
,
R_TMP
,
OR
,
FRAME_MAC_OK
);
//pfilter_logic3(FRAME_MAC_OK, FRAME_MAC_PTP, AND, R_TMP, OR, FRAME_MAC_OK);
pfilter_logic2
(
FRAME_MAC_PTP
,
FRAME_MAC_PTP
,
AND
,
R_TMP
);
/* Tagged is dropped. We'll invert the check in the vlan rule-set */
/* Tagged is dropped. We'll invert the check in the vlan rule-set */
pfilter_cmp
(
6
,
0x8100
,
0xffff
,
MOV
,
R_TMP
);
pfilter_cmp
(
6
,
0x8100
,
0xffff
,
MOV
,
R_TMP
);
...
@@ -412,24 +414,35 @@ void pfilter_init_novlan(char *fname)
...
@@ -412,24 +414,35 @@ void pfilter_init_novlan(char *fname)
pfilter_cmp
(
11
,
0x0001
,
0x00ff
,
MOV
,
FRAME_ICMP
);
pfilter_cmp
(
11
,
0x0001
,
0x00ff
,
MOV
,
FRAME_ICMP
);
pfilter_cmp
(
11
,
0x0011
,
0x00ff
,
MOV
,
FRAME_UDP
);
pfilter_cmp
(
11
,
0x0011
,
0x00ff
,
MOV
,
FRAME_UDP
);
pfilter_logic2
(
FRAME_UDP
,
FRAME_UDP
,
AND
,
FRAME_IP_OK
);
pfilter_logic2
(
FRAME_UDP
,
FRAME_UDP
,
AND
,
FRAME_IP_OK
);
pfilter_logic2
(
FRAME_ICMP
,
FRAME_ICMP
,
AND
,
FRAME_IP_OK
);
/* For CPU: arp or icmp unicast or ptp (or latency) */
/* For CPU: arp or icmp unicast or ptp (or latency) */
pfilter_logic2
(
FRAME_FOR_CPU
,
FRAME_TYPE_ARP
,
OR
,
FRAME_TYPE_PTP2
);
//pfilter_logic2(FRAME_FOR_CPU, FRAME_TYPE_ARP, OR, FRAME_TYPE_PTP2);
pfilter_logic3
(
FRAME_FOR_CPU
,
FRAME_IP_OK
,
AND
,
FRAME_ICMP
,
OR
,
FRAME_FOR_CPU
);
/* 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_UDP
);
/* Now look in UDP ports: at offset 18 (14 + 20 + 8 = 36) */
/* 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
,
0x0000
,
0xff00
,
MOV
,
PORT_UDP_HOST
);
/* ports 0-255 */
pfilter_cmp
(
18
,
0x0100
,
0xff00
,
OR
,
PORT_UDP_HOST
);
/* ports 256-511 */
pfilter_cmp
(
18
,
0x0100
,
0xff00
,
OR
,
PORT_UDP_HOST
);
/* ports 256-511 */
/* The CPU gets those ports in a proper UDP frame, plus the previous selections */
/* The CPU gets those ports in a proper UDP frame, plus the previous selections */
pfilter_logic3
(
R_CLASS
(
0
),
FRAME_UDP
,
AND
,
PORT_UDP_HOST
,
OR
,
FRAME_FOR_CPU
);
//pfilter_logic3(R_CLASS(0), FRAME_UDP, AND, PORT_UDP_HOST, OR, FRAME_FOR_CPU);
/* For CPU: just ptp */
pfilter_logic2
(
R_CLASS
(
0
),
FRAME_FOR_CPU
,
OR
,
FRAME_FOR_CPU
);
/* Etherbone is UDP at port 0xebd0, let's "or" in the last move */
/* Etherbone is UDP at port 0xebd0, let's "or" in the last move */
pfilter_cmp
(
18
,
0xebd0
,
0xffff
,
MOV
,
PORT_UDP_ETHERBONE
);
//
pfilter_cmp(18, 0xebd0, 0xffff, MOV, PORT_UDP_ETHERBONE);
/* and now copy out fabric selections: 7 etherbone, 6 for anything else */
/* and now copy out fabric selections: 7 etherbone, 6 for anything else */
pfilter_logic2
(
R_CLASS
(
7
),
FRAME_UDP
,
AND
,
PORT_UDP_ETHERBONE
);
//pfilter_logic2(R_CLASS(7), FRAME_UDP, AND, PORT_UDP_ETHERBONE);
pfilter_logic2
(
R_CLASS
(
6
),
FRAME_UDP
,
NAND
,
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
);
/* drop anything else */
pfilter_logic3
(
R_DROP
,
FRAME_FOR_CPU
,
OR
,
FRAME_FOR_2ND
,
NOT
,
R_ZERO
);
/*
/*
* Note that earlier we used to be more strict in ptp ethtype (only proper multicast),
* Note that earlier we used to be more strict in ptp ethtype (only proper multicast),
...
...
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