diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-10-28 22:45:45 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-10-28 22:45:45 (GMT) |
commit | 2f867686ac987df8555727b894a4e2ebba26fbd9 (patch) | |
tree | a4ca05d7de9f9499f9aed036d4056065298dc173 /lib/route/cls/basic.c | |
parent | d7a561a1372f819efc8cede30dc550d8e3afcc28 (diff) | |
download | libnl-2f867686ac987df8555727b894a4e2ebba26fbd9.zip libnl-2f867686ac987df8555727b894a4e2ebba26fbd9.tar.gz libnl-2f867686ac987df8555727b894a4e2ebba26fbd9.tar.bz2 |
basic: Only add ematches to message if available
Diffstat (limited to 'lib/route/cls/basic.c')
-rw-r--r-- | lib/route/cls/basic.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/route/cls/basic.c b/lib/route/cls/basic.c index 835fd08..94f0cf7 100644 --- a/lib/route/cls/basic.c +++ b/lib/route/cls/basic.c @@ -121,7 +121,11 @@ static int basic_get_opts(struct rtnl_cls *cls, struct nl_msg *msg) NLA_PUT_U32(msg, TCA_BASIC_CLASSID, b->b_target); - return rtnl_ematch_fill_attr(msg, TCA_BASIC_EMATCHES, b->b_ematch); + if (b->b_mask & BASIC_ATTR_EMATCH && + rtnl_ematch_fill_attr(msg, TCA_BASIC_EMATCHES, b->b_ematch) < 0) + goto nla_put_failure; + + return 0; nla_put_failure: return -NLE_NOMEM; |