face: allow enabling/disabling congestion marking through config file

refs #4465

Change-Id: I888b83b1fdbe8e3fc36a902bf7af52147807d829
diff --git a/daemon/face/face-system.cpp b/daemon/face/face-system.cpp
index 6288ac0..6430796 100644
--- a/daemon/face/face-system.cpp
+++ b/daemon/face/face-system.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -89,6 +89,21 @@
   ConfigContext context;
   context.isDryRun = isDryRun;
 
+  // process general protocol factory config section
+  auto generalSection = configSection.get_child_optional("general");
+  if (generalSection) {
+    for (const auto& pair : *generalSection) {
+      const std::string& key = pair.first;
+      if (key == "enable_congestion_marking") {
+        // false by default
+        context.generalConfig.wantCongestionMarking = ConfigFile::parseYesNo(pair, "face_system.general");
+      }
+      else {
+        BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.general." + key));
+      }
+    }
+  }
+
   // process sections in protocol factories
   for (const auto& pair : m_factories) {
     const std::string& sectionName = pair.first;
@@ -123,7 +138,7 @@
       BOOST_THROW_EXCEPTION(ConfigFile::Error("Duplicate section face_system." + sectionName));
     }
 
-    if (m_factories.count(sectionName) > 0) {
+    if (sectionName == "general" || m_factories.count(sectionName) > 0) {
       continue;
     }