You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2018/04/03 17:00:26 UTC
[trafficserver] branch master updated: Add SO_MARK functionality to
header_rewrite plugin.
This is an automated email from the ASF dual-hosted git repository.
sorber 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 0fc07dc Add SO_MARK functionality to header_rewrite plugin.
0fc07dc is described below
commit 0fc07dcb4fe056163ba9dc1ce9e481ce83e985ba
Author: Phil Sorber <so...@apache.org>
AuthorDate: Tue Apr 3 10:36:37 2018 -0600
Add SO_MARK functionality to header_rewrite plugin.
---
doc/admin-guide/plugins/header_rewrite.en.rst | 10 ++++++++++
plugins/header_rewrite/factory.cc | 2 ++
plugins/header_rewrite/operators.cc | 26 ++++++++++++++++++++++++++
plugins/header_rewrite/operators.h | 16 ++++++++++++++++
4 files changed, 54 insertions(+)
diff --git a/doc/admin-guide/plugins/header_rewrite.en.rst b/doc/admin-guide/plugins/header_rewrite.en.rst
index ef0d38e..ee93bf6 100644
--- a/doc/admin-guide/plugins/header_rewrite.en.rst
+++ b/doc/admin-guide/plugins/header_rewrite.en.rst
@@ -682,6 +682,16 @@ When invoked, sets the client side `DSCP
<https://en.wikipedia.org/wiki/Differentiated_services>`_ value for the current
transaction. The ``<value>`` should be specified as a decimal integer.
+set-conn-mark
+~~~~~~~~~~~~~
+::
+
+ set-conn-mark <value>
+
+When invoked, sets the client side MARK value for the current
+transaction. The ``<value>`` should be specified as a decimal integer.
+Requires at least Linux 2.6.25.
+
set-debug
~~~~~~~~~
::
diff --git a/plugins/header_rewrite/factory.cc b/plugins/header_rewrite/factory.cc
index 2600471..1f27dc4 100644
--- a/plugins/header_rewrite/factory.cc
+++ b/plugins/header_rewrite/factory.cc
@@ -64,6 +64,8 @@ operator_factory(const std::string &op)
o = new OperatorAddCookie();
} else if (op == "set-conn-dscp") {
o = new OperatorSetConnDSCP();
+ } else if (op == "set-conn-mark") {
+ o = new OperatorSetConnMark();
} else if (op == "set-debug") {
o = new OperatorSetDebug();
} else {
diff --git a/plugins/header_rewrite/operators.cc b/plugins/header_rewrite/operators.cc
index fe143fc..24c7b91 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -925,6 +925,32 @@ OperatorSetConnDSCP::exec(const Resources &res) const
}
}
+// OperatorSetConnMark
+void
+OperatorSetConnMark::initialize(Parser &p)
+{
+ Operator::initialize(p);
+
+ _ds_value.set_value(p.get_arg());
+}
+
+void
+OperatorSetConnMark::initialize_hooks()
+{
+ add_allowed_hook(TS_HTTP_READ_REQUEST_HDR_HOOK);
+ add_allowed_hook(TS_HTTP_SEND_RESPONSE_HDR_HOOK);
+ add_allowed_hook(TS_REMAP_PSEUDO_HOOK);
+}
+
+void
+OperatorSetConnMark::exec(const Resources &res) const
+{
+ if (res.txnp) {
+ TSHttpTxnClientPacketMarkSet(res.txnp, _ds_value.get_int_value());
+ TSDebug(PLUGIN_NAME, " Setting MARK to %d", _ds_value.get_int_value());
+ }
+}
+
// OperatorSetDebug
void
OperatorSetDebug::initialize(Parser &p)
diff --git a/plugins/header_rewrite/operators.h b/plugins/header_rewrite/operators.h
index a07caf0..fda974a 100644
--- a/plugins/header_rewrite/operators.h
+++ b/plugins/header_rewrite/operators.h
@@ -312,6 +312,22 @@ private:
Value _ds_value;
};
+class OperatorSetConnMark : public Operator
+{
+public:
+ OperatorSetConnMark() { TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for OperatorSetConnMark"); }
+ void initialize(Parser &p);
+
+protected:
+ void initialize_hooks();
+ void exec(const Resources &res) const;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OperatorSetConnMark);
+
+ Value _ds_value;
+};
+
class OperatorSetDebug : public Operator
{
public:
--
To stop receiving notification emails like this one, please contact
sorber@apache.org.