iovisor / iovisor/bcc

unknown function : bpf_setsockopt

Open
#4,915 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
5d 13h
Merged PRs (30d)
3

Description

Hey I am new to bcc and am trying to change tcp congestion control algorithm using bcc.
I wrote this simple python script:
```python
from bcc import BPF
bpf_source = """
#include
#include
#include
#include
#include
#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:
```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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the embedded BPF source and the bpf_setsockopt call, then inspect how tcp_v4_connect is attached to the bpf_sock_ops function. Run the script and investigate the reported “unknown func bpf_setsockopt” loader error; done means the program loads and the requested congestion-control change can be verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.