struct tcmsg *t = NLMSG_DATA(n);
struct rtattr *tb[TCA_MAX+1];
int len = n->nlmsg_len;
+ struct qdisc_util *q;
+ const char *kind;
+ int err;
if (n->nlmsg_type != RTM_NEWQDISC)
return 0;
if (block == ctx->block_index)
ctx->found = true;
}
+
+ kind = rta_getattr_str(tb[TCA_KIND]);
+ q = get_qdisc_kind(kind);
+ if (!q)
+ return -1;
+ if (q->has_block) {
+ bool found = false;
+
+ err = q->has_block(q, tb[TCA_OPTIONS], ctx->block_index, &found);
+ if (err)
+ return err;
+ if (found)
+ ctx->found = true;
+ }
+
return 0;
}
close_json_array(PRINT_ANY, "");
}
+bool qevents_have_block(struct qevent_util *qevents, __u32 block_idx)
+{
+ if (!qevents)
+ return false;
+
+ for (; qevents->id; qevents++) {
+ struct qevent_base *qeb = qevents->data;
+
+ if (qeb->block_idx == block_idx)
+ return true;
+ }
+
+ return false;
+}
+
int qevents_dump(struct qevent_util *qevents, struct nlmsghdr *n)
{
int err;
#ifndef _TC_QEVENT_H_
#define _TC_QEVENT_H_
+#include <stdbool.h>
#include <linux/types.h>
#include <libnetlink.h>
int qevents_read(struct qevent_util *qevents, struct rtattr **tb);
int qevents_dump(struct qevent_util *qevents, struct nlmsghdr *n);
void qevents_print(struct qevent_util *qevents, FILE *f);
+bool qevents_have_block(struct qevent_util *qevents, __u32 block_idx);
struct qevent_plain {
struct qevent_base base;
#define MAX_MSG 16384
#include <limits.h>
#include <linux/if.h>
+#include <stdbool.h>
#include <linux/pkt_sched.h>
#include <linux/pkt_cls.h>
int (*parse_copt)(struct qdisc_util *qu, int argc,
char **argv, struct nlmsghdr *n, const char *dev);
int (*print_copt)(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
+ int (*has_block)(struct qdisc_util *qu, struct rtattr *opt, __u32 block_idx, bool *p_has);
};
extern __u16 f_proto;