[PATCH libnl 1/4] route: Add support for netconf
David Ahern
dsa at cumulusnetworks.com
Wed May 3 13:39:43 PDT 2017
On 5/3/17 7:04 AM, Thomas Haller wrote:
> Hi David,
>
> On Thu, 2017-04-27 at 13:42 -0700, David Ahern wrote:
>> Add route/netconf cache type to monitor RTM_*NETCONF messages.
>>
>> Signed-off-by: David Ahern <dsa at cumulusnetworks.com>
>> Signed-off-by: Balakrishnan Raman <ramanb at cumulusnetworks.com>
>> ---
>
>> +int rtnl_netconf_get_family(struct rtnl_netconf *nc);
>> +int rtnl_netconf_get_ifindex(struct rtnl_netconf *nc);
>> +int rtnl_netconf_get_forwarding(struct rtnl_netconf *nc);
>> +int rtnl_netconf_get_mc_forwarding(struct rtnl_netconf *nc);
>> +int rtnl_netconf_get_rp_filter(struct rtnl_netconf *nc);
>> +int rtnl_netconf_get_proxy_neigh(struct rtnl_netconf *nc);
>> +int rtnl_netconf_get_ignore_routes_linkdown(struct rtnl_netconf
>> *nc);
>
> the underlying fields for these properties are "int" (in the netlink
> message they are s32). How about having the getters to have a distinct
> return and error value? For example:
>
> int rtnl_netconf_get_family(struct rtnl_netconf *nc,
> int *out_value)
> {
> if (!nc)
> return -NLE_INVAL;
> if (!(nc->mask & NETCONF_ATTR_FAMILY))
> return -NLE_MISSING_ATTR;
> if (out_value)
> *out_value = nc->family;
> return 0;
> }
>
>
> What's your opinion about that?
family and ifindex are required attributes. The others should only have
positive settings (0/1 boolean or 0 to N integer), though admittedly the
kernel docs are not clear especially for the ignore_routes.
For consistency -- and to handle potentially new ones with < 0 valid
values -- I can update the API to what you suggest.
More information about the libnl
mailing list