Skip to content
  • MXAmin's avatar
    tc: fix HTB QDisc generation with default arguments · f32baf46
    MXAmin authored
    When we call `tc` function for creating the HTB QDisc with NO kwargs,
    the kernel will return error 22 (invalid argument)::
    
    	 ip.tc("add", "htb", eth0, 0x10000)
    	 pyroute2.netlink.exceptions.NetlinkError: (22, 'Invalid argument')
    
    As you can see by calling the `tc` function without any additional
    arguments (we only defined `command`, `kind`, `index` and `handle`
    arguments) the module will raise `NetlinkError`; reason: according to
    'net/sched/sch_htb.c' of linux kernel source code, to create a HTB
    QDisc we also need to define `direct_pkts`, `rate2quantum` and
    `defcls` which is not defined by default (the function `get_parameters`
    is responsible for providing these default arguments which WON'T be
    called unless we have at least ONE argument in kwargs.
    
    Bug-Url: https://github.com/svinota/pyroute2/pull/308
    f32baf46