Skip to content

Commit

Permalink
[Server] Move pmark directive from xrd to xrootd for better consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 authored and gganis committed Nov 23, 2021
1 parent 30f6425 commit c1f82f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
11 changes: 0 additions & 11 deletions src/Xrd/XrdConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@

#include "XrdNet/XrdNetAddr.hh"
#include "XrdNet/XrdNetIF.hh"
#include "XrdNet/XrdNetPMarkCfg.hh"
#include "XrdNet/XrdNetSecurity.hh"
#include "XrdNet/XrdNetUtils.hh"

Expand Down Expand Up @@ -731,15 +730,6 @@ int XrdConfig::Configure(int argc, char **argv)
//
if (!NoGo) Manifest(pidFN);

// Initialize the packet marking framework if configured
//
if (!NoGo)
{bool bad = false;
XrdNetPMark *pmark = XrdNetPMarkCfg::Config(&Log,&Sched,&XrdTrace,bad);
if (pmark) theEnv.PutPtr("XrdNetPMark*", pmark);
else if (bad) NoGo = 1;
}

// Now initialize the protocols and other stuff
//
if (!NoGo) NoGo = Setup(dfltProt, libProt);
Expand Down Expand Up @@ -814,7 +804,6 @@ int XrdConfig::ConfigXeq(char *var, XrdOucStream &Config, XrdSysError *eDest)
TS_Xeq("allow", xallow);
TS_Xeq("homepath", xhpath);
TS_Xeq("pidpath", xpidf);
TS_Xeq("pmark", XrdNetPMarkCfg::Parse);
TS_Xeq("port", xport);
TS_Xeq("protocol", xprot);
TS_Xeq("report", xrep);
Expand Down
18 changes: 14 additions & 4 deletions src/XrdXrootd/XrdXrootdConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "XrdSfs/XrdSfsFlags.hh"
#include "XrdSfs/XrdSfsInterface.hh"
#include "XrdNet/XrdNetOpts.hh"
#include "XrdNet/XrdNetPMarkCfg.hh"
#include "XrdNet/XrdNetSocket.hh"
#include "XrdOuc/XrdOuca2x.hh"
#include "XrdOuc/XrdOucEnv.hh"
Expand Down Expand Up @@ -226,6 +227,17 @@ int XrdXrootdProtocol::Configure(char *parms, XrdProtocol_Config *pi)
if (rdf && Config(rdf)) return 0;
if (pi->DebugON) XrdXrootdTrace.What = TRACE_ALL;

// Initialize the packet marking framework if configured. We do that here as
// nothing else following this code can fail but we can so be consistent.
//
bool bad = false;
PMark = XrdNetPMarkCfg::Config(&eDest, pi->Sched, &XrdXrootdTrace, bad);
if (PMark)
{if (pi->theEnv) pi->theEnv->PutPtr("XrdNetPMark*", PMark);
xrootdEnv.PutPtr("XrdNetPMark*", PMark);
}
else if (bad) return 0;

// Check if we are exporting a generic object name
//
if (XPList.Opts() & XROOTDXP_NOSLASH)
Expand Down Expand Up @@ -272,10 +284,6 @@ int XrdXrootdProtocol::Configure(char *parms, XrdProtocol_Config *pi)
//
if (pi->theEnv) xrootdEnv.PutPtr("xrdEnv*", pi->theEnv);

// If packet marking was enabled, record the environment
//
PMark = (XrdNetPMark*)(pi->theEnv->GetPtr("XrdNetPMark*"));

// Initialize monitoring (it won't do anything if it wasn't enabled). This
// needs to be done before we load any plugins as plugins may need monitoring.
//
Expand Down Expand Up @@ -503,6 +511,7 @@ int XrdXrootdProtocol::Configure(char *parms, XrdProtocol_Config *pi)
/******************************************************************************/

#define TS_Xeq(x,m) (!strcmp(x,var)) GoNo = m(Config)
#define TS_Zeq(x,m) (!strcmp(x,var)) GoNo = m(&eDest, Config)

int XrdXrootdProtocol::Config(const char *ConfigFN)
{
Expand Down Expand Up @@ -541,6 +550,7 @@ int XrdXrootdProtocol::Config(const char *ConfigFN)
else if TS_Xeq("log", xlog);
else if TS_Xeq("mongstream", xmongs);
else if TS_Xeq("monitor", xmon);
else if TS_Zeq("pmark", XrdNetPMarkCfg::Parse);
else if TS_Xeq("prep", xprep);
else if TS_Xeq("redirect", xred);
else if TS_Xeq("seclib", xsecl);
Expand Down

0 comments on commit c1f82f9

Please sign in to comment.