thombashi / tcconfig

A tc command wrapper. Make it easy to set up traffic control of network bandwidth/latency/packet-loss/packet-corruption/etc. to a network-interface/Docker-container(veth).
https://tcconfig.rtfd.io/
MIT License
788 stars 83 forks source link

when use --dirction incoming , Error reporting “modprobe: FATAL: Module ifb not found in directory /lib/modules/5.15.0-72-generic” #171

Closed DuckDuck88 closed 8 months ago

DuckDuck88 commented 1 year ago

Describe the bug

tcset --device eth0 --loss 40% --direction incoming --debug

WARNING  | subprocrunner._subprocess_runner:_run:192 - command='modprobe ifb', returncode=1, stderr='modprobe: FATAL: Module ifb not found in directory /lib/modules/5.15.0-72-generic\n'
ERROR    | tcconfig.traffic_control:__setup_ifb:397 - modprobe: FATAL: Module ifb not found in directory /lib/modules/5.15.0-72-generic

Expected behavior

success

To Reproduce

use --direction incoming but when direction == outgoing, its ok

output

bash-4.2# tcset --device eth0 --loss 40% --direction incoming --debug
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - lsmod
DEBUG    | simplesqlite.core:connect:266 - connect to a SQLite database: path=':memory:', mode=w
DEBUG    | simplesqlite.core:create_table:1288 - CREATE TABLE IF NOT EXISTS 'filter' (device TEXT NOT NULL, "filter_id" TEXT, flowid TEXT, protocol TEXT, priority INTEGER, [src-network] TEXT, [dst-network] TEXT, [src-port] INTEGER, [dst-port] INTEGER, classid TEXT, handle INTEGER)
DEBUG    | simplesqlite.core:create_table:1288 - CREATE TABLE IF NOT EXISTS 'qdisc' (device TEXT NOT NULL, "direct_qlen" INTEGER, parent TEXT, handle TEXT, delay TEXT, [delay-distro] TEXT, loss TEXT, duplicate TEXT, corrupt TEXT, reorder TEXT, rate TEXT)
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc filter show dev eth0 root
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - modprobe ifb
WARNING  | subprocrunner._subprocess_runner:_run:192 - command='modprobe ifb', returncode=1, stderr='modprobe: FATAL: Module ifb not found in directory /lib/modules/5.15.0-72-generic\n'
ERROR    | tcconfig.traffic_control:__setup_ifb:397 - modprobe: FATAL: Module ifb not found in directory /lib/modules/5.15.0-72-generic

DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/ip link add ifb6682 type ifb
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/ip link set dev ifb6682 up
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc qdisc add dev eth0 ingress
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 flowid 1a1a: action mirred egress redirect dev ifb6682
DEBUG    | tcconfig._common:logging_context:27 - |---- start: _make_qdisc -----
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc qdisc add dev ifb6682 root handle 1a1a: htb default 1
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc class add dev ifb6682 parent 1a1a: classid 1a1a:1 htb rate 32000000.0kbit
DEBUG    | tcconfig._common:logging_context:31 - ----- complete: _make_qdisc ----|
DEBUG    | tcconfig._common:logging_context:27 - |---- start: _add_rate -----
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc class show dev ifb6682
DEBUG    | tcconfig.shaper.htb:__get_unique_qdisc_minor_id:253 - existing class list with dev ifb6682: ['class htb 1a1a:1']
DEBUG    | tcconfig.shaper.htb:__get_unique_qdisc_minor_id:254 - existing minor classid list with dev ifb6682: [1]
DEBUG    | tcconfig.shaper.htb:_get_qdisc_minor_id:43 - __get_unique_qdisc_minor_id: 2
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc class add dev ifb6682 parent 1a1a: classid 1a1a:2 htb rate 32000000.0Kbit ceil 32000000.0Kbit
DEBUG    | tcconfig._common:logging_context:31 - ----- complete: _add_rate ----|
DEBUG    | tcconfig._common:logging_context:27 - |---- start: _set_netem -----
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc qdisc show dev ifb6682
DEBUG    | tcconfig.shaper.htb:__extract_exist_netem_major_ids:274 - existing netem list with dev ifb6682: ['qdisc htb 1a1a']
DEBUG    | tcconfig.shaper.htb:__get_unique_netem_major_id:285 - existing netem major id list with dev ifb6682: [6682]
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc qdisc add dev ifb6682 parent 1a1a:2 handle 22a3: netem loss 40.000000%
DEBUG    | tcconfig._common:logging_context:31 - ----- complete: _set_netem ----|
DEBUG    | tcconfig._common:logging_context:27 - |---- start: _add_exclude_filter -----
DEBUG    | tcconfig.shaper.htb:_add_exclude_filter:154 - no exclude filter found
DEBUG    | tcconfig._common:logging_context:31 - ----- complete: _add_exclude_filter ----|
DEBUG    | tcconfig._common:logging_context:27 - |---- start: _add_filter -----
DEBUG    | subprocrunner._subprocess_runner:__debug_print_command:351 - /usr/sbin/tc filter add dev ifb6682 protocol ip parent 1a1a: prio 5 u32 match ip dst 0.0.0.0/0 match ip src 0.0.0.0/0 flowid 1a1a:2
DEBUG    | tcconfig._common:logging_context:31 - ----- complete: _add_filter ----|
DEBUG    | simplesqlite.core:close:1621 - close connection to a SQLite database: path=':memory:'
DEBUG    | simplesqlite.core:commit:1597 - commit: path=':memory:'
DEBUG    | tcconfig._main:_dump_history:75 - command history
modprobe ifb
/usr/sbin/ip link add ifb6682 type ifb
/usr/sbin/ip link set dev ifb6682 up
/usr/sbin/tc qdisc add dev eth0 ingress
/usr/sbin/tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 flowid 1a1a: action mirred egress redirect dev ifb6682
/usr/sbin/tc qdisc add dev ifb6682 root handle 1a1a: htb default 1
/usr/sbin/tc class add dev ifb6682 parent 1a1a: classid 1a1a:1 htb rate 32000000.0kbit
/usr/sbin/tc class add dev ifb6682 parent 1a1a: classid 1a1a:2 htb rate 32000000.0Kbit ceil 32000000.0Kbit
/usr/sbin/tc qdisc add dev ifb6682 parent 1a1a:2 handle 22a3: netem loss 40.000000%
/usr/sbin/tc filter add dev ifb6682 protocol ip parent 1a1a: prio 5 u32 match ip dst 0.0.0.0/0 match ip src 0.0.0.0/0 flowid 1a1a:2

Environments

Please execute the following command and past the output:

Module Version
uname Linux 5.15.0-72-generic
Python CPython 3.8.12
tcconfig 0.28.0
docker 6.1.2
SimpleSQLite 1.3.0

and complete the following information:

Server: Docker Engine - Community Engine: Version: 23.0.1 API version: 1.42 (minimum version 1.12) Go version: go1.19.5 Git commit: bc3805a Built: Thu Feb 9 19:46:56 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.18 GitCommit: 2456e983eb9e37e47538f59ea18f2043c9a73640 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0


- **Installation Method**: `pip` / `deb package`  pip
DuckDuck88 commented 1 year ago

when the direction is incoming, A network device is automatically added。 use ifconfig show info:

ifb6682: flags=195<UP,BROADCAST,RUNNING,NOARP>  mtu 1500
        ether 12:a3:8a:4f:c2:a9  txqueuelen 32  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Only appears when the direction is incoming

thombashi commented 1 year ago

@DuckDuck88 Could you check your Linux kernel configuration are valid? https://tcconfig.readthedocs.io/en/latest/pages/troubleshooting.html#solutions

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.