[PATCH 2/3] Handle family-based parsing of IFLA_AF_SPEC attribute

David Ahern dsa at cumulusnetworks.com
Wed Nov 25 10:05:38 PST 2015


On 11/25/15 9:43 AM, David Ahern wrote:
> On 11/25/15 8:47 AM, Tobias Jungel wrote:
>>> diff --git a/lib/route/link.c b/lib/route/link.c
>>> index 3cb62df95d6a..b8e333c31a3a 100644
>>> --- a/lib/route/link.c
>>> +++ b/lib/route/link.c
>>> @@ -489,6 +489,56 @@ int rtnl_link_info_parse(struct rtnl_link *link,
>>> struct nlattr **tb)
>>>       return 0;
>>>   }
>>>
>>> +static int parse_af_spec_unspec(struct rtnl_link *link, struct
>>> nlattr *attr)
>>> +{
>>> +    struct nlattr *af_attr;
>>> +    int remaining;
>>> +    int err = 0;
>>> +
>>> +    nla_for_each_nested(af_attr, attr, remaining) {
>>> +        struct rtnl_link_af_ops *af_ops;
>>> +
>>> +        af_ops = af_lookup_and_alloc(link,
>>> nla_type(af_attr));
>>> +        if (af_ops && af_ops->ao_parse_af) {
>>> +            char *af_data = link-
>>>> l_af_data[nla_type(af_attr)];
>>> +
>>> +            err = af_ops->ao_parse_af(link, af_attr,
>>> af_data);
>>> +            if (err < 0) {
>>> +                goto errout;
>>> +            }
>>> +        }
>>> +
>>> +    }
>>> +
>>> +    link->ce_mask |= LINK_ATTR_AF_SPEC;
>>> +errout:
>>
>> since af_lookup_and_alloc is called, I guess a rtnl_link_af_ops_put is
>> missing here.
>
> This function will return an error, the caller sees that and jumps to
> the current errout which does the rtnl_link_af_ops_put.

never mind. I see your point here. Will fix in v2.




More information about the libnl mailing list