[trafficserver] branch master updated: Do not try to open the resolv_conf file if it's nullptr. ASAN related fix.

2017-11-16 Thread amc
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 334d4a9  Do not try to open the resolv_conf file if it's nullptr. ASAN 
related fix.
334d4a9 is described below

commit 334d4a9abedd34943aa75ed948375aa044113030
Author: Alan M. Carroll 
AuthorDate: Thu Nov 16 10:28:06 2017 -0600

Do not try to open the resolv_conf file if it's nullptr. ASAN related fix.
---
 lib/ts/ink_res_init.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ts/ink_res_init.cc b/lib/ts/ink_res_init.cc
index f991698..d6e9ffd 100644
--- a/lib/ts/ink_res_init.cc
+++ b/lib/ts/ink_res_init.cc
@@ -441,7 +441,7 @@ ink_res_init(ink_res_state statp, ///< State object 
to update.
 #define MATCH(line, name) \
   (!strncmp(line, name, sizeof(name) - 1) && (line[sizeof(name) - 1] == ' ' || 
line[sizeof(name) - 1] == '\t'))
 
-  if ((fp = fopen(pResolvConf, "r")) != nullptr) {
+  if (pResolvConf && ((fp = fopen(pResolvConf, "r")) != nullptr)) {
 /* read the config file */
 while (fgets(buf, sizeof(buf), fp) != nullptr) {
   /* skip comments */

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: expands TSHostLookup documentation

2017-11-16 Thread amc
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 3fbd0d2  expands TSHostLookup documentation
3fbd0d2 is described below

commit 3fbd0d23f7bfaa2ab0ab58438936619a23b44700
Author: Derek Dagit 
AuthorDate: Tue Nov 14 20:43:49 2017 +

expands TSHostLookup documentation
---
 doc/developer-guide/api/functions/TSHostLookup.en.rst  |  6 ++
 .../api/functions/TSHostLookupResultAddrGet.en.rst | 14 ++
 doc/developer-guide/api/functions/TSTypes.en.rst   |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/doc/developer-guide/api/functions/TSHostLookup.en.rst 
b/doc/developer-guide/api/functions/TSHostLookup.en.rst
index 41cf405..dc350ad 100644
--- a/doc/developer-guide/api/functions/TSHostLookup.en.rst
+++ b/doc/developer-guide/api/functions/TSHostLookup.en.rst
@@ -30,3 +30,9 @@ Synopsis
 
 Description
 ===
+
+Attempts host name resolution for the given :arg:`hostname` with length 
:arg:`namelen`. When a result is ready the handler of :arg:`contp` is called 
with the :macro:`TS_EVENT_HOST_LOOKUP` event and a :type:`TSHostLookupResult`. 
Use :func:`TSHostLookupResultAddrGet` to retrieve the resulting address from 
the :type:`TSHostLookupResult`.
+
+A call to :func:`TSHostLookup` may be synchronous—in which case the handler 
for :arg:`contp` will be called with the answer before the call to 
:func:`TSHostLookup` returns—or the call to :func:`TSHostLookup` may be 
asynchronous—in which case it returns immediately with a :type:`TSAction`, and 
the handler :arg:`contp` will be called in the future. See 
:doc:`../../plugins/actions/index.en` for guidance.
+
+In particular, :arg:`contp` must have been created with a :type:`TSMutex`; see 
:func:`TSContCreate`
diff --git a/doc/developer-guide/api/functions/TSHostLookupResultAddrGet.en.rst 
b/doc/developer-guide/api/functions/TSHostLookupResultAddrGet.en.rst
index d6e5759..daff4e8 100644
--- a/doc/developer-guide/api/functions/TSHostLookupResultAddrGet.en.rst
+++ b/doc/developer-guide/api/functions/TSHostLookupResultAddrGet.en.rst
@@ -30,3 +30,17 @@ Synopsis
 
 Description
 ===
+
+Retrieves the pointer to a ``sockaddr`` of a the given :arg:`lookup_result` 
from a previous call to :func:`TSHostLookup`.
+
+For example:
+
+.. code-block:: c
+
+int
+handler(TSCont contp, TSEvent event, void *edata) {
+if (event == TS_EVENT_HOST_LOOKUP) {
+const sockaddr *addr = 
TSHostLookupResultAddrGet(static_cast(edata));
+// TODO Add logic here.
+}
+}
diff --git a/doc/developer-guide/api/functions/TSTypes.en.rst 
b/doc/developer-guide/api/functions/TSTypes.en.rst
index 2b07ea1..ae47cf0 100644
--- a/doc/developer-guide/api/functions/TSTypes.en.rst
+++ b/doc/developer-guide/api/functions/TSTypes.en.rst
@@ -58,6 +58,8 @@ more widely. Those are described on this page.
 
 .. type:: TSHostLookupResult
 
+   A type representing the result of a call to :func:`TSHostLookup`. Use with 
:func:`TSHostLookupResultAddrGet`.
+
 .. type:: TSHRTime
 
"High Resolution Time"

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: Fix include issue in null_transform

2017-11-16 Thread amc
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new a64817a  Fix include issue in null_transform
a64817a is described below

commit a64817a0decf507bbc11f41822b9e8a805fcae7f
Author: dyrock 
AuthorDate: Tue Nov 14 10:36:52 2017 -0600

Fix include issue in null_transform

Fix null transform test

Fix null_transform.c based on opensource version
---
 example/null_transform/null_transform.c |  8 
 .../null_transform/gold/null_transform-200.gold |  9 +++--
 .../null_transform/null_transform.test.py   | 15 +--
 tests/tools/plugins/null_transform.c| 21 +
 4 files changed, 13 insertions(+), 40 deletions(-)

diff --git a/example/null_transform/null_transform.c 
b/example/null_transform/null_transform.c
index 1de21e0..e180f5c 100644
--- a/example/null_transform/null_transform.c
+++ b/example/null_transform/null_transform.c
@@ -23,9 +23,9 @@
 
 #include 
 #include 
+#include 
 
 #include "ts/ts.h"
-#include "ts/ink_defs.h"
 
 #define PLUGIN_NAME "null_transform"
 
@@ -183,7 +183,7 @@ handle_transform(TSCont contp)
 }
 
 static int
-null_transform(TSCont contp, TSEvent event, void *edata ATS_UNUSED)
+null_transform(TSCont contp, TSEvent event, void *edata)
 {
   /* Check to see if the transformation has been closed by a call to
* TSVConnClose.
@@ -275,7 +275,7 @@ transform_add(TSHttpTxn txnp)
 }
 
 static int
-transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
+transform_plugin(TSCont contp, TSEvent event, void *edata)
 {
   TSHttpTxn txnp = (TSHttpTxn)edata;
 
@@ -297,7 +297,7 @@ transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, 
void *edata)
 }
 
 void
-TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
+TSPluginInit(int argc, const char *argv[])
 {
   TSPluginRegistrationInfo info;
 
diff --git a/tests/gold_tests/null_transform/gold/null_transform-200.gold 
b/tests/gold_tests/null_transform/gold/null_transform-200.gold
index fcc57b3..bd73330 100644
--- a/tests/gold_tests/null_transform/gold/null_transform-200.gold
+++ b/tests/gold_tests/null_transform/gold/null_transform-200.gold
@@ -1,14 +1,11 @@
 ``
 > GET http://www.example.com/ HTTP/1.1
+``
 > Host: www.example.com``
-> User-Agent: curl/``
-> Accept: */*
-> Proxy-Connection:``
 ``
 < HTTP/1.1 200 OK
-< Date:``
+``
 < Content-Length: 26
-< Age: ``
-< Proxy-Connection: keep-alive
+``
 < Server: ATS/``
 ``
diff --git a/tests/gold_tests/null_transform/null_transform.test.py 
b/tests/gold_tests/null_transform/null_transform.test.py
index 846f630..4e1e4e8 100644
--- a/tests/gold_tests/null_transform/null_transform.test.py
+++ b/tests/gold_tests/null_transform/null_transform.test.py
@@ -55,20 +55,7 @@ ts.Disk.remap_config.AddLine(
 )
 
 # Load plugin
-plugin_args = ""
-lib_dir = os.path.join(Test.Variables.AtsTestToolsDir, '../../lib')
-plugin_dir = ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']
-plugin_dir_src = os.path.join(Test.Variables.AtsTestToolsDir, 'plugins', 
'null_transform.c')
-ts.Setup.Copy(plugin_dir_src, plugin_dir)
-
-in_basename = os.path.basename(plugin_dir_src)
-in_path = os.path.join(plugin_dir, in_basename)
-out_basename = os.path.splitext(in_basename)[0] + '.so'
-out_path = os.path.join(plugin_dir, out_basename)
-
-ts.Setup.RunCommand('tsxs -c {0} -o {1} -I {2}'.format(in_path, out_path, 
lib_dir))
-ts.Disk.plugin_config.AddLine("{0} {1}".format(out_basename, plugin_args))
-
+Test.prepare_plugin(os.path.join(Test.Variables.AtsTestToolsDir, 'plugins', 
'null_transform.c'), ts)
 
 # www.example.com Host
 tr = Test.AddTestRun()
diff --git a/tests/tools/plugins/null_transform.c 
b/tests/tools/plugins/null_transform.c
index cc941cd..e180f5c 100644
--- a/tests/tools/plugins/null_transform.c
+++ b/tests/tools/plugins/null_transform.c
@@ -1,6 +1,6 @@
 /** @file
 
-  A brief file description
+  An example program that does a null transform of response body content.
 
   @section license License
 
@@ -21,22 +21,11 @@
   limitations under the License.
  */
 
-/* null_transform.c:  an example program that does a null transform
- *of response body content
- *
- *
- *
- * Usage:
- *   null_transform.so
- *
- *
- */
-
 #include 
 #include 
+#include 
 
 #include "ts/ts.h"
-#include "ts/ink_defs.h"
 
 #define PLUGIN_NAME "null_transform"
 
@@ -194,7 +183,7 @@ handle_transform(TSCont contp)
 }
 
 static int
-null_transform(TSCont contp, TSEvent event, void *edata ATS_UNUSED)
+null_transform(TSCont contp, TSEvent event, void *edata)
 {
   /* Check to see if the transformation has been closed by a call to
* TSVConnClose.
@@ -286,7 +275,7 @@ transform_add(TSHttpTxn txnp)
 }
 
 static int
-transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)

[trafficserver] branch master updated: Add configuration for per-client IP debugging

2017-11-16 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new d8c814a  Add configuration for per-client IP debugging
d8c814a is described below

commit d8c814ad57bccd8362e59bb6f22babf0ec094965
Author: shinrich 
AuthorDate: Wed Jan 25 17:55:23 2017 -0600

Add configuration for per-client IP debugging
---
 doc/admin-guide/files/records.config.en.rst |  8 +++-
 iocore/cache/Cache.cc   |  1 +
 iocore/net/P_UnixNetVConnection.h   |  1 +
 iocore/net/UnixNet.cc   |  4 ++--
 lib/ts/ContFlags.cc | 32 +
 lib/ts/ContFlags.h  | 10 ++---
 lib/ts/Diags.cc |  4 ++--
 lib/ts/Diags.h  | 14 ++---
 mgmt/RecordsConfig.cc   |  2 ++
 proxy/Main.cc   | 24 ++
 proxy/http/HttpSM.cc|  2 +-
 proxy/http/HttpServerSession.cc |  2 ++
 proxy/shared/DiagsConfig.cc |  2 +-
 13 files changed, 66 insertions(+), 40 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index 0dfec5a..24310a8 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -2967,7 +2967,13 @@ Diagnostic Logging Configuration
 .. ts:cv:: CONFIG proxy.config.diags.debug.enabled INT 0
:reloadable:
 
-   Enables logging for diagnostic messages whose log level is `diag` or 
`debug`.
+   When set to 1, enables logging for diagnostic messages whose log level is 
`diag` or `debug`.
+
+   When set to 2, interprets the :ts:cv:`proxy.config.diags.debug.client_ip` 
setting determine whether diagnostic messages are logged.
+
+.. ts:cv:: CONFIG proxy.config.diags.debug.client_ip STRING NULL
+
+   if :ts:cv:`proxy.config.diags.debug.enabled` is set to 2, this value is 
tested against the source IP of the incoming connection.  If there is a match, 
all the diagnostic messages for that connection and the related outgoing 
connection will be logged.
 
 .. ts:cv:: CONFIG proxy.config.diags.debug.tags STRING http|dns
 
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index c39a0d8..23c362c 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -1004,6 +1004,7 @@ CacheProcessor::cacheInitialized()
   vol = gvol[i];
   double factor;
   if (gvol[i]->cache == theCache) {
+ink_assert(gvol[i]->cache != nullptr);
 factor = (double)(int64_t)(gvol[i]->len >> STORE_BLOCK_SHIFT) / 
(int64_t)theCache->cache_size;
 Debug("cache_init", "CacheProcessor::cacheInitialized - factor = 
%f", factor);
 gvol[i]->ram_cache->init((int64_t)(http_ram_cache_size * factor), 
vol);
diff --git a/iocore/net/P_UnixNetVConnection.h 
b/iocore/net/P_UnixNetVConnection.h
index c6ad45e..06a2d79 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -317,6 +317,7 @@ TS_INLINE void
 UnixNetVConnection::set_remote_addr()
 {
   ats_ip_copy(_addr, );
+  this->control_flags.set_flag(ContFlags::DEBUG_OVERRIDE, 
diags->test_override_ip(remote_addr));
 }
 
 TS_INLINE void
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 2b7476d..831c21f 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -432,7 +432,7 @@ NetHandler::process_ready_list()
   }
 #else  /* !USE_EDGE_TRIGGER */
   while ((vc = read_ready_list.dequeue())) {
-diags->set_override(vc->control.debug_override);
+set_cont_flags(vc->control_flags);
 if (vc->closed)
   free_netvc(vc);
 else if (vc->read.enabled && vc->read.triggered)
@@ -441,7 +441,7 @@ NetHandler::process_ready_list()
   vc->ep.modify(-EVENTIO_READ);
   }
   while ((vc = write_ready_list.dequeue())) {
-diags->set_override(vc->control.debug_override);
+set_cont_flags(vc->control_flags);
 if (vc->closed)
   free_netvc(vc);
 else if (vc->write.enabled && vc->write.triggered)
diff --git a/lib/ts/ContFlags.cc b/lib/ts/ContFlags.cc
index ef84768..ba5e0bf 100644
--- a/lib/ts/ContFlags.cc
+++ b/lib/ts/ContFlags.cc
@@ -23,50 +23,28 @@
 
 #include "ContFlags.h"
 
-static ink_thread_key init_thread_key();
-static inkcoreapi ink_thread_key flags_data_key = init_thread_key();
-
-static ink_thread_key
-init_thread_key()
-{
-  ink_thread_key_create(_data_key, nullptr);
-  return flags_data_key;
-}
-
-/* Set up a cont_flags entry for this threa */
-void
-init_cont_flags()
-{
-  ContFlags new_flags;
-  void *val = reinterpret_cast(static_cast((new_flags.get_flags(;
-  ink_thread_setspecific(flags_data_key, val);
-}
+thread_local ContFlags local_flags;
 
 void
 

[trafficserver] branch master updated: corrects response reason when failing to connect to origin

2017-11-16 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new e7534ac  corrects response reason when failing to connect to origin
e7534ac is described below

commit e7534aca85957129dafcbe7037b97b0c7ecf42da
Author: Derek Dagit 
AuthorDate: Wed Nov 15 20:39:49 2017 +

corrects response reason when failing to connect to origin
---
 proxy/http/HttpTransact.cc |  5 ++-
 .../headers/general-connection-failure-502.gold| 21 +
 .../headers/general-connection-failure-502.test.py | 52 ++
 3 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 54ba25f..c79b0f6 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7359,8 +7359,9 @@ HttpTransact::handle_server_died(State *s)
 body_type = "response#bad_response";
 break;
   case CONNECTION_ERROR:
-status= HTTP_STATUS_BAD_GATEWAY;
-reason= (char *)get_error_string(s->cause_of_death_errno);
+status = HTTP_STATUS_BAD_GATEWAY;
+reason =
+  static_cast(get_error_string(s->cause_of_death_errno == 0 
? -ENET_CONNECT_FAILED : s->cause_of_death_errno));
 body_type = "connect#failed_connect";
 break;
   case OPEN_RAW_ERROR:
diff --git a/tests/gold_tests/headers/general-connection-failure-502.gold 
b/tests/gold_tests/headers/general-connection-failure-502.gold
new file mode 100644
index 000..a5e2732
--- /dev/null
+++ b/tests/gold_tests/headers/general-connection-failure-502.gold
@@ -0,0 +1,21 @@
+HTTP/1.1 502 connect failed
+Connection: keep-alive
+Cache-Control: no-store
+Content-Type: text/html
+Content-Language: en
+Content-Length: 247
+
+
+
+Could Not Connect
+
+
+
+Could Not Connect
+
+
+
+Description: Could not connect to the requested server host.
+
+
+
diff --git a/tests/gold_tests/headers/general-connection-failure-502.test.py 
b/tests/gold_tests/headers/general-connection-failure-502.test.py
new file mode 100644
index 000..839190a
--- /dev/null
+++ b/tests/gold_tests/headers/general-connection-failure-502.test.py
@@ -0,0 +1,52 @@
+'''
+Test response when connection to origin fails
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import os
+
+Test.Summary = '''
+Test response when connection to origin fails
+'''
+
+Test.ContinueOnFail = True
+
+ts = Test.MakeATSProcess("ts")
+
+HOST = 'www.connectfail502.test'
+
+ARBITRARY_LOOPBACK_IP='127.220.59.101' # This should fail to connect.
+ts.Disk.remap_config.AddLine(
+'map http://{0} http://{1}'.format(HOST, ARBITRARY_LOOPBACK_IP)
+)
+
+Test.Setup.Copy(os.path.join(Test.Variables['AtsTestToolsDir'], 
'tcp_client.py'))
+
+TEST_DATA_PATH=os.path.join(Test.TestDirectory, 
'www.connectfail502.test-get.txt')
+with open(TEST_DATA_PATH, 'w') as f:
+f.write("GET / HTTP/1.1\r\nHost: {}\r\n\r\n".format(HOST))
+Test.Setup.Copy(TEST_DATA_PATH)
+
+GOLD_FILE_PATH=os.path.join(Test.TestDirectory, 
'general-connection-failure-502.gold')
+Test.Setup.Copy(GOLD_FILE_PATH)
+
+tr = Test.AddTestRun()
+tr.Processes.Default.StartBefore(Test.Processes.ts)
+tr.Processes.Default.Command = "python tcp_client.py 127.0.0.1 {0} {1} | egrep 
-v '^(Date: |Server: ATS/)'"\
+.format(ts.Variables.port, os.path.basename(TEST_DATA_PATH))
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.stdout = os.path.basename(GOLD_FILE_PATH)

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: Fix for macOSX build error

2017-11-16 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new b75e4e1  Fix for macOSX build error
b75e4e1 is described below

commit b75e4e10065431b8664fb984f968be10f2a20a7e
Author: Persia Aziz 
AuthorDate: Thu Nov 16 12:58:01 2017 -0600

Fix for macOSX build error
---
 lib/Makefile.am  | 2 +-
 lib/tsconfig/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index db1e0f6..32ec467 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -16,7 +16,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-SUBDIRS = ts records tsconfig bindings cppapi
+SUBDIRS = ts records . tsconfig bindings cppapi
 
 if BUILD_PERL_LIB
 SUBDIRS += perl
diff --git a/lib/tsconfig/Makefile.am b/lib/tsconfig/Makefile.am
index 5d4216e..4244b63 100644
--- a/lib/tsconfig/Makefile.am
+++ b/lib/tsconfig/Makefile.am
@@ -18,7 +18,7 @@
 
 lib_LTLIBRARIES = libtsconfig.la
 check_PROGRAMS = test-tsconfig
-libtsconfig_la_LDFLAGS = -no-undefined -version-info @TS_LIBTOOL_VERSION@
+libtsconfig_la_LDFLAGS = -version-info @TS_LIBTOOL_VERSION@
 
 AM_CFLAGS += @FLEX_CFLAGS@
 AM_YFLAGS = --yacc -d -p tsconfig

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: Fix a crash that a SSL callback gets netvc from a wrong place

2017-11-16 Thread maskit
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new e2bccd5  Fix a crash that a SSL callback gets netvc from a wrong place
e2bccd5 is described below

commit e2bccd5384a4a3e769f994ee794888f3efacb335
Author: Masakazu Kitajo 
AuthorDate: Fri Nov 17 10:34:57 2017 +0900

Fix a crash that a SSL callback gets netvc from a wrong place

SSLNetVConnection has to be obtained with SSLNetVCAccess
---
 iocore/net/SSLUtils.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 37452e2..7c55cd5 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -416,7 +416,7 @@ extern SNIActionPerformer sni_action_performer;
 static int
 ssl_servername_only_callback(SSL *ssl, int * /* ad */, void * /*arg*/)
 {
-  SSLNetVConnection *netvc = reinterpret_cast(SSL_get_app_data(ssl));
+  SSLNetVConnection *netvc = SSLNetVCAccess(ssl);
   const char *servername   = SSL_get_servername(ssl, 
TLSEXT_NAMETYPE_host_name);
   Debug("ssl", "Requested servername is %s", servername);
   if (servername != nullptr) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch 7.1.x updated: Revert "Cancel closing if Http2SendDataFrameResult is NO_WINDOW"

2017-11-16 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
 new 85139e5  Revert "Cancel closing if Http2SendDataFrameResult is 
NO_WINDOW"
85139e5 is described below

commit 85139e5e6cf898e672b4c54871d14381172f8b3b
Author: Leif Hedstrom 
AuthorDate: Fri Nov 17 10:40:17 2017 +0800

Revert "Cancel closing if Http2SendDataFrameResult is NO_WINDOW"

This reverts commit 6b532c9a3de2e050ad3ca6c2e45bb5d485e25181.

The issue here is that we leak (or seemingly leak) active connections,
such that the metrics for active connections go nuts, and eventually
we throttle. This only happens with H2.
---
 proxy/http2/Http2ConnectionState.cc | 38 +++--
 proxy/http2/Http2ConnectionState.h  | 14 +++---
 proxy/http2/Http2Stream.cc  | 22 -
 3 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index fa1fb29..9084617 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1209,11 +1209,11 @@ 
Http2ConnectionState::send_data_frames_depends_on_priority()
   ink_release_assert(stream != nullptr);
   Http2StreamDebug(ua_session, stream->get_id(), "top node, point=%d", 
node->point);
 
-  size_t len  = 0;
-  Http2SendDataFrameResult result = send_a_data_frame(stream, len);
+  size_t len   = 0;
+  Http2SendADataFrameResult result = send_a_data_frame(stream, len);
 
   switch (result) {
-  case Http2SendDataFrameResult::NO_ERROR: {
+  case HTTP2_SEND_A_DATA_FRAME_NO_ERROR: {
 // No response body to send
 if (len == 0 && !stream->is_body_done()) {
   dependency_tree->deactivate(node, len);
@@ -1222,7 +1222,7 @@ 
Http2ConnectionState::send_data_frames_depends_on_priority()
 }
 break;
   }
-  case Http2SendDataFrameResult::DONE: {
+  case HTTP2_SEND_A_DATA_FRAME_DONE: {
 dependency_tree->deactivate(node, len);
 delete_stream(stream);
 break;
@@ -1237,7 +1237,7 @@ 
Http2ConnectionState::send_data_frames_depends_on_priority()
   return;
 }
 
-Http2SendDataFrameResult
+Http2SendADataFrameResult
 Http2ConnectionState::send_a_data_frame(Http2Stream *stream, size_t 
_length)
 {
   const ssize_t window_size = std::min(this->client_rwnd, 
stream->client_rwnd);
@@ -1259,7 +1259,7 @@ Http2ConnectionState::send_a_data_frame(Http2Stream 
*stream, size_t _len
   if (read_available_size > 0) {
 // We only need to check for window size when there is a payload
 if (window_size <= 0) {
-  return Http2SendDataFrameResult::NO_WINDOW;
+  return HTTP2_SEND_A_DATA_FRAME_NO_WINDOW;
 }
 // Copy into the payload buffer. Seems like we should be able to skip this 
copy step
 payload_length = current_reader->read(payload_buffer, 
write_available_size);
@@ -1271,7 +1271,7 @@ Http2ConnectionState::send_a_data_frame(Http2Stream 
*stream, size_t _len
   // If we return here, we never send the END_STREAM in the case of a early 
terminating OS.
   // OK if there is no body yet. Otherwise continue on to send a DATA frame 
and delete the stream
   if (!stream->is_body_done() && payload_length == 0) {
-return Http2SendDataFrameResult::NO_PAYLOAD;
+return HTTP2_SEND_A_DATA_FRAME_NO_PAYLOAD;
   }
 
   if (stream->is_body_done() && read_available_size <= write_available_size) {
@@ -1303,13 +1303,13 @@ Http2ConnectionState::send_a_data_frame(Http2Stream 
*stream, size_t _len
 // Setting to the same state shouldn't be erroneous
 stream->change_state(data.header().type, data.header().flags);
 
-return Http2SendDataFrameResult::DONE;
+return HTTP2_SEND_A_DATA_FRAME_DONE;
   }
 
-  return Http2SendDataFrameResult::NO_ERROR;
+  return HTTP2_SEND_A_DATA_FRAME_NO_ERROR;
 }
 
-Http2SendDataFrameResult
+void
 Http2ConnectionState::send_data_frames(Http2Stream *stream)
 {
   // To follow RFC 7540 must not send more frames other than priority on
@@ -1318,25 +1318,27 @@ Http2ConnectionState::send_data_frames(Http2Stream 
*stream)
   stream->get_state() == Http2StreamState::HTTP2_STREAM_STATE_CLOSED) {
 Http2StreamDebug(this->ua_session, stream->get_id(), "Shutdown half closed 
local stream");
 this->delete_stream(stream);
-return Http2SendDataFrameResult::NO_ERROR;
+return;
   }
 
-  size_t len  = 0;
-  Http2SendDataFrameResult result = Http2SendDataFrameResult::NO_ERROR;
-  while (result == Http2SendDataFrameResult::NO_ERROR) {
-result = send_a_data_frame(stream, len);
+  size_t len = 0;
+  while (true) {
+Http2SendADataFrameResult result = send_a_data_frame(stream, len);
 
-if (result == Http2SendDataFrameResult::DONE) {
+if (result == HTTP2_SEND_A_DATA_FRAME_DONE) {
   // 

[trafficserver] branch quic-latest updated: return something to make g++ happy

2017-11-16 Thread scw00
This is an automated email from the ASF dual-hosted git repository.

scw00 pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new e5af6be  return something to make g++ happy
e5af6be is described below

commit e5af6be2b46d31768f29f8387febb0c3bd9b8b74
Author: scw00 
AuthorDate: Fri Nov 17 11:22:40 2017 +0800

return something to make g++ happy
---
 iocore/net/quic/QUICCrypto.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/iocore/net/quic/QUICCrypto.cc b/iocore/net/quic/QUICCrypto.cc
index ec020a8..d407e03 100644
--- a/iocore/net/quic/QUICCrypto.cc
+++ b/iocore/net/quic/QUICCrypto.cc
@@ -70,6 +70,9 @@ QUICPacketProtection::get_key(QUICKeyPhase phase) const
   case QUICKeyPhase::CLEARTEXT:
 return *this->_cleartext_key;
   }
+
+  ink_release_assert(!"Bad phase");
+  return *this->_cleartext_key;
 }
 
 QUICKeyPhase

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch quic-latest updated: Make tests compilable

2017-11-16 Thread maskit
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new 0e83437  Make tests compilable
0e83437 is described below

commit 0e83437af5abf82a64da3de326cd82114b8fd95e
Author: Masakazu Kitajo 
AuthorDate: Fri Nov 17 15:54:42 2017 +0900

Make tests compilable
---
 iocore/net/quic/QUICPacket.cc  |  61 +-
 iocore/net/quic/QUICPacket.h   | 106 +
 iocore/net/quic/test/Makefile.am   |  17 
 iocore/net/quic/test/test_QUICCrypto.cc|   4 +-
 iocore/net/quic/test/test_QUICKeyGenerator.cc  |  28 +++
 iocore/net/quic/test/test_QUICPacket.cc|  80 ---
 iocore/net/quic/test/test_QUICPacketFactory.cc |   9 ++-
 7 files changed, 177 insertions(+), 128 deletions(-)

diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 82e0b74..2b5e87b 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -85,6 +85,12 @@ QUICPacketHeader::build(QUICPacketType type, 
QUICConnectionId connection_id, QUI
   return short_header;
 }
 
+QUICPacketHeader *
+QUICPacketHeader::clone() const
+{
+  return nullptr;
+}
+
 //
 // QUICPacketLongHeader
 //
@@ -451,12 +457,13 @@ QUICPacketShortHeader::store(uint8_t *buf, size_t *len) 
const
 //
 // QUICPacket
 //
-QUICPacket::QUICPacket(QUICPacketHeader *header, ats_unique_buf 
unprotected_payload, size_t unprotected_payload_len, QUICPacketNumber 
base_packet_number)
+
+QUICPacket::QUICPacket(QUICPacketHeader *header, ats_unique_buf payload, 
size_t payload_len, QUICPacketNumber base_packet_number)
 {
-  this->_size   = unprotected_payload_len;
-  this->_header = header;
-  this->_unprotected_payload = std::move(unprotected_payload);
-  this->_unprotected_payload_len = unprotected_payload_len;
+  this->_header   = header;
+  this->_size = this->_header->length() + payload_len;
+  this->_payload  = std::move(payload);
+  this->_payload_size = payload_len;
 }
 
 QUICPacket::QUICPacket(QUICPacketType type, QUICConnectionId connection_id, 
QUICPacketNumber packet_number,
@@ -546,10 +553,10 @@ QUICPacket::packet_number() const
   return this->_header->packet_number();
 }
 
-const uint8_t *
+const QUICPacketHeader *
 QUICPacket::header() const
 {
-  return this->_header->buf();
+  return this->_header;
 }
 
 const uint8_t *
@@ -604,37 +611,8 @@ QUICPacket::key_phase() const
 void
 QUICPacket::store(uint8_t *buf, size_t *len) const
 {
-  this->_header->store(buf, len);
-  ink_assert(this->size() >= *len);
-
-  if (this->type() == QUICPacketType::STATELESS_RESET) {
-memcpy(buf + *len, this->payload(), this->payload_size());
-*len += this->payload_size();
-  } else if (this->type() != QUICPacketType::ZERO_RTT_PROTECTED && 
this->type() != QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_0 &&
- this->type() != QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_1) {
-memcpy(buf + *len, this->payload(), this->payload_size());
-*len += this->payload_size();
-
-// fnv1a(buf, *len, buf + *len);
-// *len += FNV1A_HASH_LEN;
-  } else {
-ink_assert(this->_protected_payload);
-memcpy(buf + *len, this->_protected_payload.get(), 
this->_protected_payload_size);
-*len += this->_protected_payload_size;
-  }
-}
-
-void
-QUICPacket::store_header(uint8_t *buf, size_t *len) const
-{
-  this->_header->store(buf, len);
-}
-
-void
-QUICPacket::set_protected_payload(ats_unique_buf cipher_txt, size_t 
cipher_txt_len)
-{
-  this->_protected_payload  = std::move(cipher_txt);
-  this->_protected_payload_size = cipher_txt_len;
+  memcpy(buf + *len, this->payload(), this->payload_size());
+  *len = this->payload_size();
 }
 
 uint8_t
@@ -790,11 +768,14 @@ 
QUICPacketFactory::create_server_protected_packet(QUICConnectionId connection_id
   // TODO: do not dump header twice
   uint8_t ad[17] = {0};
   size_t ad_len  = 0;
-  packet->store_header(ad, _len);
+  packet->header()->store(ad, _len);
 
   if (this->_crypto->encrypt(cipher_txt.get(), cipher_txt_len, 
max_cipher_txt_len, packet->payload(), packet->payload_size(),
  packet->packet_number(), ad, ad_len, 
packet->key_phase())) {
-packet->set_protected_payload(std::move(cipher_txt), cipher_txt_len);
+QUICPacket *ep = quicPacketAllocator.alloc();
+new (ep) QUICPacket(packet->header()->clone(), std::move(cipher_txt), 
cipher_txt_len, base_packet_number);
+packet = QUICPacketUPtr(ep, ::delete_packet);
+
 Debug("quic_packet_factory", "Encrypt Packet, pkt_num: %" PRIu64 ", 
header_len: %zu payload: %zu", packet->packet_number(),
   ad_len, cipher_txt_len);
 return packet;
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 1874447..5a56349 100644
---