Problem in detecting failure of route installation because of insufficiant rights

Teto mattator at gmail.com
Wed Oct 16 10:36:09 EDT 2013


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 ?

Best regards

Matt



More information about the libnl mailing list