rtnl_link_vlan API

Thomas Graf tgraf at infradead.org
Thu May 10 03:05:13 EDT 2012


On Wed, May 09, 2012 at 06:00:38PM -0600, Justin Mayfield wrote:
> I noticed that many of the rtnl_link_vlan_XYZ calls use the macro
> "IS_VLAN_LINK_ASSERT".  Often this is in a function that claims to
> return < 0 if there is an error.  This is only true if the
> application is compiled with NDEBUG because APPBUG does an assert()
> and thus abort().
> 
> I can guard my code to prevent these API calls from being made on
> the wrong link type, but this feels redundant if the
> rtnl_link_vlan_XYZ calls are doing the same check too.  I'd prefer
> that the IS_VLAN_LINK_ASSERT macro be a _CHECK and simply return a
> negative error code which I can parse, as I do for much of the other
> link API.
> 
> I can submit a patch to this effect if deemed worthy.

The behaviour as it is assumes that you only call VLAN functions
on actual VLAN link types. The check is only a last ressort and
should only ever be hit by the developer, never a user.

However, I'm fine with changing this to the behaviour you describe
so I will be happy to accept a patch.

~Thomas



More information about the libnl mailing list