Routing rules: Mask value for firewall mark

Thomas Graf tgraf at infradead.org
Fri Oct 29 10:12:17 EDT 2010


On Fri, Oct 29, 2010 at 07:00:14AM -0700, Joerg Pommnitz wrote:
> Thomas,
> I read the new lib/route/rule.c. This left me wondering: How do I test for the
> presence of an attribute? E.g. if this is a "from"-rule, neither mark nor mask 
> will
> be set, but rtnl_rule_get_mark and rtnl_rule_get_mask will happily return a 
> value
> without a way to report an error.
> The right way would be to check for the presence of the attribute in the ce_mask
> field, but the flag values (e.g. RULE_ATTR_*) are private in rule.c.
> Can you clarify how the API is supposed to be used?

If mark OR mask are > 0 then mark filtering is enabled.

I found this to be easier than returning everything via result pointers, there
are very few cases where the value 0 does not mean 'unspecified', in this cases
the result should be returned with a result pointer.



More information about the libnl mailing list