Problem in detecting failure of route installation because of insufficiant rights

Thomas Graf tgraf at suug.ch
Tue Oct 22 08:22:19 EDT 2013


On 10/16/13 at 04:36pm, Teto wrote:
> Hi,
> 
> I've started writing a python interface to install routes
> (https://github.com/teto/libnl/blob/master/python/netlink/route/route.py).
> Right now my script looks like:
> 
> routingTable = nlrtr.RoutingTable("main")
> route = nlrtr.RoutingEntry()
> route.dst = dst._nl_addr
> 
> nh = nlrtr.NextHop()
> nh.interface = myif.ifindex
> route.add_nexthop(nh)
> 
> routingTable.add( route )
> 
> It succeeds in installing the routes if I I've got the correct rights.
> However if I forget "sudo" to launch my script the C function
> "rtnl_route_add" still returns  0 (success) so I am not able to detect
> that the route was not installed. How can I achieve this ?

Can you run your script with the environment variable NLCB
set to "debug" and provide the output?



More information about the libnl mailing list