diff options
author | Thomas Graf <tgraf@suug.ch> | 2011-03-24 17:00:38 +0100 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2011-03-24 17:00:38 +0100 |
commit | a62bfdb8e0a1dffa7539fe813a96593c9c407686 (patch) | |
tree | 9ef7428b34adaa25f966dc006e2453f71b225ad0 | |
parent | 93b6c114a8fa21e5e907a5b2415c7ffb441b0a8f (diff) | |
download | libnl-a62bfdb8e0a1dffa7539fe813a96593c9c407686.tar.gz |
Check if all mandatory attributes are present in rtnl_tc_msg_build()
TCA_ATTR_IFINDEX | TCA_ATTR_PARENT | TCA_ATTR_KIND
-rw-r--r-- | lib/route/tc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/route/tc.c b/lib/route/tc.c index 56aa410..09ae044 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -189,7 +189,11 @@ int rtnl_tc_msg_build(struct rtnl_tc *tc, int type, int flags, .tcm_handle = tc->tc_handle, .tcm_parent = tc->tc_parent, }; - int err = -NLE_MSGSIZE; + int req, err = -NLE_MSGSIZE; + + req = (TCA_ATTR_IFINDEX | TCA_ATTR_PARENT | TCA_ATTR_KIND); + if ((tc->ce_mask & req) != req) + return -NLE_MISSING_ATTR; msg = nlmsg_alloc_simple(type, flags); if (!msg) |