diff options
author | Thomas Haller <thaller@redhat.com> | 2022-03-07 22:28:15 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-03-11 22:18:02 (GMT) |
commit | 1ff9b384e80d51659ce0a64a3d02311cf362cd92 (patch) | |
tree | 1a62044d80019665c9dccf04186ff81e00cacfe2 /lib/route | |
parent | 53bc27eae100758ed95a6022c7a3a9dfb695ec20 (diff) | |
download | libnl-1ff9b384e80d51659ce0a64a3d02311cf362cd92.zip libnl-1ff9b384e80d51659ce0a64a3d02311cf362cd92.tar.gz libnl-1ff9b384e80d51659ce0a64a3d02311cf362cd92.tar.bz2 |
route/route: don't report failure when we receive a route in rtnl_route_lookup()
- when we received a route and set `*result`, we should not return
an error. That means, ignore the result of wait_for_ack().
- use _nl_auto* cleanup macros.
- move new symbols to linker version for the upcoming release.
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/route.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/route/route.c b/lib/route/route.c index a761549..fcc7459 100644 --- a/lib/route/route.c +++ b/lib/route/route.c @@ -11,6 +11,7 @@ */ #include <netlink-private/netlink.h> +#include <netlink-private/nl-auto.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/utils.h> @@ -125,22 +126,20 @@ int rtnl_route_build_add_request(struct rtnl_route *tmpl, int flags, } int rtnl_route_lookup(struct nl_sock *sk, struct nl_addr *dst, - struct rtnl_route **result) + struct rtnl_route **result) { - struct nl_msg *msg; - struct rtnl_route *tmpl; + _nl_auto_nl_msg struct nl_msg *msg = NULL; + _nl_auto_rtnl_route struct rtnl_route *tmpl = NULL; struct nl_object *obj; int err; tmpl = rtnl_route_alloc(); rtnl_route_set_dst(tmpl, dst); err = build_route_msg(tmpl, RTM_GETROUTE, 0, &msg); - rtnl_route_put(tmpl); if (err < 0) return err; err = nl_send_auto(sk, msg); - nlmsg_free(msg); if (err < 0) return err; @@ -148,7 +147,8 @@ int rtnl_route_lookup(struct nl_sock *sk, struct nl_addr *dst, return err; *result = (struct rtnl_route *)obj; - return wait_for_ack(sk); + wait_for_ack(sk); + return 0; } int rtnl_route_add(struct nl_sock *sk, struct rtnl_route *route, int flags) |