From 95170bf3a69597b49238bb7ff396d41f6dc94f30 Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Wed, 30 Oct 2019 17:56:08 +0100 Subject: [HICN-369] Implement reconciliation state machine in face manager incl. reattempts in case of errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia4ecf621fbd513d9e29313d2aaa487aa65811183 Signed-off-by: Jordan Augé --- ctrl/facemgr/src/interfaces/netlink/netlink.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ctrl/facemgr/src/interfaces/netlink') diff --git a/ctrl/facemgr/src/interfaces/netlink/netlink.c b/ctrl/facemgr/src/interfaces/netlink/netlink.c index babf1c305..a9c8c889e 100644 --- a/ctrl/facemgr/src/interfaces/netlink/netlink.c +++ b/ctrl/facemgr/src/interfaces/netlink/netlink.c @@ -29,7 +29,6 @@ #include #include "../../common.h" -#include "../../facelet.h" #include "../../interface.h" typedef enum { @@ -142,7 +141,7 @@ int nl_initialize(interface_t * interface, void * cfg) data->fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (data->fd < 0) { - printf("Failed to create netlink socket: %s\n", (char*)strerror(errno)); + ERROR("[nl_initialize] Failed to create netlink socket: %s", (char*)strerror(errno)); goto ERR_SOCKET; } @@ -164,13 +163,16 @@ int nl_initialize(interface_t * interface, void * cfg) local.nl_pid = getpid(); // set out id using current process id if (bind(data->fd, (struct sockaddr*)&local, sizeof(local)) < 0) { // bind socket - printf("Failed to bind netlink socket: %s\n", (char*)strerror(errno)); + ERROR("[nl_initialize] Failed to bind netlink socket: %s", (char*)strerror(errno)); goto ERR_BIND; } interface->data = data; - interface_register_fd(interface, data->fd, NULL); + if (interface_register_fd(interface, data->fd, NULL) < 0) { + ERROR("[nl_initialize] Error registering fd"); + goto ERR_FD; + } #if 1 nl_process_state(interface); @@ -178,6 +180,7 @@ int nl_initialize(interface_t * interface, void * cfg) return 0; +ERR_FD: ERR_BIND: close(data->fd); ERR_SOCKET: -- cgit 1.2.3-korg