[PATCH] Fix typo in rtnl_neigh_get()

Roopa Prabhu roopa at cumulusnetworks.com
Thu Jan 31 10:29:21 EST 2013


Looking at it some more. I think the condition should be changed to
neigh->n_family != AF_BRIDGE to keep it safe, as the AF_BRIDGE family 
objects dont have n_dst.
And this will also skip AF_BRIDGE objects from the search which was the 
real intention of my original patch.

Maxime, your patch would work if you changed AF_UNSPEC to AF_BRIDGE.
If you agree, Can you please resubmit ?. Thanks.

On 1/31/13 7:12 AM, Roopa Prabhu wrote:
> On 1/31/13 6:48 AM, Rich Fought wrote:
>> Given Roopa's last patch to remove the AF_UNSPEC check from
>> rtnl_get_link() and rtnl_get_link_by_name(), perhaps it should be
>> removed from here altogether as well? Are there other functions that
>> needs to be reverted in this way?
>
> thanks....yes i was just typing a reply to maximes email.
>
> This is the only other place that i added AF_UNSPEC check that can be
> removed.
> I was more worried here about users getting AF_BRIDGE objects
> unexpectedly because AF_BRIDGE and AF_UNSPEC neigh objects differ in
> what fields are filled up in the objects.
> But its better to remove the check on the same lines that a user will
> not get bridge objects unless requested and hopefully will not run into
> this.
>
> Patch coming in a short while..
>
>
>>
>>
>> On 1/31/2013 6:40 AM, Maxime Bizon wrote:
>>> From: Maxime Bizon <mbizon at freebox.fr>
>>>
>>> Fix typo in rtnl_neigh_get()
>>>
>>> Signed-off-by: Maxime Bizon <mbizon at freebox.fr>
>>> ---
>>> lib/route/neigh.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/lib/route/neigh.c b/lib/route/neigh.c
>>> index c0f80a2..3ccb126 100644
>>> --- a/lib/route/neigh.c
>>> +++ b/lib/route/neigh.c
>>> @@ -540,7 +540,7 @@ struct rtnl_neigh * rtnl_neigh_get(struct nl_cache
>>> *cache, int ifindex,
>>> struct rtnl_neigh *neigh;
>>> nl_list_for_each_entry(neigh, &cache->c_items, ce_list) {
>>> - if (neigh->n_family == AF_UNSPEC &&
>>> + if (neigh->n_family != AF_UNSPEC &&
>>> neigh->n_ifindex == ifindex &&
>>> !nl_addr_cmp(neigh->n_dst, dst)) {
>>> nl_object_get((struct nl_object *) neigh);
>>
>>
>> _______________________________________________
>> libnl mailing list
>> libnl at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/libnl
>
>
> _______________________________________________
> libnl mailing list
> libnl at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libnl




More information about the libnl mailing list