You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Jason Strongman <ja...@gmail.com> on 2014/08/07 00:49:48 UTC

Re: ATS QOS

ATS 4.2.1.1
Mode - reverse proxy

Objective - To set DSCP of x value on an existing connection(client) once
User-Agent is determined.

It appears the code which sets the socket option on existing client
connections is found in - iocore/net/UnixConnection.cc.
And if I dig deeper it appears the socket option value is read from the
configuration parameter of 'proxy.config.net.sock_packet_tos_in'

So for reference some of the files of importance are:

##########

file - proxy/http/HttpProxyServerMain.cc

 REC_ReadConfigInteger(net_opt.packet_tos,
"proxy.config.net.sock_packet_tos_in");

file - iocore/net/UnixConnection.cc

  // Set options which can be changed after a connection is established
  // ignore other changes
...
...
#if TS_HAS_IP_TOS
  uint32_t tos = opt.packet_tos;
  safe_setsockopt(fd, IPPROTO_IP, IP_TOS, reinterpret_cast<char *>(&tos),
sizeof(uint32_t));
#endif


file - lib/ts/ink_config.h

#define TS_HAS_IP_TOS                  1

############

Now the problem is, I have tried setting
'proxy.config.net.sock_packet_tos_in' within records.config and the
response to the client connection doesnt seem to be updated as expected. Is
there something I am missing or misunderstanding? Once I get the param to
be recognized from within records.config, I will then try creating a
header_rewrite rule which will update the parameter upon reading the
user-agent value. Or using a lua script via 'ts.http.config_int_set'


Thanks!

Re: ATS QOS

Posted by Jason Strongman <ja...@gmail.com>.
As a follow up, I was able to set dscp using the below rewrite rule.

cond %{SEND_RESPONSE_HDR_HOOK}
cond %{CLIENT-HEADER:User-Agent} =foo
set-conn-dscp 184


corresponding pcaps displayed the expected.

Thanks!


On Fri, Aug 22, 2014 at 6:06 PM, Jason Strongman <
jasonstrongman2016@gmail.com> wrote:

>
> Thanks Jack! I created the below per your instruction.
>
>
>
> https://issues.apache.org/jira/browse/TS-3037
>
> Description
>
> Modify ATS to allow setting another socket option, SO_PRIORITY.
>
> This parameter should be set on new connections created by ATS. The
> parameter should also be set on responses back to clients.
>
> This parameter should also be set based on request or response conditions.
> So preferably allowing the parameter to be defined within the
> header_rewrite or lua plugins.
>
> This parameter should only impact layer 2 and should have no impacts on
> the layer 3 DSCP values.
>
>
>
> On Wed, Aug 20, 2014 at 2:09 PM, Jack Bates <du...@nottheoilrig.com>
> wrote:
>
>> On 13/08/14 08:31 AM, Jason Strongman wrote:
>>
>>> Do you know if ATS also allows for setting priority code point(PCP) as
>>> referenced in 'IEEE 802.1Q'
>>>
>>> I see PCP is controlled by SO_PRIORITY, but I dont see any reference to
>>> this option in the ATS code.
>>>
>>
>> Does the following plugin work for you?
>> http://nottheoilrig.com/trafficserver/201408200/priority.cc
>>
>> With it you should be able to set SO_PRIORITY based on the request
>> target. With a bit more work it could support additional criteria like the
>> user agent.
>>
>> Please open another issue in the issue tracker (
>> https://issues.apache.org/jira/browse/TS) if support for the priority
>> code point would make a useful addition to Traffic Server.
>> (Currently there's nothing related to it in Traffic Server.)
>>
>> To compile the plugin you should be able to use the tsxs command e.g.
>> $ tsxs -o priority.so priority.cc
>>
>> To configure it add lines like the following to remap.config:
>> map http://example.com http://example.com @plugin=priority.so @pparam=4
>> regex_map http://.*\.example.com http://$0 @plugin=priority.so @pparam=4
>>
>
>

Re: ATS QOS

Posted by Jason Strongman <ja...@gmail.com>.
Thanks Jack! I created the below per your instruction.



https://issues.apache.org/jira/browse/TS-3037

Description

Modify ATS to allow setting another socket option, SO_PRIORITY.

This parameter should be set on new connections created by ATS. The
parameter should also be set on responses back to clients.

This parameter should also be set based on request or response conditions.
So preferably allowing the parameter to be defined within the
header_rewrite or lua plugins.

This parameter should only impact layer 2 and should have no impacts on the
layer 3 DSCP values.



On Wed, Aug 20, 2014 at 2:09 PM, Jack Bates <du...@nottheoilrig.com> wrote:

> On 13/08/14 08:31 AM, Jason Strongman wrote:
>
>> Do you know if ATS also allows for setting priority code point(PCP) as
>> referenced in 'IEEE 802.1Q'
>>
>> I see PCP is controlled by SO_PRIORITY, but I dont see any reference to
>> this option in the ATS code.
>>
>
> Does the following plugin work for you?
> http://nottheoilrig.com/trafficserver/201408200/priority.cc
>
> With it you should be able to set SO_PRIORITY based on the request target.
> With a bit more work it could support additional criteria like the user
> agent.
>
> Please open another issue in the issue tracker (https://issues.apache.org/
> jira/browse/TS) if support for the priority code point would make a
> useful addition to Traffic Server.
> (Currently there's nothing related to it in Traffic Server.)
>
> To compile the plugin you should be able to use the tsxs command e.g.
> $ tsxs -o priority.so priority.cc
>
> To configure it add lines like the following to remap.config:
> map http://example.com http://example.com @plugin=priority.so @pparam=4
> regex_map http://.*\.example.com http://$0 @plugin=priority.so @pparam=4
>

Re: ATS QOS

Posted by Jack Bates <du...@nottheoilrig.com>.
On 13/08/14 08:31 AM, Jason Strongman wrote:
> Do you know if ATS also allows for setting priority code point(PCP) as
> referenced in 'IEEE 802.1Q'
>
> I see PCP is controlled by SO_PRIORITY, but I dont see any reference to
> this option in the ATS code.

Does the following plugin work for you?
http://nottheoilrig.com/trafficserver/201408200/priority.cc

With it you should be able to set SO_PRIORITY based on the request 
target. With a bit more work it could support additional criteria like 
the user agent.

Please open another issue in the issue tracker 
(https://issues.apache.org/jira/browse/TS) if support for the priority 
code point would make a useful addition to Traffic Server.
(Currently there's nothing related to it in Traffic Server.)

To compile the plugin you should be able to use the tsxs command e.g.
$ tsxs -o priority.so priority.cc

To configure it add lines like the following to remap.config:
map http://example.com http://example.com @plugin=priority.so @pparam=4
regex_map http://.*\.example.com http://$0 @plugin=priority.so @pparam=4

Re: ATS QOS

Posted by Jason Strongman <ja...@gmail.com>.
Thanks Jack for your response.

Do you know if ATS also allows for setting priority code point(PCP) as
referenced in 'IEEE 802.1Q'

I see PCP is controlled by SO_PRIORITY, but I dont see any reference to
this option in the ATS code.







On Sat, Aug 9, 2014 at 3:33 PM, Jack Bates <du...@nottheoilrig.com> wrote:

> On 06/08/14 03:49 PM, Jason Strongman wrote:
>
>> Now the problem is, I have tried setting
>> 'proxy.config.net.sock_packet_tos_in' within records.config and the
>> response to the client connection doesnt seem to be updated as expected.
>> Is there something I am missing or misunderstanding? Once I get the
>> param to be recognized from within records.config, I will then try
>> creating a header_rewrite rule which will update the parameter upon
>> reading the user-agent value. Or using a lua script via
>> 'ts.http.config_int_set'
>>
>
> I got the same result when I tried to reproduce this.
> I added CONFIG proxy.config.net.sock_packet_tos_in INT 12 to my
> records.config but the client response TOS/DSCP field remained 0x0
> I opened the following issue
> https://issues.apache.org/jira/browse/TS-2995
> Can you recompile Traffic Server from source?
> If so you can try applying the patch from that issue and recompiling.
> It fixed the issue for me
> (the client response TOS/DSCP field is now 0xc)
> Now I'm trying to set proxy.config.net.sock_packet_tos_in with the
> header_rewrite plugin.
>

Re: ATS QOS

Posted by Jack Bates <du...@nottheoilrig.com>.
On 06/08/14 03:49 PM, Jason Strongman wrote:
> Now the problem is, I have tried setting
> 'proxy.config.net.sock_packet_tos_in' within records.config and the
> response to the client connection doesnt seem to be updated as expected.
> Is there something I am missing or misunderstanding? Once I get the
> param to be recognized from within records.config, I will then try
> creating a header_rewrite rule which will update the parameter upon
> reading the user-agent value. Or using a lua script via
> 'ts.http.config_int_set'

I got the same result when I tried to reproduce this.
I added CONFIG proxy.config.net.sock_packet_tos_in INT 12 to my 
records.config but the client response TOS/DSCP field remained 0x0
I opened the following issue
https://issues.apache.org/jira/browse/TS-2995
Can you recompile Traffic Server from source?
If so you can try applying the patch from that issue and recompiling.
It fixed the issue for me
(the client response TOS/DSCP field is now 0xc)
Now I'm trying to set proxy.config.net.sock_packet_tos_in with the 
header_rewrite plugin.