blob: eda4697aac80b60458f23261b0769b4eb4d1fbbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// SPDX-License-Identifier: GPL-2.0
#include "bpf_tracing_net.h"
#include <bpf/bpf_core_read.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL";
SEC("struct_ops")
void BPF_PROG(untrusted_btf_write_init, struct sock *sk)
{
struct tcp_sock *tp;
int v = 1;
void *p;
p = bpf_rdonly_cast(&v, 0);
tp = bpf_rdonly_cast(p, bpf_core_type_id_kernel(struct tcp_sock));
tp->snd_cwnd = 1;
}
SEC(".struct_ops")
struct tcp_congestion_ops untrusted_btf_write = {
.init = (void *)untrusted_btf_write_init,
.name = "bpf_ro_btf",
};
|