aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/io/udp.c
diff options
context:
space:
mode:
authorEnrico Loparco (eloparco) <eloparco@cisco.com>2021-03-23 14:58:34 +0100
committerMauro Sardara <msardara@cisco.com>2021-03-30 15:23:55 +0000
commita5a6ffb506aa3c2a0c7fe8fd09abf3f737984aa5 (patch)
treecfb82e9667e287b08c665d4d671b6e767490d403 /hicn-light/src/hicn/io/udp.c
parenta070b0de9f9e9cbca150eea4eda74757ca588bed (diff)
[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) <eloparco@cisco.com> Change-Id: I0ca5bb3d9bdfb37ac8cfa9f671f6c162c9a394f5 Signed-off-by: Enrico Loparco (eloparco) <eloparco@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/io/udp.c')
-rw-r--r--hicn-light/src/hicn/io/udp.c15
1 files changed, 3 insertions, 12 deletions
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;