You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/04/15 01:08:10 UTC

DO NOT REPLY [Bug 19015] New: - jk2 only connects to localhost

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19015>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19015

jk2 only connects to localhost

           Summary: jk2 only connects to localhost
           Product: Tomcat 4
           Version: 4.1.24
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Connector:Coyote JK 2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: George.Lindholm@ubc.ca


I don't understand why this is happening, but jk2 would only connect to localhost, 
ignoring the hostname I specified. 
After digging into the code, I came up with this fix (I don't understand why memcpy 
was failing in this instance, rc->s_addr ended up left initialize to 0x00): 
Solaris 5.8, 64bit, gcc 3.2.2 
 
=================================================================== 
RCS file: ./jk/native2/common/RCS/jk_channel_socket.c,v 
retrieving revision 1.1 
diff -c -r1.1 ./jk/native2/common/jk_channel_socket.c 
*** ./jk/native2/common/jk_channel_socket.c     2003/04/14 21:24:32     1.1 
--- ./jk/native2/common/jk_channel_socket.c     2003/04/14 22:46:54 
*************** 
*** 205,211 **** 
                                                 struct sockaddr_in *rc) 
  { 
      int x; 
-     u_long laddr; 
 
  #ifdef AS400 
      memset(rc, 0, sizeof(struct sockaddr_in)); 
--- 205,210 ---- 
*************** 
*** 240,251 **** 
          } 
  #endif 
 
!         laddr = ((struct in_addr *)hoste->h_addr_list[0])->s_addr; 
      } else { 
          /* If we found only digits we use inet_addr() */ 
!         laddr = inet_addr(host); 
      } 
-     memcpy(&(rc->sin_addr), &laddr , sizeof(laddr)); 
 
      return JK_OK; 
  } 
--- 239,251 ---- 
          } 
  #endif 
 
!       memcpy(&(rc->sin_addr), hoste->h_addr_list[0], 
!              sizeof(rc->sin_addr)); 
      } else { 
          /* If we found only digits we use inet_addr() */ 
!         in_addr_t laddr = inet_addr(host); 
!       memcpy(&(rc->sin_addr), &laddr , sizeof(rc->sin_addr)); 
      } 
 
      return JK_OK; 
  }

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org