projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Documents are merged. Now we only need to check the ports and the TCPonly
[tinc]
/
src
/
net.c
diff --git
a/src/net.c
b/src/net.c
index
c3f89ca
..
4db639c
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.10
5 2001/05/07 19:08:43
guus Exp $
+ $Id: net.c,v 1.35.4.10
8 2001/05/25 11:54:28
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-184,6
+184,17
@@
cp
cp
}
cp
}
+void receive_tcppacket(connection_t *cl, char *buffer, int len)
+{
+ vpn_packet_t outpkt;
+cp
+ outpkt.len = len;
+ memcpy(outpkt.data, buffer, len);
+
+ receive_packet(cl, &outpkt);
+cp
+}
+
void accept_packet(vpn_packet_t *packet)
{
cp
void accept_packet(vpn_packet_t *packet)
{
cp
@@
-203,7
+214,7
@@
cp
if(write(tap_fd, packet->data - 2, packet->len + 2) < 0)
syslog(LOG_ERR, _("Can't write to ethertap device: %m"));
else
if(write(tap_fd, packet->data - 2, packet->len + 2) < 0)
syslog(LOG_ERR, _("Can't write to ethertap device: %m"));
else
- total_tap_out += packet->len
+ 2
;
+ total_tap_out += packet->len;
}
cp
}
}
cp
}
@@
-285,7
+296,7
@@
cp
{
#ifdef HAVE_LINUX
# ifdef HAVE_TUNTAP
{
#ifdef HAVE_LINUX
# ifdef HAVE_TUNTAP
- tapfname = "/dev/
misc/
net/tun";
+ tapfname = "/dev/net/tun";
# else
tapfname = "/dev/tap0";
# endif
# else
tapfname = "/dev/tap0";
# endif
@@
-848,11
+859,13
@@
cp
cfg = get_config_val(upstreamcfg, config_connectto);
if(!cfg)
cfg = get_config_val(upstreamcfg, config_connectto);
if(!cfg)
- if(upstreamcfg == config)
{
{
- /* No upstream IP given, we're listen only. */
- signal(SIGALRM, SIG_IGN);
- return;
+ if(upstreamcfg == config)
+ {
+ /* No upstream IP given, we're listen only. */
+ signal(SIGALRM, SIG_IGN);
+ return;
+ }
}
else
{
}
else
{
@@
-1075,6
+1088,8
@@
cp
return;
}
return;
}
+ cl->last_ping_time = time(NULL);
+
receive_udppacket(cl, &pkt);
cp
}
receive_udppacket(cl, &pkt);
cp
}
@@
-1147,7
+1162,7
@@
cp
syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in 5 seconds"));
}
syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in 5 seconds"));
}
- /*
In
activate */
+ /*
De
activate */
cl->status.active = 0;
cp
cl->status.active = 0;
cp
@@
-1286,7
+1301,7
@@
cp
vp.len = lenin - 2;
}
vp.len = lenin - 2;
}
- total_tap_in +=
leni
n;
+ total_tap_in +=
vp.le
n;
if(lenin < 32)
{
if(lenin < 32)
{