-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CWS] add kernel bpf filter for raw packet #30288
Merged
Merged
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
5f3a45d
add bpf filter
safchain 42578cc
rework in-kernel
safchain 5c2e049
add map lookup
safchain 51e9148
add bpf to ebpf
safchain 7e647a9
prefix with oo_
safchain dac26c2
fix update field values
safchain 6f6ee7d
make use of packet.filter
safchain b891d14
bulk insert
safchain a05774d
imp comment
safchain a215cfe
report error and support reload
safchain 60c720e
use dedicated file
safchain 7ce3fce
rename sender prog properly
safchain 35debfa
prepare tail calls
safchain af2ceb3
fix and test tail calls
safchain 2a3c560
nit fixes
safchain f16ecae
add max tail calls
safchain 2781508
add unit
safchain 0e84b18
wip ut
safchain c8d71a7
remove ut for now
safchain 1e62f26
fix commment and linters
safchain 1401c2e
remove pcap dep
safchain 7a8bc2a
decouple pcap part
safchain e4ac34d
remove _ from the packet name
safchain 82e7ec7
remove rawpacket prefix
safchain 2312a13
re-add raw packet validator
safchain b032a72
fix bad raw_packet renaming
safchain f3e3f04
rename no_pcap
safchain 50b0533
re-add ut
safchain 2fcf55b
make pcap available for ut
safchain 3ff1586
skip non supported platform
safchain 52bd8f6
skip 4.14
safchain 2b89b6b
fix raw packet support check
safchain 39ba343
add more ut
safchain fd0c74f
use 2 differents prog maps
safchain 41b7614
fix overridden
safchain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef _RAW_PACKET_TEST_H | ||
#define _RAW_PACKET_TEST_H | ||
|
||
#include "helpers/network.h" | ||
#include "baloum.h" | ||
|
||
SEC("test/raw_packet_tail_calls") | ||
int raw_packet_tail_calls(struct __sk_buff *skb) { | ||
struct raw_packet_event_t *evt = get_raw_packet_event(); | ||
assert_not_null(evt, "unable to get raw packet event") | ||
|
||
// tcp dst port 5555 and tcp[tcpflags] == tcp-syn | ||
unsigned char data[] = { | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x10, | ||
0x00, 0x30, 0xf4, 0xa2, 0x40, 0x00, 0x40, 0x06, | ||
0x48, 0x13, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, | ||
0x00, 0x01, 0xa2, 0x36, 0x15, 0xb3, 0x1c, 0x5b, | ||
0x89, 0x33, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, | ||
0xff, 0xd7, 0xfe, 0x24, 0x00, 0x00, 0x02, 0x04, | ||
0xff, 0xd7, 0x01, 0x03, 0x03, 0x07 | ||
}; | ||
baloum_memcpy(evt->data, data, sizeof(data)); | ||
|
||
bpf_tail_call_compat(skb, &raw_packet_classifier_router, RAW_PACKET_FILTER); | ||
|
||
return 1; | ||
} | ||
|
||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
|
||
#include "discarders_test.h" | ||
#include "activity_dump_ratelimiter_test.h" | ||
#include "raw_packet_test.h" | ||
|
||
#endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think now that we have two types of tc classifiers, it would probably be best to use two different program maps so that we cannot have key conflits, for example if we want to add new classes of packets in addition to DNS and IMDS and avoid conflicts with programs generated for raw packet filters.