Print this page
11849 listen of IPv6 address fails with EAFNOSUPPORT

@@ -19,11 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, Joyent Inc. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2013, 2017 by Delphix. All rights reserved.
  * Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
  */
 /* Copyright (c) 1990 Mentat Inc. */

@@ -4332,15 +4332,15 @@
                         (void) strlog(TCP_MOD_ID, 0, 1, SL_ERROR|SL_TRACE,
                             "tcp_listen: bad state, %d", tcp->tcp_state);
                 }
                 return (-TOUTSTATE);
         } else {
-                if (sa == NULL) {
                         sin6_t  addr;
                         sin_t *sin;
                         sin6_t *sin6;
 
+                if (sa == NULL) {
                         ASSERT(IPCL_IS_NONSTR(connp));
                         /* Do an implicit bind: Request for a generic port. */
                         if (connp->conn_family == AF_INET) {
                                 len = sizeof (sin_t);
                                 sin = (sin_t *)&addr;