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
786 stars 82 forks source link

Doesn't work with busybox #176

Open topas-rec opened 9 months ago

topas-rec commented 9 months ago

Describe the bug

Fetching command paths like for the ip command doesn't work on systems using busybox.

OpenWRT uses busybox which provides commands like ip for embedded Linux systems.

Expected behavior

Running tcset to create incoming rate shaping rules works even if the ip command is provided through busybox.

To Reproduce

Steps to reproduce the behavior:

  1. Install OpenWRT and busybox (and dependencies for tcconfig)
  2. Run tcset eth0 --direction incoming --rate 1Mbps
  3. Observe errors where tcconfic is calling /path/to/busybox link add dev ifbXXXX type ifb and fails with errors

Environments

Please execute the following command and past the output:

Removed, reason for this issue is already known and noted below.

Complete the following information:

Additional context

Add any other context (logs, error output, etc.) about the problem here.

The ip command path is not found on OpenWRT because tcconfig uses python subprocrunner.Which with following symlinks enabled.

See https://github.com/thombashi/tcconfig/blob/e14f9fbdb235e2d6b2748962735dcf3fa1f356f3/tcconfig/_common.py#L45

It is used since https://github.com/thombashi/tcconfig/commit/179fcafb9fc4260289d0339f88de36c51e5b684a.

The command ip is symlinked with busybox in OpenWRT. When the symlink option of that command is set to False in a manual test the ip command path (/path/to/ip) can be fetched successfully.

Was there a specific reason to enable symlinks here?

A workaround would be to generate a tc script through tcconfig, modify it and use that. It would be nice if it works with busybox, too. If yes, then the symlink option is in question.

thombashi commented 4 months ago

Thank you for your report.

To check the capability permission, it is necessary to obtain the full path of the command entity. However, in certain environments, you may encounter problems like this issue. For such cases, we may better consider adding an option to skip obtaining the full path of the commands.