[PATCH v2 0/2] Add support to compare link af data

Roopa Prabhu roopa at cumulusnetworks.com
Fri Jan 18 09:26:24 EST 2013


On 1/18/13 5:52 AM, Thomas Graf wrote:
> On 01/17/13 at 04:29pm, roopa at cumulusnetworks.com wrote:
>> From: roopa<roopa at cumulusnetworks.com>
>>
>> This patch series adds support to compare link af data.
>>
>> Today the link compare function does not compare af
>> data of a link object. We have found a need for this
>> to get approriate change callbacks when af_data of a link
>> changes.
>>
>> Though the patch adds generic support to compare link af data
>> for any af data family, this series only adds support to
>> compare af_data of bridge family objects.
>>
>> changes from v1 to v2:
>> 	- THis version only includes patches unaccepted during v1
>> 	- Added rtnl_link_af_data_compare api to header file
>> 	- Fixed api documentation
>>
>> roopa (2):
>>       Add new rtnl_link_af_data_compare api to compare af_data
>>       link: Add af data compare to link objects
>
> Applied, thanks
>
> Added the following follow-up fix:
>
> commit 5291af6fb502e1bde7545a6eef261cdf40246110
> Author: Thomas Graf<tgraf at suug.ch>
> Date:   Fri Jan 18 14:49:08 2013 +0100
>
>      link: fix reference leak in rtnl_link_af_data_compare()
>
> diff --git a/lib/route/link/api.c b/lib/route/link/api.c
> index 9387bc5..392ded3 100644
> --- a/lib/route/link/api.c
> +++ b/lib/route/link/api.c
> @@ -366,20 +366,25 @@ int rtnl_link_af_data_compare(struct rtnl_link *a, struct rtnl_link *b,
>                                int family)
>   {
>          struct rtnl_link_af_ops *af_ops = rtnl_link_af_ops_lookup(family);
> +       int ret = 0;
>
>          if (!af_ops)
>                  return ~0;
>
>          if (!a->l_af_data[family]&&  !b->l_af_data[family])
> -               return 0;
> +               goto out;
>
> -       if (!a->l_af_data[family] || !b->l_af_data[family])
> -               return ~0;
> +       if (!a->l_af_data[family] || !b->l_af_data[family]) {
> +               ret = ~0;
> +               goto out;
> +       }
>
>          if (af_ops->ao_compare)
> -               return af_ops->ao_compare(a, b, family, ~0, 0);
> +               ret = af_ops->ao_compare(a, b, family, ~0, 0);
> +out:
> +       rtnl_link_af_ops_put(af_ops);
>
> -       return 0;
> +       return ret;
>   }
>
>   /** @} */
>

Thanks. And sorry i missed it.



More information about the libnl mailing list