mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
ptp: Classify ptp over ip over vlan packets
This extends the ptp bpf to also match ptp over ip over vlan packets. The ptp classes are changed to orthogonal bitfields representing version, transport and vlan values to simplify matching. Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b9c701edc7
commit
ae5c6c6d7b
4 changed files with 92 additions and 47 deletions
|
@ -52,15 +52,44 @@
|
|||
* test_8021q:
|
||||
* jneq #0x8100, test_ieee1588 ; ETH_P_8021Q ?
|
||||
* ldh [16] ; load inner type
|
||||
* jneq #0x88f7, drop_ieee1588 ; ETH_P_1588 ?
|
||||
* jneq #0x88f7, test_8021q_ipv4 ; ETH_P_1588 ?
|
||||
* ldb [18] ; load payload
|
||||
* and #0x8 ; as we don't have ports here, test
|
||||
* jneq #0x0, drop_ieee1588 ; for PTP_GEN_BIT and drop these
|
||||
* ldh [18] ; reload payload
|
||||
* and #0xf ; mask PTP_CLASS_VMASK
|
||||
* or #0x40 ; PTP_CLASS_V2_VLAN
|
||||
* or #0x70 ; PTP_CLASS_VLAN|PTP_CLASS_L2
|
||||
* ret a ; return PTP class
|
||||
*
|
||||
* ; PTP over UDP over IPv4 over 802.1Q over Ethernet
|
||||
* test_8021q_ipv4:
|
||||
* jneq #0x800, test_8021q_ipv6 ; ETH_P_IP ?
|
||||
* ldb [27] ; load proto
|
||||
* jneq #17, drop_8021q_ipv4 ; IPPROTO_UDP ?
|
||||
* ldh [24] ; load frag offset field
|
||||
* jset #0x1fff, drop_8021q_ipv4; don't allow fragments
|
||||
* ldxb 4*([18]&0xf) ; load IP header len
|
||||
* ldh [x + 20] ; load UDP dst port
|
||||
* jneq #319, drop_8021q_ipv4 ; is port PTP_EV_PORT ?
|
||||
* ldh [x + 26] ; load payload
|
||||
* and #0xf ; mask PTP_CLASS_VMASK
|
||||
* or #0x50 ; PTP_CLASS_VLAN|PTP_CLASS_IPV4
|
||||
* ret a ; return PTP class
|
||||
* drop_8021q_ipv4: ret #0x0 ; PTP_CLASS_NONE
|
||||
*
|
||||
* ; PTP over UDP over IPv6 over 802.1Q over Ethernet
|
||||
* test_8021q_ipv6:
|
||||
* jneq #0x86dd, drop_8021q_ipv6 ; ETH_P_IPV6 ?
|
||||
* ldb [24] ; load proto
|
||||
* jneq #17, drop_8021q_ipv6 ; IPPROTO_UDP ?
|
||||
* ldh [60] ; load UDP dst port
|
||||
* jneq #319, drop_8021q_ipv6 ; is port PTP_EV_PORT ?
|
||||
* ldh [66] ; load payload
|
||||
* and #0xf ; mask PTP_CLASS_VMASK
|
||||
* or #0x60 ; PTP_CLASS_VLAN|PTP_CLASS_IPV6
|
||||
* ret a ; return PTP class
|
||||
* drop_8021q_ipv6: ret #0x0 ; PTP_CLASS_NONE
|
||||
*
|
||||
* ; PTP over Ethernet
|
||||
* test_ieee1588:
|
||||
* jneq #0x88f7, drop_ieee1588 ; ETH_P_1588 ?
|
||||
|
@ -113,16 +142,39 @@ void __init ptp_classifier_init(void)
|
|||
{ 0x44, 0, 0, 0x00000020 },
|
||||
{ 0x16, 0, 0, 0x00000000 },
|
||||
{ 0x06, 0, 0, 0x00000000 },
|
||||
{ 0x15, 0, 9, 0x00008100 },
|
||||
{ 0x15, 0, 32, 0x00008100 },
|
||||
{ 0x28, 0, 0, 0x00000010 },
|
||||
{ 0x15, 0, 15, 0x000088f7 },
|
||||
{ 0x15, 0, 7, 0x000088f7 },
|
||||
{ 0x30, 0, 0, 0x00000012 },
|
||||
{ 0x54, 0, 0, 0x00000008 },
|
||||
{ 0x15, 0, 12, 0x00000000 },
|
||||
{ 0x15, 0, 35, 0x00000000 },
|
||||
{ 0x28, 0, 0, 0x00000012 },
|
||||
{ 0x54, 0, 0, 0x0000000f },
|
||||
{ 0x44, 0, 0, 0x00000040 },
|
||||
{ 0x44, 0, 0, 0x00000070 },
|
||||
{ 0x16, 0, 0, 0x00000000 },
|
||||
{ 0x15, 0, 12, 0x00000800 },
|
||||
{ 0x30, 0, 0, 0x0000001b },
|
||||
{ 0x15, 0, 9, 0x00000011 },
|
||||
{ 0x28, 0, 0, 0x00000018 },
|
||||
{ 0x45, 7, 0, 0x00001fff },
|
||||
{ 0xb1, 0, 0, 0x00000012 },
|
||||
{ 0x48, 0, 0, 0x00000014 },
|
||||
{ 0x15, 0, 4, 0x0000013f },
|
||||
{ 0x48, 0, 0, 0x0000001a },
|
||||
{ 0x54, 0, 0, 0x0000000f },
|
||||
{ 0x44, 0, 0, 0x00000050 },
|
||||
{ 0x16, 0, 0, 0x00000000 },
|
||||
{ 0x06, 0, 0, 0x00000000 },
|
||||
{ 0x15, 0, 8, 0x000086dd },
|
||||
{ 0x30, 0, 0, 0x00000018 },
|
||||
{ 0x15, 0, 6, 0x00000011 },
|
||||
{ 0x28, 0, 0, 0x0000003c },
|
||||
{ 0x15, 0, 4, 0x0000013f },
|
||||
{ 0x28, 0, 0, 0x00000042 },
|
||||
{ 0x54, 0, 0, 0x0000000f },
|
||||
{ 0x44, 0, 0, 0x00000060 },
|
||||
{ 0x16, 0, 0, 0x00000000 },
|
||||
{ 0x06, 0, 0, 0x00000000 },
|
||||
{ 0x15, 0, 7, 0x000088f7 },
|
||||
{ 0x30, 0, 0, 0x0000000e },
|
||||
{ 0x54, 0, 0, 0x00000008 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue