From fd8cb6cb1cd67d5c798f983ddd5cf69471745b05 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn@canonical.com>
Date: Thu, 6 Oct 2011 16:11:38 +0000
Subject: [PATCH 2/4] convert some function calls to libnl3 API

rtnl_link_alloc_cache and rtnl_addr_alloc_cache

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
---
 src/dutil_linux.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index 0ce13e9..58ec43c 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -797,20 +797,22 @@ done:
 int netlink_init(struct netcf *ncf) {
 
     ncf->driver->nl_sock = nl_socket_alloc();
+    int ret;
+
     if (ncf->driver->nl_sock == NULL)
         goto error;
     if (nl_connect(ncf->driver->nl_sock, NETLINK_ROUTE) < 0) {
         goto error;
     }
 
-    ncf->driver->link_cache = rtnl_link_alloc_cache(ncf->driver->nl_sock);
-    if (ncf->driver->link_cache == NULL) {
+    ret = rtnl_link_alloc_cache(ncf->driver->nl_sock, AF_UNSPEC, &ncf->driver->link_cache);
+    if (ret < 0) {
         goto error;
     }
     nl_cache_mngt_provide(ncf->driver->link_cache);
 
-    ncf->driver->addr_cache = rtnl_addr_alloc_cache(ncf->driver->nl_sock);
-    if (ncf->driver->addr_cache == NULL) {
+    ret = rtnl_addr_alloc_cache(ncf->driver->nl_sock, &ncf->driver->addr_cache);
+    if (ret < 0) {
         goto error;
     }
     nl_cache_mngt_provide(ncf->driver->addr_cache);
-- 
1.7.5.4

