]> granicus.if.org Git - libnl/commitdiff
link: Eat ACK followed by RTM_NEWLINK when requesting single link
authorThomas Graf <tgraf@redhat.com>
Wed, 14 Sep 2011 09:43:10 +0000 (11:43 +0200)
committerThomas Graf <tgraf@redhat.com>
Wed, 14 Sep 2011 09:43:10 +0000 (11:43 +0200)
When requesting a single link with RTM_GETLINK (no dump) the
RTM_NEWLINK carrying the answer will be followed by an ACK
we have to wait for.

lib/route/link.c

index 3e070e56b7ba879c1b678a76babddbfe88572878..00beb0893c271b3eddaa061a2b392672500e8eca 100644 (file)
@@ -996,6 +996,10 @@ int rtnl_link_get_kernel(struct nl_sock *sk, int ifindex, const char *name,
        /* We have used link_msg_parser(), object is definitely a link */
        *result = (struct rtnl_link *) obj;
 
+       /* If an object has been returned, we also need to wait for the ACK */
+        if (err == 0 && obj)
+                nl_wait_for_ack(sk);
+
        return 0;
 }