Re: svn commit: r1729901 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/http_core.h include/httpd.h server/core.c

2016-02-11 Thread Rainer Jung

I fixed two minor compilation failures, but one type of failure remains:

.../server/core.c: In function 'ap_get_remote_host':
.../server/core.c:959:17: error: cannot take address of bit-field 
'double_reverse'
 do_double_reverse(>double_reverse, 
conn->remote_host,

 ^
.../server/core.c:974:9: error: cannot take address of bit-field 
'double_reverse'

 do_double_reverse(>double_reverse, conn->remote_host,
 ^

Regards,

Rainer

Am 11.02.2016 um 22:58 schrieb wr...@apache.org:

Author: wrowe
Date: Thu Feb 11 21:58:45 2016
New Revision: 1729901

URL: http://svn.apache.org/viewvc?rev=1729901=rev
Log:
Introduce an ap_get_useragent_host() accessor to replace the old
ap_get_remote_host() in most applications, but preserve the original
behavior for all ap_get_remote_host() consumers (mostly, because we
don't have the request_rec in the first place, and also to avoid any
unintended consequences).

This accessor continues to store the remote_host of connection based
uesr agents within the conn_rec for optimization.  Only where some
other module modifies the useragent_addr will we perform a per-request
query of the remote_host.

(Committed previously, but backed out due to unrelated core.c changes)

Modified:
 httpd/httpd/trunk/CHANGES
 httpd/httpd/trunk/include/ap_mmn.h
 httpd/httpd/trunk/include/http_core.h
 httpd/httpd/trunk/include/httpd.h
 httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1729901=1729900=1729901=diff
==
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Feb 11 21:58:45 2016
@@ -1,6 +1,11 @@
   -*- coding: utf-8 -*-
  Changes with Apache 2.5.0

+  *) core: Track the useragent_host per-request when mod_remoteip or similar
+ modules track a per-request useragent_ip.  Modules should be updated
+ to inquire for ap_get_useragent_host() in place of ap_get_remote_host().
+ [William Rowe]
+
*) mod_proxy: Play/restore the TLS-SNI on new backend connections which
   had to be issued because the remote closed the previous/reusable one
   during idle (keep-alive) time.  [Yann Ylavic]

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1729901=1729900=1729901=diff
==
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Thu Feb 11 21:58:45 2016
@@ -500,6 +500,8 @@
   * 20150222.9 (2.5.0-dev)  Add epxr_hander to core_dir_config.
   * 20150222.10 (2.5.0-dev) Add new ap_update_child_status...() methods,
   * add protocol to worker_score in scoreboard.h
+ * 20150222.11 (2.5.0-dev) Split useragent_host from the conn_rec into
+ * the request_rec, with ap_get_useragent_host()
   */

  #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -507,7 +509,7 @@
  #ifndef MODULE_MAGIC_NUMBER_MAJOR
  #define MODULE_MAGIC_NUMBER_MAJOR 20150222
  #endif
-#define MODULE_MAGIC_NUMBER_MINOR 10 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 11 /* 0...n */

  /**
   * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/http_core.h
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=1729901=1729900=1729901=diff
==
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Thu Feb 11 21:58:45 2016
@@ -159,6 +159,32 @@ AP_DECLARE(int) ap_allow_overrides(reque
  AP_DECLARE(const char *) ap_document_root(request_rec *r);

  /**
+ * Lookup the remote user agent's DNS name or IP address
+ * @ingroup get_remote_hostname
+ * @param req The current request
+ * @param type The type of lookup to perform.  One of:
+ * 
+ * REMOTE_HOST returns the hostname, or NULL if the hostname
+ * lookup fails.  It will force a DNS lookup according to the
+ * HostnameLookups setting.
+ * REMOTE_NAME returns the hostname, or the dotted quad if the
+ * hostname lookup fails.  It will force a DNS lookup according
+ * to the HostnameLookups setting.
+ * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
+ * never forced.
+ * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
+ *   a double reverse lookup, regardless of the HostnameLookups
+ *   setting.  The result is the (double reverse checked)
+ *   hostname, or NULL if any of the lookups fail.
+ * 
+ * @param str_is_ip unless NULL is passed, this 

Re: svn commit: r1729901 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/http_core.h include/httpd.h server/core.c

2016-02-11 Thread William A Rowe Jr
I was just about to do the same, but revert and recommit just to simplify
the (anticipated) later backport.  The bitfield is a bugger.

Apparently my make clean; make wasn't building the source tree
I thought it was, sigh...

Bill

On Thu, Feb 11, 2016 at 6:20 PM, Rainer Jung 
wrote:

> I fixed two minor compilation failures, but one type of failure remains:
>
> .../server/core.c: In function 'ap_get_remote_host':
> .../server/core.c:959:17: error: cannot take address of bit-field
> 'double_reverse'
>  do_double_reverse(>double_reverse,
> conn->remote_host,
>  ^
> .../server/core.c:974:9: error: cannot take address of bit-field
> 'double_reverse'
>  do_double_reverse(>double_reverse, conn->remote_host,
>  ^
>
> Regards,
>
> Rainer
>
>
> Am 11.02.2016 um 22:58 schrieb wr...@apache.org:
>
>> Author: wrowe
>> Date: Thu Feb 11 21:58:45 2016
>> New Revision: 1729901
>>
>> URL: http://svn.apache.org/viewvc?rev=1729901=rev
>> Log:
>> Introduce an ap_get_useragent_host() accessor to replace the old
>> ap_get_remote_host() in most applications, but preserve the original
>> behavior for all ap_get_remote_host() consumers (mostly, because we
>> don't have the request_rec in the first place, and also to avoid any
>> unintended consequences).
>>
>> This accessor continues to store the remote_host of connection based
>> uesr agents within the conn_rec for optimization.  Only where some
>> other module modifies the useragent_addr will we perform a per-request
>> query of the remote_host.
>>
>> (Committed previously, but backed out due to unrelated core.c changes)
>>
>> Modified:
>>  httpd/httpd/trunk/CHANGES
>>  httpd/httpd/trunk/include/ap_mmn.h
>>  httpd/httpd/trunk/include/http_core.h
>>  httpd/httpd/trunk/include/httpd.h
>>  httpd/httpd/trunk/server/core.c
>>
>> Modified: httpd/httpd/trunk/CHANGES
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1729901=1729900=1729901=diff
>>
>> ==
>> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
>> +++ httpd/httpd/trunk/CHANGES [utf-8] Thu Feb 11 21:58:45 2016
>> @@ -1,6 +1,11 @@
>>-*- coding:
>> utf-8 -*-
>>   Changes with Apache 2.5.0
>>
>> +  *) core: Track the useragent_host per-request when mod_remoteip or
>> similar
>> + modules track a per-request useragent_ip.  Modules should be updated
>> + to inquire for ap_get_useragent_host() in place of
>> ap_get_remote_host().
>> + [William Rowe]
>> +
>> *) mod_proxy: Play/restore the TLS-SNI on new backend connections
>> which
>>had to be issued because the remote closed the previous/reusable
>> one
>>during idle (keep-alive) time.  [Yann Ylavic]
>>
>> Modified: httpd/httpd/trunk/include/ap_mmn.h
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1729901=1729900=1729901=diff
>>
>> ==
>> --- httpd/httpd/trunk/include/ap_mmn.h (original)
>> +++ httpd/httpd/trunk/include/ap_mmn.h Thu Feb 11 21:58:45 2016
>> @@ -500,6 +500,8 @@
>>* 20150222.9 (2.5.0-dev)  Add epxr_hander to core_dir_config.
>>* 20150222.10 (2.5.0-dev) Add new ap_update_child_status...() methods,
>>* add protocol to worker_score in scoreboard.h
>> + * 20150222.11 (2.5.0-dev) Split useragent_host from the conn_rec into
>> + * the request_rec, with ap_get_useragent_host()
>>*/
>>
>>   #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
>> @@ -507,7 +509,7 @@
>>   #ifndef MODULE_MAGIC_NUMBER_MAJOR
>>   #define MODULE_MAGIC_NUMBER_MAJOR 20150222
>>   #endif
>> -#define MODULE_MAGIC_NUMBER_MINOR 10 /* 0...n */
>> +#define MODULE_MAGIC_NUMBER_MINOR 11 /* 0...n */
>>
>>   /**
>>* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
>>
>> Modified: httpd/httpd/trunk/include/http_core.h
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=1729901=1729900=1729901=diff
>>
>> ==
>> --- httpd/httpd/trunk/include/http_core.h (original)
>> +++ httpd/httpd/trunk/include/http_core.h Thu Feb 11 21:58:45 2016
>> @@ -159,6 +159,32 @@ AP_DECLARE(int) ap_allow_overrides(reque
>>   AP_DECLARE(const char *) ap_document_root(request_rec *r);
>>
>>   /**
>> + * Lookup the remote user agent's DNS name or IP address
>> + * @ingroup get_remote_hostname
>> + * @param req The current request
>> + * @param type The type of lookup to perform.  One of:
>> + * 
>> + * REMOTE_HOST returns the hostname, or NULL if the hostname
>> + * lookup fails.  It will force a DNS lookup according
>> to the
>> + * HostnameLookups setting.
>> + * REMOTE_NAME returns the hostname, or 

Re: svn commit: r1729901 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/http_core.h include/httpd.h server/core.c

2016-02-11 Thread William A Rowe Jr
On Thu, Feb 11, 2016 at 6:20 PM, Rainer Jung 
wrote:

> one type of failure remains:
>
> .../server/core.c: In function 'ap_get_remote_host':
> .../server/core.c:959:17: error: cannot take address of bit-field
> 'double_reverse'
>  do_double_reverse(>double_reverse,
> conn->remote_host,
>  ^
> .../server/core.c:974:9: error: cannot take address of bit-field
> 'double_reverse'
>  do_double_reverse(>double_reverse, conn->remote_host,
>  ^
>

Funny enough, because this is inline, the assignment of an int to an int :2
raises no truncation warning; the entire return {val} is in the domain
1..-1 :)

These should all be ready for further review against trunk and 2.4.x.  I can
spend time Sunday reviewing any new edge cases specific to trunk, the
grep pattern "[>_]remote_host" was pretty efficient at tracking these down.

Bill