You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2002/04/25 20:04:40 UTC

cvs commit: httpd-2.0/modules/metadata mod_unique_id.c

trawick     02/04/25 11:04:40

  Modified:    .        CHANGES
               modules/metadata mod_unique_id.c
  Log:
  Allow mod_unique_id to work on systems with no IPv4 address
  corresponding to their host name.
  
  Revision  Changes    Path
  1.735     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.734
  retrieving revision 1.735
  diff -u -r1.734 -r1.735
  --- CHANGES	25 Apr 2002 12:15:52 -0000	1.734
  +++ CHANGES	25 Apr 2002 18:04:39 -0000	1.735
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.37
   
  +  *) Allow mod_unique_id to work on systems with no IPv4 address
  +     corresponding to their host name.  [Jeff Trawick]
  +
   Changes with Apache 2.0.36
   
     *) Fix suexec behavior with user directories.  PR 7810.
  
  
  
  1.36      +15 -6     httpd-2.0/modules/metadata/mod_unique_id.c
  
  Index: mod_unique_id.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_unique_id.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- mod_unique_id.c	13 Mar 2002 20:47:53 -0000	1.35
  +++ mod_unique_id.c	25 Apr 2002 18:04:40 -0000	1.36
  @@ -213,16 +213,25 @@
           return HTTP_INTERNAL_SERVER_ERROR;
       }
   
  -    /* XXX theoretically there are boxes out there which want to use
  -     *     mod_unique_id but which have no IPv4 address...  send in a patch :)
  -     */
  -    if ((rv = apr_sockaddr_info_get(&sockaddr, str, AF_INET, 0, 0, p)) != APR_SUCCESS) {
  +    if ((rv = apr_sockaddr_info_get(&sockaddr, str, AF_INET, 0, 0, p)) == APR_SUCCESS) {
  +        global_in_addr = sockaddr->sa.sin.sin_addr.s_addr;
  +    }
  +    else {
           ap_log_error(APLOG_MARK, APLOG_ALERT, rv, main_server,
                       "mod_unique_id: unable to find IPv4 address of \"%s\"", str);
  +#if APR_HAVE_IPV6
  +        if ((rv = apr_sockaddr_info_get(&sockaddr, str, AF_INET6, 0, 0, p)) == APR_SUCCESS) {
  +            memcpy(&global_in_addr,
  +                   sockaddr->ipaddr_ptr + sockaddr->ipaddr_len - sizeof(global_in_addr),
  +                   sizeof(global_in_addr));
  +            ap_log_error(APLOG_MARK, APLOG_ALERT, rv, main_server,
  +                         "mod_unique_id: using low-order bits of IPv6 address "
  +                         "as if they were unique");
  +        }
  +        else
  +#endif
           return HTTP_INTERNAL_SERVER_ERROR;
       }
  -
  -    global_in_addr = sockaddr->sa.sin.sin_addr.s_addr;
   
       apr_sockaddr_ip_get(&ipaddrstr, sockaddr);
       ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, main_server,