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 01:23:25 UTC

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

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



##########
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;
+        }

Review comment:
       Please follow the same style as established elsewhere (opening brace on same line). See surrounding code and: http://guacamole.apache.org/guac-style/

##########
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 don't think it is strictly correct to have two loops through the possible addresses like this - one to choose the family and then another to choose the address (presumably failing repeatedly for if that family was pulled from a different address). Shouldn't this all be done in the same loop?




----------------------------------------------------------------
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