+ /* Check if identity is a valid name */
+
+ if(check_id(name))
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_NODE", c->name, c->hostname, _("invalid name"));
+ return -1;
+ }
+
+ /* Check if node already exists */
+
+ n = lookup_node(name);
+
+ if(n)
+ {
+ /* Check if it matches */
+
+ if(n->address != address || n->port != port)
+ syslog(LOG_DEBUG, _("Got %s from %s (%s) for %s which does not match existing entry"), "ADD_NODE", c->name, c->hostname, n->name);
+
+ return 0;
+ }
+ else
+ {
+ n = new_node();
+ n->name = xstrdup(name);
+ n->address = address;
+ n->port = port;
+ node_add(n);
+ }
+
+ /* Tell the rest about the new node */
+
+ for(node = connection_tree->head; node; node = node->next)
+ {
+ other = (connection_t *)node->data;
+ if(other->status.active && other !=c)
+ send_add_node(other, n);
+ }
+
+cp
+ return 0;
+}
+
+int send_del_node(connection_t *c, node_t *n)
+{
+cp
+ return send_request(c, "%d %s %lx:%d", DEL_NODE,
+ n->name, n->address, n->port);
+}