From a5a6ffb506aa3c2a0c7fe8fd09abf3f737984aa5 Mon Sep 17 00:00:00 2001 From: "Enrico Loparco (eloparco)" Date: Tue, 23 Mar 2021 14:58:34 +0100 Subject: [HICN-645] Fix data structures to support hicn-light-daemon and hicn-light-control communication The daemon should be able to start, receive commands from hicn-light-control and execute them. Signed-off-by: Enrico Loparco (eloparco) Change-Id: I0ca5bb3d9bdfb37ac8cfa9f671f6c162c9a394f5 Signed-off-by: Enrico Loparco (eloparco) --- hicn-light/src/hicn/io/udp.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'hicn-light/src/hicn/io/udp.c') diff --git a/hicn-light/src/hicn/io/udp.c b/hicn-light/src/hicn/io/udp.c index 38d643838..edff902de 100644 --- a/hicn-light/src/hicn/io/udp.c +++ b/hicn-light/src/hicn/io/udp.c @@ -215,15 +215,6 @@ listener_udp_initialize(listener_t * listener) listener_udp_data_t * data = listener->data; assert(data); #endif - - // XXX Socket creation should be a function per-se and not be called in - // initialize ! - listener->fd = listener_get_socket(listener, &listener->address, NULL, - listener->interface_name); - if (listener->fd < 0) { - ERROR("Error creating UDP socket: (%d) %s", errno, strerror(errno)); - return -1; - } return 0; } @@ -249,7 +240,7 @@ int listener_udp_get_socket(const listener_t * listener, const address_t * local, const address_t * remote, const char * interface_name) { - int fd = socket(address_family(remote), SOCK_DGRAM, 0); + int fd = socket(address_family(local), SOCK_DGRAM, 0); if (fd < 0) goto ERR_SOCKET; @@ -257,7 +248,7 @@ listener_udp_get_socket(const listener_t * listener, const address_t * local, goto ERR; } - if (bind(fd, address_sa(local), address_socklen(remote)) < 0) { + if (bind(fd, address_sa(local), address_socklen(local)) < 0) { perror("bind"); goto ERR; } @@ -313,7 +304,7 @@ connection_udp_initialize(connection_t * connection) { assert(connection); - assert(connection->type == FACE_TYPE_UDP); + assert(connection->type == FACE_TYPE_UDP || connection->type == FACE_TYPE_UDP_LISTENER); assert(connection->interface_name); connection_udp_data_t * data = connection->data; -- cgit 1.2.3-korg