]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
HTB: Append TCA_OPTIONS even if no options are set
authorThomas Graf <tgraf@suug.ch>
Tue, 19 Oct 2010 11:10:26 +0000 (13:10 +0200)
committerThomas Graf <tgraf@suug.ch>
Tue, 19 Oct 2010 11:10:26 +0000 (13:10 +0200)
The kernel requires the TCA_OPTIONS{TCA_HTB_INIT} attribute to be
present even if the default values are to be used.

lib/route/sch/htb.c

index a16713607c967d27d7d0538c5bad69fe67863f16..f45c2cfe2d6d8a2b7c2114f8e309ae02cd6c38c0 100644 (file)
@@ -232,20 +232,20 @@ static struct nl_msg *htb_qdisc_get_opts(struct rtnl_qdisc *qdisc)
        struct tc_htb_glob opts;
        struct nl_msg *msg;
 
-       if (d == NULL)
-               return NULL;
-
        msg = nlmsg_alloc();
        if (msg == NULL)
                return NULL;
 
        memset(&opts, 0, sizeof(opts));
        opts.version = TC_HTB_PROTOVER;
+       opts.rate2quantum = 10;
 
-       if (d->qh_mask & SCH_HTB_HAS_RATE2QUANTUM)
-               opts.rate2quantum = d->qh_rate2quantum;
-       if (d->qh_mask & SCH_HTB_HAS_DEFCLS)
-               opts.defcls = d->qh_defcls;
+       if (d) {
+               if (d->qh_mask & SCH_HTB_HAS_RATE2QUANTUM)
+                       opts.rate2quantum = d->qh_rate2quantum;
+               if (d->qh_mask & SCH_HTB_HAS_DEFCLS)
+                       opts.defcls = d->qh_defcls;
+       }
 
        nla_put(msg, TCA_HTB_INIT, sizeof(opts), &opts);