projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes some hostlookups. Fixes indirectdata for real now (hopefully).
[tinc]
/
src
/
net.c
diff --git
a/src/net.c
b/src/net.c
index
1fee46b
..
72d7bfb
100644
(file)
--- a/
src/net.c
+++ b/
src/net.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: net.c,v 1.35.4.
3 2000/06/25 15:16:11
guus Exp $
+ $Id: net.c,v 1.35.4.
6 2000/06/26 17:20:58
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-535,7
+535,8
@@
int setup_outgoing_connection(ip_t ip)
cp
ncn = new_conn_list();
ncn->real_ip = ip;
cp
ncn = new_conn_list();
ncn->real_ip = ip;
-
+ ncn->hostname = hostlookup(htonl(ip));
+
if(setup_outgoing_meta_socket(ncn) < 0)
{
syslog(LOG_ERR, _("Could not set up a meta connection!"));
if(setup_outgoing_meta_socket(ncn) < 0)
{
syslog(LOG_ERR, _("Could not set up a meta connection!"));
@@
-567,6
+568,7
@@
cp
}
myself->vpn_ip = cfg->data.ip->ip;
}
myself->vpn_ip = cfg->data.ip->ip;
+ myself->hostname = hostlookup(htonl(myself->vpn_ip));
myself->vpn_mask = cfg->data.ip->mask;
myself->flags = 0;
myself->vpn_mask = cfg->data.ip->mask;
myself->flags = 0;
@@
-754,14
+756,15
@@
cp
}
p->real_ip = ntohl(ci.sin_addr.s_addr);
}
p->real_ip = ntohl(ci.sin_addr.s_addr);
+ p->hostname = hostlookup(ci.sin_addr.s_addr);
p->meta_socket = sfd;
p->status.meta = 1;
p->buflen = 0;
p->last_ping_time = time(NULL);
p->want_ping = 0;
p->meta_socket = sfd;
p->status.meta = 1;
p->buflen = 0;
p->last_ping_time = time(NULL);
p->want_ping = 0;
- syslog(LOG_NOTICE, _("Connection from
" IP_ADDR_S ":
%d"),
-
IP_ADDR_V(p->real_ip)
, htons(ci.sin_port));
+ syslog(LOG_NOTICE, _("Connection from
%s port
%d"),
+
p->hostname
, htons(ci.sin_port));
if(send_basic_info(p) < 0)
{
if(send_basic_info(p) < 0)
{
@@
-873,8
+876,8
@@
cp
return;
if(debug_lvl > 0)
return;
if(debug_lvl > 0)
- syslog(LOG_NOTICE, _("Closing connection with " IP_ADDR_S " (
" IP_ADDR_S "
)"),
- IP_ADDR_V(cl->vpn_ip),
IP_ADDR_V(cl->real_ip)
);
+ syslog(LOG_NOTICE, _("Closing connection with " IP_ADDR_S " (
%s
)"),
+ IP_ADDR_V(cl->vpn_ip),
cl->hostname
);
if(cl->status.timeout)
send_timeout(cl);
if(cl->status.timeout)
send_timeout(cl);
@@
-943,8
+946,8
@@
cp
if(p->status.pinged && !p->status.got_pong)
{
if(debug_lvl > 1)
if(p->status.pinged && !p->status.got_pong)
{
if(debug_lvl > 1)
- syslog(LOG_INFO, _(IP_ADDR_S " (
" IP_ADDR_S "
) didn't respond to ping"),
- IP_ADDR_V(p->vpn_ip),
IP_ADDR_V(p->real_ip)
);
+ syslog(LOG_INFO, _(IP_ADDR_S " (
%s
) didn't respond to ping"),
+ IP_ADDR_V(p->vpn_ip),
p->hostname
);
p->status.timeout = 1;
terminate_connection(p);
}
p->status.timeout = 1;
terminate_connection(p);
}
@@
-1047,28
+1050,28
@@
cp
if(cl->reqlen)
{
if(debug_lvl > 2)
if(cl->reqlen)
{
if(debug_lvl > 2)
- syslog(LOG_DEBUG, _("Got request from " IP_ADDR_S " (
" IP_ADDR_S "
): %s"),
- IP_ADDR_V(cl->vpn_ip),
IP_ADDR_V(cl->real_ip)
, cl->buffer);
+ syslog(LOG_DEBUG, _("Got request from " IP_ADDR_S " (
%s
): %s"),
+ IP_ADDR_V(cl->vpn_ip),
cl->hostname
, cl->buffer);
if(sscanf(cl->buffer, "%d", &request) == 1)
{
if((request < 0) || (request > 255) || (request_handlers[request] == NULL))
{
if(sscanf(cl->buffer, "%d", &request) == 1)
{
if((request < 0) || (request > 255) || (request_handlers[request] == NULL))
{
- syslog(LOG_ERR, _("Unknown request from " IP_ADDR_S " (
" IP_ADDR_S "
)"),
- IP_ADDR_V(cl->vpn_ip),
IP_ADDR_V(cl->real_ip)
);
+ syslog(LOG_ERR, _("Unknown request from " IP_ADDR_S " (
%s
)"),
+ IP_ADDR_V(cl->vpn_ip),
cl->hostname
);
return -1;
}
if(request_handlers[request](cl)) /* Something went wrong. Probably scriptkiddies. Terminate. */
{
return -1;
}
if(request_handlers[request](cl)) /* Something went wrong. Probably scriptkiddies. Terminate. */
{
- syslog(LOG_ERR, _("Error while processing request from " IP_ADDR_S " (
" IP_ADDR_S "
)"),
- IP_ADDR_V(cl->vpn_ip),
IP_ADDR_V(cl->real_ip)
);
+ syslog(LOG_ERR, _("Error while processing request from " IP_ADDR_S " (
%s
)"),
+ IP_ADDR_V(cl->vpn_ip),
cl->hostname
);
return -1;
}
}
else
{
return -1;
}
}
else
{
- syslog(LOG_ERR, _("Bogus data received from " IP_ADDR_S " (
" IP_ADDR_S "
)"),
- IP_ADDR_V(cl->vpn_ip),
IP_ADDR_V(cl->real_ip)
);
+ syslog(LOG_ERR, _("Bogus data received from " IP_ADDR_S " (
%s
)"),
+ IP_ADDR_V(cl->vpn_ip),
cl->hostname
);
return -1;
}
return -1;
}