]> granicus.if.org Git - libnl/commitdiff
basic: Only add ematches to message if available
authorThomas Graf <tgraf@suug.ch>
Thu, 28 Oct 2010 22:45:45 +0000 (00:45 +0200)
committerThomas Graf <tgraf@suug.ch>
Thu, 28 Oct 2010 22:45:45 +0000 (00:45 +0200)
lib/route/cls/basic.c

index 835fd08c5dd69638029e490babffbca25dd42035..94f0cf7ed693c8a365428ebcf2803f47ba43dacc 100644 (file)
@@ -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;