-int del_subnet_h(conn_list_t *cl)
-{
-}
-
-/* New and closed connections notification */
-
-int send_add_host(conn_list_t *cl, conn_list_t *other)
-{
-cp
- return send_request(cl, "%d %s %lx:%d %s", ADD_HOST, other->id, other->address, other->port, opt2str(other->options));
-}
-
-int add_host_h(conn_list_t *cl)
-{
- char *options;
- conn_list_t *old, *new;
-cp
- new = new_conn_list();
-
- if(sscanf(cl->buffer, "%*d %as %lx:%d %as", &new->id, &new->address, &new->port, &options) != 4)
- {
- syslog(LOG_ERR, _("Got bad ADD_HOST from %s (%s)"), cl->id, cl->hostname);
- return -1;
- }
-
- /* Check if option string is valid */
-
- if((new->options = str2opt(options) == -1)
- {
- syslog(LOG_ERR, _("Got bad ADD_HOST from %s (%s): invalid option string"), cl->hostname);
- return -1;
- }
-
- /* Check if identity is a valid name */
-
- if(!check_id(new->id))
- {
- syslog(LOG_ERR, _("Got bad ADD_HOST from %s (%s): invalid identity name"), cl->id, cl->hostname);
- return -1;
- }
-
- /* Check if somebody tries to add ourself */
-
- if(!strcmp(new->id, myself->id))
- {
- syslog(LOG_ERR, _("Warning: got ADD_HOST from %s (%s) for ourself, restarting"), cl->id, cl->hostname);
- sighup = 1;
- return 0;
- }
-
- /* Fill in more of the new conn_list structure */
-
- new->hostname = hostlookup(htonl(new->address));
-
- /* Check if the new host already exists in the connnection list */
-
- if((old = lookup_id(id))
- {
- if((new->address == old->address) && (new->port == old->port))
- {
- if(debug_lvl > DEBUG_CONNECTIONS)
- syslog(LOG_NOTICE, _("Got duplicate ADD_HOST for %s (%s) from %s (%s)"), old->id, old->hostname, new->id, new->hostname);
- return 0;
- }
- else
- {
- if(debug_lvl > DEBUG_CONNECTIONS)
- syslog(LOG_NOTICE, _("Removing old entry for %s (%s)"), old->id, old->hostname);
- old->status.active = 0;
- terminate_connection(old);
- }
- }
-
- /* Fill in rest of conn_list structure */
-
- new->nexthop = cl;
- new->status.active = 1;
-
- /* Hook it up into the conn_list */
-
- conn_list_add(conn_list, new);
-
- /* Tell the rest about the new host */
-
- notify_others(new, cl, send_add_host);
-
-cp
- return 0;
-}