You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2018/09/18 21:08:10 UTC

svn commit: r1841259 - in /httpd/httpd/branches/2.4.x: CHANGES STATUS include/ap_mmn.h include/scoreboard.h modules/echo/mod_echo.c modules/generators/mod_status.c modules/lua/lua_request.c server/scoreboard.c

Author: minfrin
Date: Tue Sep 18 21:08:10 2018
New Revision: 1841259

URL: http://svn.apache.org/viewvc?rev=1841259&view=rev
Log:
Support IPv6-sized client strings in mod_status and mod_echo
trunk: http://svn.apache.org/r1837225
       http://svn.apache.org/r1837366
2.4.x patch: http://home.apache.org/~jim/patches/client64v2.patch
+1: jim, icing (by inspection), minfrin

Modified:
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/include/ap_mmn.h
    httpd/httpd/branches/2.4.x/include/scoreboard.h
    httpd/httpd/branches/2.4.x/modules/echo/mod_echo.c
    httpd/httpd/branches/2.4.x/modules/generators/mod_status.c
    httpd/httpd/branches/2.4.x/modules/lua/lua_request.c
    httpd/httpd/branches/2.4.x/server/scoreboard.c

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Tue Sep 18 21:08:10 2018
@@ -3,6 +3,12 @@ Changes with Apache 2.4.36
 
 Changes with Apache 2.4.35
 
+  *) mod_status, mod_echo: Fix the display of client addresses.
+    They were truncated to 31 characters which is not enough for IPv6 addresses.
+    This is done by deprecating the use of the 'client' field and using
+    the new 'client64' field in worker_score.
+    PR 54848 [Bernhard Schmidt <berni birkenwald de>, Jim Jagielski]
+
   *) http: Enforce consistently no response body with both 204 and 304
      statuses.  [Yann Ylavic]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Tue Sep 18 21:08:10 2018
@@ -124,12 +124,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   *) Support IPv6-sized client strings in mod_status and mod_echo
-      trunk: http://svn.apache.org/r1837225
-             http://svn.apache.org/r1837366
-      2.4.x patch: http://home.apache.org/~jim/patches/client64v2.patch
-      +1: jim, icing (by inspection), minfrin
-
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:

Modified: httpd/httpd/branches/2.4.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/ap_mmn.h?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.4.x/include/ap_mmn.h Tue Sep 18 21:08:10 2018
@@ -522,6 +522,7 @@
  *                          scoreboard.h
  * 20120211.82 (2.4.35-dev) Add optional function declaration for
  *                          ap_proxy_balancer_get_best_worker to mod_proxy.h.
+ * 20120211.83 (2.4.35-dev) Add client64 field to worker_score struct
  *
  */
 
@@ -530,7 +531,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20120211
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 82                  /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 83                  /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/branches/2.4.x/include/scoreboard.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/scoreboard.h?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/scoreboard.h (original)
+++ httpd/httpd/branches/2.4.x/include/scoreboard.h Tue Sep 18 21:08:10 2018
@@ -112,11 +112,12 @@ struct worker_score {
 #ifdef HAVE_TIMES
     struct tms times;
 #endif
-    char client[32];            /* Keep 'em small... */
+    char client[32];            /* DEPRECATED: Keep 'em small... */
     char request[64];           /* We just want an idea... */
     char vhost[32];             /* What virtual host is being accessed? */
     char protocol[16];          /* What protocol is used on the connection? */
     apr_time_t duration;
+    char client64[64];
 };
 
 typedef struct {

Modified: httpd/httpd/branches/2.4.x/modules/echo/mod_echo.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/echo/mod_echo.c?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/echo/mod_echo.c (original)
+++ httpd/httpd/branches/2.4.x/modules/echo/mod_echo.c Tue Sep 18 21:08:10 2018
@@ -108,10 +108,10 @@ static int update_echo_child_status(ap_s
 
     /* initial pass only, please - in the name of efficiency */
     if (c) {
-        apr_cpystrn(ws->client,
+        apr_cpystrn(ws->client64,
                     ap_get_remote_host(c, c->base_server->lookup_defaults,
                                        REMOTE_NOLOOKUP, NULL),
-                    sizeof(ws->client));
+                    sizeof(ws->client64));
         apr_cpystrn(ws->vhost, c->base_server->server_hostname,
                     sizeof(ws->vhost));
         /* Deliberate trailing space - filling in string on WRITE passes */

Modified: httpd/httpd/branches/2.4.x/modules/generators/mod_status.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/generators/mod_status.c?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/generators/mod_status.c (original)
+++ httpd/httpd/branches/2.4.x/modules/generators/mod_status.c Tue Sep 18 21:08:10 2018
@@ -837,7 +837,7 @@ static int status_handler(request_rec *r
                     ap_rprintf(r,
                                " <i>%s {%s}</i> <i>(%s)</i> <b>[%s]</b><br />\n\n",
                                ap_escape_html(r->pool,
-                                              ws_record->client),
+                                              ws_record->client64),
                                ap_escape_html(r->pool,
                                               ap_escape_logitem(r->pool,
                                                                 ws_record->request)),
@@ -924,7 +924,7 @@ static int status_handler(request_rec *r
                     ap_rprintf(r, "</td><td>%s</td><td>%s</td><td nowrap>%s</td>"
                                   "<td nowrap>%s</td></tr>\n\n",
                                ap_escape_html(r->pool,
-                                              ws_record->client),
+                                              ws_record->client64),
                                ap_escape_html(r->pool,
                                               ws_record->protocol),
                                ap_escape_html(r->pool,

Modified: httpd/httpd/branches/2.4.x/modules/lua/lua_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/lua/lua_request.c?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/lua/lua_request.c (original)
+++ httpd/httpd/branches/2.4.x/modules/lua/lua_request.c Tue Sep 18 21:08:10 2018
@@ -1275,6 +1275,10 @@ static int lua_ap_scoreboard_worker(lua_
         lua_pushstring(L, ws_record->client);
         lua_settable(L, -3);
 
+        lua_pushstring(L, "client64");
+        lua_pushstring(L, ws_record->client64);
+        lua_settable(L, -3);
+
         lua_pushstring(L, "conn_bytes");
         lua_pushnumber(L, (lua_Number) ws_record->conn_bytes);
         lua_settable(L, -3);

Modified: httpd/httpd/branches/2.4.x/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/scoreboard.c?rev=1841259&r1=1841258&r2=1841259&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/scoreboard.c (original)
+++ httpd/httpd/branches/2.4.x/server/scoreboard.c Tue Sep 18 21:08:10 2018
@@ -517,17 +517,25 @@ static int update_child_status_internal(
         }
 
         if (r && r->useragent_ip) {
-            if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
-                apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
-            else
-                apr_cpystrn(ws->client, val, sizeof(ws->client));
+            if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL))) {
+                apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client)); /* DEPRECATE */
+                apr_cpystrn(ws->client64, r->useragent_ip, sizeof(ws->client64));
+            }
+            else {
+                apr_cpystrn(ws->client, val, sizeof(ws->client)); /* DEPRECATE */
+                apr_cpystrn(ws->client64, val, sizeof(ws->client64));
+            }
         }
         else if (c) {
             if (!(val = ap_get_remote_host(c, c->base_server->lookup_defaults,
-                                           REMOTE_NOLOOKUP, NULL)))
-                apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client));
-            else
-                apr_cpystrn(ws->client, val, sizeof(ws->client));
+                                           REMOTE_NOLOOKUP, NULL))) {
+                apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client)); /* DEPRECATE */
+                apr_cpystrn(ws->client64, c->client_ip, sizeof(ws->client64));
+            }
+            else {
+                apr_cpystrn(ws->client, val, sizeof(ws->client)); /* DEPRECATE */
+                apr_cpystrn(ws->client64, val, sizeof(ws->client64));
+            }
         }
 
         if (s) {
@@ -673,6 +681,7 @@ AP_DECLARE(void) ap_copy_scoreboard_work
     /* For extra safety, NUL-terminate the strings returned, though it
      * should be true those last bytes are always zero anyway. */
     dest->client[sizeof(dest->client) - 1] = '\0';
+    dest->client64[sizeof(dest->client64) - 1] = '\0';
     dest->request[sizeof(dest->request) - 1] = '\0';
     dest->vhost[sizeof(dest->vhost) - 1] = '\0';
     dest->protocol[sizeof(dest->protocol) - 1] = '\0';