Skip to content

fix issue where clsact qdisc is applied twice resulting in failure#15

Merged
AzuraTarmiziIntel merged 1 commit into
mainfrom
fix-missing-clsact-qdisc
Mar 16, 2026
Merged

fix issue where clsact qdisc is applied twice resulting in failure#15
AzuraTarmiziIntel merged 1 commit into
mainfrom
fix-missing-clsact-qdisc

Conversation

@liowsj
Copy link
Copy Markdown
Contributor

@liowsj liowsj commented Mar 12, 2026

  • commands are now created then applied immediately, instead of creating all commands first then applying.
  • avoids issue where commands are created by referring to an outdated system state where clsact qdisc has not been applied yet

Comment thread src/time_config_hub/core.py
Comment thread src/time_config_hub/core.py
@AzuraTarmiziIntel
Copy link
Copy Markdown
Contributor

AzuraTarmiziIntel commented Mar 13, 2026

an example if using netlink courtesy of google.

code Example:
python
from pyroute2 import IPRoute
from pyroute2.netlink.exceptions import NetlinkError

def setup_clsact(ifname="eth0"):
with IPRoute() as ip:
idx = ip.link_lookup(ifname=ifname)[0]

    # Check if clsact already exists
    qdiscs = ip.get_qdiscs(idx)
    clsact_exists = any(q.get_attr('TCA_KIND') == 'clsact' for q in qdiscs)
    
    if not clsact_exists:
        print(f"Adding clsact to {ifname}...")
        try:
            ip.tc("add", "clsact", idx)
            print("clsact added successfully.")
        except NetlinkError as e:
            print(f"Failed to add clsact: {e}")
    else:
        print(f"clsact already exists on {ifname}.")

Run the check

setup_clsact("eth0") # Replace with your interface name

i like this netlink solution. we are moving away from filtering output from tc commands anyway in the future. so it makes this helper function future proof.
Code once code well. :)

Copy link
Copy Markdown
Contributor

@AzuraTarmiziIntel AzuraTarmiziIntel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explained.

@AzuraTarmiziIntel AzuraTarmiziIntel merged commit 373a0be into main Mar 16, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants