+ if(!from)
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_EDGE", c->name, c->hostname, _("unknown node"));
+ return -1;
+ }
+
+ to = lookup_node(to_name);
+
+ if(!to)
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ADD_EDGE", c->name, c->hostname, _("unknown node"));
+ return -1;
+ }
+
+ /* Check if edge already exists */
+
+ e = lookup_edge(from, to);
+
+ if(e)
+ {
+ if(e->weight != weight || e->options != options)
+ {
+ syslog(LOG_ERR, _("Got %s from %s (%s) which does not match existing entry"), "ADD_EDGE", c->name, c->hostname);
+ return -1;
+ }
+
+ return 0;
+ }
+ else
+ {
+ e = new_edge();
+ e->from = from;
+ e->to = to;
+ e->options = options;
+ e->weight = weight;
+ edge_add(e);
+ }
+
+ /* Tell the rest about the new edge */
+
+ for(node = connection_tree->head; node; node = node->next)
+ {
+ other = (connection_t *)node->data;
+ if(other->status.active && other != c)
+ send_add_edge(other, e);
+ }
+
+ /* Run MST before or after we tell the rest? */
+
+ mst_kruskal();
+ sssp_bfs(0);
+cp
+ return 0;
+}
+
+int send_del_edge(connection_t *c, edge_t *e)
+{
+cp
+ return send_request(c, "%d %s %s %lx %d", DEL_EDGE,
+ e->from->name, e->to->name, e->options, e->weight);
+}
+
+int del_edge_h(connection_t *c)
+{
+ edge_t *e;
+ char from_name[MAX_STRING_SIZE];
+ char to_name[MAX_STRING_SIZE];
+ node_t *from, *to;
+ long int options;
+ int weight;
+ connection_t *other;
+ avl_node_t *node;
+cp
+ if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" %lx %d", from_name, to_name, &options, &weight) != 4)
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_EDGE",
+ c->name, c->hostname);
+ return -1;
+ }
+
+ /* Check if names are valid */
+
+ if(check_id(from_name))
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_EDGE", c->name, c->hostname, _("invalid name"));
+ return -1;
+ }
+
+ if(check_id(to_name))
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_EDGE", c->name, c->hostname, _("invalid name"));
+ return -1;
+ }
+
+ /* Lookup nodes */
+
+ from = lookup_node(from_name);