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