diff options
author | 2019-10-30 17:56:08 +0100 | |
---|---|---|
committer | 2019-10-31 13:41:47 +0100 | |
commit | 95170bf3a69597b49238bb7ff396d41f6dc94f30 (patch) | |
tree | 2f9b565e84514d7ee25cfd874235dd25e9300a0f /ctrl/facemgr/src/interfaces/netlink/netlink.c | |
parent | fc6dfe9f7ee02834ae1e6f56e0aaee36ac3e88dd (diff) |
[HICN-369] Implement reconciliation state machine in face manager incl. reattempts in case of errors
Change-Id: Ia4ecf621fbd513d9e29313d2aaa487aa65811183
Signed-off-by: Jordan Augé <jordan.auge@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src/interfaces/netlink/netlink.c')
-rw-r--r-- | ctrl/facemgr/src/interfaces/netlink/netlink.c | 11 |
1 files changed, 7 insertions, 4 deletions
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 <hicn/util/log.h> #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: |