Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
proxy.config.net.sock_packet_tos_in has no effect if proxy.config.accept_threads is not zero.
If it is zero then UnixNetProcessor::accept_internal() calls NetAccept::init_accept_per_thread() which eventually calls NetAccept::acceptFastEvent() in which there's code to set the SO_MARK and IP_TOS socket options.
But if it's not zero then UnixNetProcessor::accept_internal() instead calls NetAccept::init_accept_loop() which eventually calls NetAccept::do_blocking_accept()
One fix is to copy the code to set the SO_MARK and IP_TOS socket options from NetAccept::acceptFastEvent() to NetAccept::do_blocking_accept()
--- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -275,6 +275,18 @@ NetAccept::do_blocking_accept(EThread * t) return -1; } +#if TS_HAS_SO_MARK + if (packet_mark != 0) { + safe_setsockopt(con.fd, SOL_SOCKET, SO_MARK, reinterpret_cast<char *>(& + } +#endif + +#if TS_HAS_IP_TOS + if (packet_tos != 0) { + safe_setsockopt(con.fd, IPPROTO_IP, IP_TOS, reinterpret_cast<char *>(&p + } +#endif + // Use 'NULL' to Bypass thread allocator vc = (UnixNetVConnection *)this->getNetProcessor()->allocate_vc(NULL); if (!vc) {
I tested this change and verified that proxy.config.net.sock_packet_tos_in does correctly set the TOS/DSCP field.
This issue was reported by Jason Strongman on the users list http://thread.gmane.org/gmane.comp.apache.trafficserver.user/4141/focus=4202
proxy.config.net.sock_packet_tos_in was introduced in TS-1090 and commit b77838991531d6cb402618c3d690b83e95b92d63