Added the option to manually specify which htb node/parent an identity should be...
[distributedratelimiting.git] / drl / config.c
index d9d9ede..261ce0c 100644 (file)
@@ -113,6 +113,8 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) {
     xmlChar *mainloop_intervals;
     xmlChar *communication_intervals;
     xmlChar *independent;
+    xmlChar *htb_node;
+    xmlChar *htb_parent;
     xmlNodePtr fields = ident->children;
     ident_peer *current = NULL;
 
@@ -266,6 +268,21 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) {
         xmlFree(independent);
     }
 
+    htb_node = xmlGetProp(ident, (const xmlChar *) "htb_node");
+    htb_parent = xmlGetProp(ident, (const xmlChar *) "htb_parent");
+    if (htb_node == NULL) {
+        common->htb_node = -1;
+    } else {
+        sscanf((const char *)htb_node, "%x", &common->htb_node);
+        xmlFree(htb_node);
+    }
+    if (htb_parent == NULL) {
+        common->htb_parent = -1;
+    } else {
+        sscanf((const char *)htb_parent, "%x", &common->htb_parent);
+        xmlFree(htb_parent);
+    }
+
     while (fields != NULL) {
         if((!xmlStrcmp(fields->name, (const xmlChar *) "peer"))) {
             xmlChar *ip = xmlNodeListGetString(doc, fields->children, 1);