along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: protocol.c,v 1.28.4.10 2000/06/27 12:58:04 guus Exp $
+ $Id: protocol.c,v 1.28.4.13 2000/06/28 11:38:00 guus Exp $
*/
#include "config.h"
{
cp
if(debug_lvl > 1)
- syslog(LOG_DEBUG, _("Sending DEL_HOST for " IP_ADDR_S " to " IP_ADDR_S " (%s)"),
- IP_ADDR_V(new_host->vpn_ip), IP_ADDR_V(cl->vpn_ip), cl->hostname);
+ syslog(LOG_DEBUG, _("Sending DEL_HOST for " IP_ADDR_S " (%s) to " IP_ADDR_S " (%s)"),
+ IP_ADDR_V(new_host->vpn_ip), new_host->hostname, IP_ADDR_V(cl->vpn_ip), cl->hostname);
buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx\n", DEL_HOST, new_host->vpn_ip);
if((write(fw->nexthop->meta_socket, buffer, buflen)) < 0)
{
- syslog(LOG_ERR, _("send failed: %s:%d: %m"), __FILE__, __LINE__);
+ syslog(LOG_ERR, _("Send failed: %s:%d: %m"), __FILE__, __LINE__);
return -1;
}
cp
{
syslog(LOG_ERR, _("Got bad BASIC_INFO from %s"),
cl->hostname);
- if(cl->status.outgoing)
- {
- /* If we get here, it means that our uplink uses the wrong protocol.
- If we don't do anything, we will reconnect every 5 seconds. Pretty dumb.
- So we disable the outgoing flag, so that we won't reconnect anymore.
- This still allows other tinc daemons to connect to us.
- */
- syslog(LOG_ERR, _("Warning: disabling uplink!"));
- cl->status.outgoing = 0;
- }
return -1;
}
old connection that has timed out but we don't know it yet. Because our
conn_list entry is not active, lookup_conn will skip ourself. */
- while(old=lookup_conn(cl->vpn_ip))
+ while(old = lookup_conn(cl->vpn_ip))
terminate_connection(old);
cl->status.active = 1;
cl->status.active = 1;
syslog(LOG_NOTICE, _("Connection with " IP_ADDR_S " (%s) activated"),
IP_ADDR_V(cl->vpn_ip), cl->hostname);
+ upstreamindex = 0;
cp
return 0;
}
return -1;
}
- if(debug_lvl > 1)
- syslog(LOG_DEBUG, _("Got DEL_HOST for " IP_ADDR_S " from " IP_ADDR_S " (%s)"),
- IP_ADDR_V(vpn_ip), IP_ADDR_V(cl->vpn_ip), cl->hostname);
-
if(!(fw = lookup_conn(vpn_ip)))
{
syslog(LOG_ERR, _("Got DEL_HOST for " IP_ADDR_S " from " IP_ADDR_S " (%s) which does not exist?"),
return 0;
}
+ if(debug_lvl > 1)
+ syslog(LOG_DEBUG, _("Got DEL_HOST for " IP_ADDR_S " (%s) from " IP_ADDR_S " (%s)"),
+ IP_ADDR_V(fw->vpn_ip), fw->hostname, IP_ADDR_V(cl->vpn_ip), cl->hostname);
+
notify_others(fw, cl, send_del_host);
fw->status.termreq = 1;
ip_t vpn_mask;
unsigned short port;
int flags;
- conn_list_t *ncn, *fw;
+ conn_list_t *ncn, *old;
cp
if(!cl->status.active)
{
return -1;
}
- /*
- Suggestion of Hans Bayle
- */
- if((fw = lookup_conn(vpn_ip)))
- {
- if(fw->nexthop == cl)
- notify_others(fw, cl, send_add_host);
- else
- syslog(LOG_DEBUG, _("Invalid ADD_HOST from " IP_ADDR_S " (%s)"),
- IP_ADDR_V(cl->vpn_ip), cl->hostname);
- return -1;
- }
-
+ while(old = lookup_conn(vpn_ip))
+ terminate_connection(old);
+
ncn = new_conn_list();
ncn->real_ip = real_ip;
ncn->hostname = hostlookup(htonl(real_ip));