From fbcf08931e531fc2bd4a7e42d0ab03fed26fb9fc Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 10 Mar 2020 22:42:33 +0100 Subject: [PATCH] Add all recent addresses resolved from a hostname in meshlink_invite(). When a canonical hostname or an invitation address resolves to multiple numeric addresses, add all of them as recent addresses for ourself, so they are all part of the host config file we send to the invitee. --- src/meshlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/meshlink.c b/src/meshlink.c index b9cc1877..789121d1 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -510,8 +510,10 @@ static char *get_my_hostname(meshlink_handle_t *mesh, uint32_t flags) { continue; } - // Remember the address - node_add_recent_address(mesh, mesh->self, (sockaddr_t *)ai_in->ai_addr); + // Remember the address(es) + for(struct addrinfo *aip = ai_in; aip; aip = aip->ai_next) { + node_add_recent_address(mesh, mesh->self, (sockaddr_t *)aip->ai_addr); + } if(flags & MESHLINK_INVITE_NUMERIC) { // We don't need to do any further conversion -- 2.39.5