Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcshow show incorrect limits when overwriting existing limit with tcset --add #70

Closed
twdkeule opened this issue Jun 7, 2017 · 5 comments
Assignees
Labels

Comments

@twdkeule
Copy link

twdkeule commented Jun 7, 2017

Commands:

➜  ~ sudo tcset --device lo --rate 10M                
➜  ~ sudo tcset --device lo --rate 5M --add 
➜  ~ tcshow --device lo                 
{
    "lo": {
        "outgoing": {
            "network=0.0.0.0/0, protocol=ip": {
                "rate": "5M"
            }
        },
        "incoming": {}
    }
}

iperf3 keeps measuring the actual limit as 10 Mbps while tcshow shows 5 Mbps

@thombashi
Copy link
Owner

Thank you for your report.

Certainly, these are not a preferable behavior.
I think that there are two problems:

  1. tcshow only display the last tc setting
  2. tcset allow multiple shaping rules for the same device and the same network
    • --add option should allow only when different rules for the different devices/networks

I will fix 2. in the future release, and 1. will never happen if I fix 2.

@thombashi thombashi self-assigned this Jun 7, 2017
@thombashi thombashi added the bug label Jun 7, 2017
@twdkeule twdkeule changed the title tcshow show incorrect limits when overwriting existing limit with tcset --addd tcshow show incorrect limits when overwriting existing limit with tcset --add Jun 8, 2017
@twdkeule
Copy link
Author

twdkeule commented Jun 8, 2017

Well 1. can still occur if you make a script with --tc-script and apply that, or when you run tc by itself.
It would be very nice if tcshow would parse the output of tc qdisc show, so it would always be correct. However, this might take it too far.

I am also a bit confused what the --add option does. What would be the difference between

➜  ~ sudo tcset --device lo --rate 10M
➜  ~ sudo tcset --device lo --delay 10

and

➜  ~ sudo tcset --device lo --rate 10M
➜  ~ sudo tcset --device lo --delay 10 --add

thombashi added a commit that referenced this issue Jun 11, 2017
If certain path (source/destination and network/port) already has
a shaping rule, does not try to add a shaping rule.
That may cause unexpected result.

Issue: #70
@thombashi
Copy link
Owner

I've fixed the 2. at tcconfig 0.12.0.

Well 1. can still occur if you make a script with --tc-script and apply that, or when you run tc by itself.
It would be very nice if tcshow would parse the output of tc qdisc show, so it would always be correct. However, this might take it too far.

You are absolutely right. However, that is out of scope (at least for now).
tcshow only aims to show the settings by tcset (too many things to consider to create general purpose tc setting display tool)

I am also a bit confused what the --add option does. What would be the difference between

Purpose --add option is to set multiple shaping rules to a device as follows:

# tcset --device eth0 --network 192.168.0.0/24 --delay 10
# tcset --device eth0 --network 192.168.1.0/24 --delay 50
[NOTICE] tcconfig: failed to 'tc qdisc add': qdisc already exists (dev eth0, handle=1a1a:, algo=htb). execute with --overwrite option if you want to overwrite the existing rules. execute with --add option if you want to add a new rule in addition to the existing rules.
# tcset --device eth0 --network 192.168.1.0/24 --delay 50 --add
# tcshow --device eth0
{
    "eth0": {
        "outgoing": {
            "dst-network=192.168.1.0/24, protocol=ip": {
                "delay": "50.0",
                "rate": "1G"
            },
            "dst-network=192.168.0.0/24, protocol=ip": {
                "delay": "10.0",
                "rate": "1G"
            }
        },
        "incoming": {}
    }
}

@twdkeule
Copy link
Author

Thanks, now I get it.

@thombashi
Copy link
Owner

I'll close the issue then.
Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants