From 7e9d5f69e54d209955f3a0154751e1a526a69c9f Mon Sep 17 00:00:00 2001 From: Nicolas Sitbon Date: Fri, 25 Mar 2011 15:07:23 +0100 Subject: correctly handle the object not found case Removing non existent route (both ipv4 and ipv6) using rtnl_route_delete return NLE_FAILURE generic error code. After investigation, it seems the linux kernel return -ESRCH in that case (see http://lxr.linux.no/linux+v2.6.38/net/ipv6/route.c#L1367). Same behaviour apply for removing non existent address. The function nl_syserr2nlerr (lib/error.c) which is responsible for translating from kernel error to libnl error doesn't handle ESRCH. --- lib/error.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/error.c b/lib/error.c index a31461e..b973cdd 100644 --- a/lib/error.c +++ b/lib/error.c @@ -88,6 +88,7 @@ int nl_syserr2nlerr(int error) case EADDRINUSE: return NLE_EXIST; case EEXIST: return NLE_EXIST; case EADDRNOTAVAIL: return NLE_NOADDR; + case ESRCH: /* fall through */ case ENOENT: return NLE_OBJ_NOTFOUND; case EINTR: return NLE_INTR; case EAGAIN: return NLE_AGAIN; -- cgit v0.12