From: Guus Sliepen Date: Thu, 9 Nov 2017 19:13:07 +0000 (+0100) Subject: devtools.h must not rely on internal types. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=305f26990ad31de1bc5edbf95e5d8b8d330ca5dc;p=meshlink devtools.h must not rely on internal types. --- diff --git a/src/devtools.c b/src/devtools.c index a1921d8b..3f2c0a49 100644 --- a/src/devtools.c +++ b/src/devtools.c @@ -185,7 +185,7 @@ bool devtool_export_json_all_edges_state(meshlink_handle_t *mesh, FILE *stream) } char *host = NULL, *port = NULL, *address = NULL; - sockaddr2str((const sockaddr_t *) & (edges[i].address), &host, &port); + sockaddr2str((const sockaddr_t *)&edges[i].address, &host, &port); if(host && port) { xasprintf(&address, "{ \"host\": \"%s\", \"port\": %s }", host, port); @@ -250,7 +250,7 @@ void devtool_get_node_status(meshlink_handle_t *mesh, meshlink_node_t *node, dev status->options = internal->options; memcpy(&status->status, &internal->status, sizeof status->status); - status->address = internal->address; + memcpy(&status->address, &internal->address, sizeof status->address); status->mtu = internal->mtu; status->minmtu = internal->minmtu; status->maxmtu = internal->maxmtu; diff --git a/src/devtools.h b/src/devtools.h index a9badbc5..e74d4137 100644 --- a/src/devtools.h +++ b/src/devtools.h @@ -89,7 +89,7 @@ typedef struct devtool_node_status devtool_node_status_t; struct devtool_node_status { uint32_t options; uint32_t status; - sockaddr_t address; + struct sockaddr_storage address; uint16_t mtu; uint16_t minmtu; uint16_t maxmtu;