+ char subnetstr[MAX_STRING_SIZE];
+ char name[MAX_STRING_SIZE];
+ node_t *owner;
+ connection_t *other;
+ subnet_t *s, *find;
+ avl_node_t *node;
+cp
+ if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING, name, subnetstr) != 3)
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_SUBNET", c->name, c->hostname);
+ return -1;
+ }
+
+ /* Check if owner name is a valid */
+
+ if(check_id(name))
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_SUBNET", c->name, c->hostname, _("invalid name"));
+ return -1;
+ }
+
+ /* Check if the owner of the new subnet is in the connection list */
+
+ if(!(owner = lookup_node(name)))
+ {
+ syslog(LOG_ERR, _("Got %s from %s (%s) for %s which is not in our connection list"),
+ "DEL_SUBNET", c->name, c->hostname, name);
+ return -1;
+ }
+
+ /* Check if subnet string is valid */
+
+ if(!(s = str2net(subnetstr)))
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s): %s"), "DEL_SUBNET", c->name, c->hostname, _("invalid subnet string"));
+ return -1;
+ }
+
+ /* If everything is correct, delete the subnet from the list of the owner */
+
+ find = lookup_subnet(owner, s);
+
+ free_subnet(s);
+
+ if(!find)
+ {
+ syslog(LOG_ERR, _("Got %s from %s (%s) for %s which does not appear in his subnet tree"),
+ "DEL_SUBNET", c->name, c->hostname, name);
+ return -1;
+ }
+
+ subnet_del(owner, find);
+
+ /* Tell the rest */
+
+ for(node = connection_tree->head; node; node = node->next)
+ {
+ other = (connection_t *)node->data;
+ if(other->status.active && other != c)
+ send_del_subnet(other, s);
+ }
+cp
+ return 0;