------------------------------------------------------------ revno: 13356 revision-id: chtsanti@users.sourceforge.net-20140414170118-3kj7mhn8ro1qkugf parent: kinkie@squid-cache.org-20140414135027-oa4n03luzbvt2hcr committer: Christos Tsantilas branch nick: trunk timestamp: Mon 2014-04-14 20:01:18 +0300 message: author: Alex Rousskov Encapsulated commonly reused ToS and NfMark code into GetMarkingsToServer() ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: chtsanti@users.sourceforge.net-20140414170118-\ # 3kj7mhn8ro1qkugf # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 901ba6c103d50063fa40582ab2f650869ecb4e63 # timestamp: 2014-04-14 17:53:48 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: kinkie@squid-cache.org-20140414135027-\ # oa4n03luzbvt2hcr # # Begin patch === modified file 'src/FwdState.cc' --- src/FwdState.cc 2014-03-31 06:57:27 +0000 +++ src/FwdState.cc 2014-04-14 17:01:18 +0000 @@ -1191,18 +1191,7 @@ entry->mem_obj->checkUrlChecksum(); #endif - /* Get the server side TOS and Netfilter mark to be set on the connection. */ - if (Ip::Qos::TheConfig.isAclTosActive()) { - serverDestinations[0]->tos = GetTosToServer(request); - } -#if SO_MARK && USE_LIBCAP - serverDestinations[0]->nfmark = GetNfmarkToServer(request); - debugs(17, 3, "fwdConnectStart: got outgoing addr " << serverDestinations[0]->local << ", tos " << int(serverDestinations[0]->tos) - << ", netfilter mark " << serverDestinations[0]->nfmark); -#else - serverDestinations[0]->nfmark = 0; - debugs(17, 3, "fwdConnectStart: got outgoing addr " << serverDestinations[0]->local << ", tos " << int(serverDestinations[0]->tos)); -#endif + GetMarkingsToServer(request, *serverDestinations[0]); calls.connector = commCbCall(17,3, "fwdConnectDoneWrapper", CommConnectCbPtrFun(fwdConnectDoneWrapper, this)); Comm::ConnOpener *cs = new Comm::ConnOpener(serverDestinations[0], calls.connector, ctimeout); @@ -1584,3 +1573,20 @@ ACLFilledChecklist ch(NULL, request, NULL); return aclMapNfmark(Ip::Qos::TheConfig.nfmarkToServer, &ch); } + +void +GetMarkingsToServer(HttpRequest * request, Comm::Connection &conn) +{ + // Get the server side TOS and Netfilter mark to be set on the connection. + if (Ip::Qos::TheConfig.isAclTosActive()) { + conn.tos = GetTosToServer(request); + debugs(17, 3, "from " << conn.local << " tos " << int(conn.tos)); + } + +#if SO_MARK && USE_LIBCAP + conn.nfmark = GetNfmarkToServer(request); + debugs(17, 3, "from " << conn.local << " netfilter mark " << conn.nfmark); +#else + conn.nfmark = 0; +#endif +} === modified file 'src/FwdState.h' --- src/FwdState.h 2014-03-30 12:00:34 +0000 +++ src/FwdState.h 2014-04-14 17:01:18 +0000 @@ -39,6 +39,9 @@ */ nfmark_t GetNfmarkToServer(HttpRequest * request); +/// Sets initial TOS value and Netfilter for the future outgoing connection. +void GetMarkingsToServer(HttpRequest * request, Comm::Connection &conn); + class HelperReply; class FwdState : public RefCountable === modified file 'src/tunnel.cc' --- src/tunnel.cc 2014-02-21 10:46:19 +0000 +++ src/tunnel.cc 2014-04-14 17:01:18 +0000 @@ -777,15 +777,7 @@ tunnelState->serverDestinations.erase(tunnelState->serverDestinations.begin()); if (status != COMM_TIMEOUT && tunnelState->serverDestinations.size() > 0) { /* Try another IP of this destination host */ - - if (Ip::Qos::TheConfig.isAclTosActive()) { - tunnelState->serverDestinations[0]->tos = GetTosToServer(tunnelState->request.getRaw()); - } - -#if SO_MARK && USE_LIBCAP - tunnelState->serverDestinations[0]->nfmark = GetNfmarkToServer(tunnelState->request.getRaw()); -#endif - + GetMarkingsToServer(tunnelState->request.getRaw(), *tunnelState->serverDestinations[0]); debugs(26, 4, HERE << "retry with : " << tunnelState->serverDestinations[0]); AsyncCall::Pointer call = commCbCall(26,3, "tunnelConnectDone", CommConnectCbPtrFun(tunnelConnectDone, tunnelState)); Comm::ConnOpener *cs = new Comm::ConnOpener(tunnelState->serverDestinations[0], call, Config.Timeout.connect); @@ -974,13 +966,7 @@ } delete err; - if (Ip::Qos::TheConfig.isAclTosActive()) { - tunnelState->serverDestinations[0]->tos = GetTosToServer(tunnelState->request.getRaw()); - } - -#if SO_MARK && USE_LIBCAP - tunnelState->serverDestinations[0]->nfmark = GetNfmarkToServer(tunnelState->request.getRaw()); -#endif + GetMarkingsToServer(tunnelState->request.getRaw(), *tunnelState->serverDestinations[0]); debugs(26, 3, HERE << "paths=" << peer_paths->size() << ", p[0]={" << (*peer_paths)[0] << "}, serverDest[0]={" << tunnelState->serverDestinations[0] << "}");