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:19:43 PDT 2014


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 2027 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20140411/28716353/attachment.bin>


More information about the libnl mailing list