/*
- * Copyright (C) 2015-2016 Tobias Brunner
+ * Copyright (C) 2015-2017 Tobias Brunner
* Copyright (C) 2011-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
entry_t *entry;
bool found = FALSE, success;
+ if (!ns)
+ {
+ DBG1(DBG_CFG, "missing namespace for shunt policy '%s'",
+ cfg->get_name(cfg));
+ return FALSE;
+ }
+
/* check if not already installed */
this->lock->write_lock(this->lock);
if (this->installing == INSTALL_DISABLED)
return TRUE;
}
INIT(entry,
- .ns = strdupnull(ns),
+ .ns = strdup(ns),
.cfg = cfg->get_ref(cfg),
);
this->shunts->insert_last(this->shunts, entry);
enumerator = this->shunts->create_enumerator(this->shunts);
while (enumerator->enumerate(enumerator, &entry))
{
- if (streq(ns, entry->ns) &&
+ if ((!ns || streq(ns, entry->ns)) &&
streq(name, entry->cfg->get_name(entry->cfg)))
{
this->shunts->remove_at(this->shunts, enumerator);
/*
- * Copyright (C) 2015-2016 Tobias Brunner
+ * Copyright (C) 2015-2017 Tobias Brunner
* Copyright (C) 2011 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
/**
* Install a policy as a shunt.
*
- * @param ns optional namespace (e.g. name of a connection or
- * plugin), cloned
+ * @param ns namespace (e.g. name of a connection or plugin), cloned
* @param child child configuration to install as a shunt
* @return TRUE if installed successfully
*/
/**
* Uninstall a shunt policy.
*
- * @param ns namespace (same as given during installation)
+ * If no namespace is given the first matching child configuration is
+ * removed.
+ *
+ * @param ns namespace (same as given during installation) or NULL
* @param name name of child configuration to uninstall as a shunt
* @return TRUE if uninstalled successfully
*/