diff options
author | Thomas Graf <tgraf@suug.ch> | 2015-12-16 15:38:39 +0100 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2015-12-16 15:40:58 +0100 |
commit | a0eea59519e3f89a5cbc097ec350566103728069 (patch) | |
tree | 1183a3c881bf116fd3597d2b930d480ba3fbef00 /src | |
parent | f9c714fa1503179896c55ccb5f918e6c5d6cd5f5 (diff) |
netlink: BUG() if we don't have parent information
This would indicate that we hang a TC object to the tree root.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'src')
-rw-r--r-- | src/in_netlink.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/in_netlink.c b/src/in_netlink.c index 43019d3..ef98ae0 100644 --- a/src/in_netlink.c +++ b/src/in_netlink.c @@ -545,11 +545,14 @@ static struct element *handle_tc_obj(struct rtnl_tc *tc, const char *prefix, snprintf(name, sizeof(name), "%s %s (%s)", prefix, buf, rtnl_tc_get_kind(tc)); - if (!(e = element_lookup(grp, name, id, rdata ? rdata->parent : NULL, ELEMENT_CREAT))) + if (!rdata || !rdata->parent) + BUG(); + + if (!(e = element_lookup(grp, name, id, rdata->parent, ELEMENT_CREAT))) return NULL; if (e->e_flags & ELEMENT_FLAG_CREATED) { - e->e_level = rdata ? rdata->level : 0; + e->e_level = rdata->level; if (element_set_key_attr(e, "tc_bytes", "tc_packets") || element_set_usage_attr(e, "tc_bytes")) |