rtnl_link_delete returns 0 instead of -NLE_NODEV when a link cache is created

Nicolas CARRIER nicolas.carrier at parrot.com
Fri Apr 11 02:34:43 PDT 2014


I forgot to mention that if I skip step 2, then the rtnl_link_delete() call 
consistently returns -NLE_NODEV as expected.

On 11/04/2014 11:19, Nicolas CARRIER wrote:
> Hello,
> I ran into the following problem while coding a networking utility library on
> top of libnl.
> When I delete a non-existant network interface, I expect rtnl_link_delete() to
> return -NLE_NODEV. In general, it seems to work, but if I :
>   1. add a link cache with nl_cache_mngr_add()
>   2. create another link with rtnl_link_add()
>   3. delete a non-existant network interface with rtnl_link_delete()
>
> then rtnl_link_delete() returns 0.
>
> Please find attached a working code to reproduce the behaviour. Then one can
> issue the following commands to reproduce :
>
> gcc main.c -o libnl-test -I/usr/include/libnl3/ -lnl-3 -lnl-route-3
> sudo ./libnl-test
> #return of rtnl_link_delete is -31: No such device
> # -> this is the expected behaviour I think
> sudo ./libnl-test foo
> #create link cache
> #return of rtnl_link_delete is 0: Success
>
> I'm using a debian sid with libnl version 3.2.24-1.
>
> Am I doing something wrong ?
>
> Thank you in advance.
>
>
> _______________________________________________
> libnl mailing list
> libnl at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libnl
>



More information about the libnl mailing list