You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2020/10/02 08:37:46 UTC

[GitHub] [guacamole-server] lyind commented on a change in pull request #303: GUACAMOLE-1190: Create AF_INET6 socket if no IPv4 addresses are available

lyind commented on a change in pull request #303:
URL: https://github.com/apache/guacamole-server/pull/303#discussion_r498688786



##########
File path: src/guacd/daemon.c
##########
@@ -304,8 +304,23 @@ int main(int argc, char* argv[]) {
 
     }
 
+    /* create socket for AF_INET6 to allow IPv6 bind in case there is no IPv4 address available */
+    sa_family_t family = AF_INET6;
+    current_address = addresses;
+    while (current_address != NULL) {
+
+        if (current_address->ai_family == AF_INET)
+        {
+            family = AF_INET;
+        }
+
+        current_address = current_address->ai_next;
+    }

Review comment:
       I had a similar thought, but initially didn't feel like changing the proven flow of control much.
   
   It would probably be OK to re-create the socket a few times (we set `SO_REUSEADDR`). I re-factored the code accordingly.
   
   Please review my updated (force-pushed) commit.
   
   Thank you!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org