Open Engage-r opened 9 months ago
Hey I am new to bcc and am trying to change tcp congestion control algorithm using bcc. I wrote this simple python script:
from bcc import BPF bpf_source = """ #include <linux/bpf.h> #include <linux/version.h> #include <bcc/proto.h> #include <bcc/helpers.h> #include <linux/tcp.h> #define TCP_CONGESTION 13 int bpf_set_congestion_control(struct bpf_sock_ops *skops) { if (skops == NULL) return 0; char cong_alg[] = "reno"; bpf_setsockopt(skops, SOL_TCP, TCP_CONGESTION, cong_alg, sizeof(cong_alg)); return 0; } """ bpf = BPF(text=bpf_source) bpf.attach_kprobe(event="tcp_v4_connect", fn_name="bpf_set_congestion_control")
but when running it throws error:
bpf: Failed to load program: Invalid argument 10: (85) call bpf_setsockopt#49 unknown func bpf_setsockopt#49
Would be highly obliged if someone could help
What version of kernel do you use?
bpf_setsockopt was introduced since v4.13.
bpf_setsockopt
See https://ebpf-docs.dylanreimerink.nl/linux/helper-function/bpf_setsockopt/
Hey I am new to bcc and am trying to change tcp congestion control algorithm using bcc. I wrote this simple python script:
but when running it throws error:
Would be highly obliged if someone could help