forked from richardcochran/linuxptp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
raw: Use BPF filter based on tcpdump syntax.
Replace the hand written BPF code with something that has been created by tcpdump based on a filter rule. This has the advantage that it can be extended/ modified based text syntax and is safer to extend in regard to jump labels. The generated asm/ BFP code is longer by one opcode because the "and" operation from VLAN and non-VLAN comparison is not optimized/ merged as it is the case in the hand-written code. Also provide two structs/ filters which either filter for the generic or event PTP packet instead of accessing the struct directly and changing the jump opcode. The result is less readable if it comes to offsets. If this is an issue than it could be optimized with some kind of pre-processor. Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
- Loading branch information
1 parent
09de7d0
commit c74df1b
Showing
3 changed files
with
76 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,4 @@ struct vlan_hdr { | |
uint16_t type; | ||
} __attribute__((packed)); | ||
|
||
#define OFF_ETYPE (2 * sizeof(eth_addr)) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters