-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ktls selftest Signed-off-by: Jiayuan Chen <[email protected]>
- Loading branch information
Showing
2 changed files
with
199 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
#include <linux/bpf.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_endian.h> | ||
|
||
int cork_byte; | ||
int push_start; | ||
int push_end; | ||
|
||
struct { | ||
__uint(type, BPF_MAP_TYPE_SOCKMAP); | ||
__uint(max_entries, 20); | ||
__type(key, int); | ||
__type(value, int); | ||
} sock_map SEC(".maps"); | ||
|
||
SEC("sk_msg") | ||
int prog_sk_policy(struct sk_msg_md *msg) | ||
{ | ||
if (cork_byte > 0) | ||
bpf_msg_cork_bytes(msg, cork_byte); | ||
if (push_start > 0 && push_end > 0) | ||
bpf_msg_push_data(msg, push_start, push_end, 0); | ||
|
||
return SK_PASS; | ||
} |