projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Include linux/sockios.h and net/if.h anyway, regardless of the value of HAVE_TUNTAP.
[tinc]
/
src
/
net.c
diff --git
a/src/net.c
b/src/net.c
index
4baefe5
..
47c185d
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.4
2 2000/10/20 19:46:57 guus
Exp $
+ $Id: net.c,v 1.35.4.4
4 2000/10/22 13:37:15 zarq
Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-25,6
+25,8
@@
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
+#include <linux/sockios.h>
+#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
@@
-38,8
+40,6
@@
#include <unistd.h>
#ifdef HAVE_TUNTAP
#include <unistd.h>
#ifdef HAVE_TUNTAP
-#include <net/if.h>
-#include <linux/sockios.h>
#include LINUX_IF_TUN_H
#endif
#include LINUX_IF_TUN_H
#endif
@@
-104,7
+104,7
@@
cp
EVP_EncryptFinal(cl->cipher_pktctx, outpkt.data + outlen, &outpad);
outlen += outpad;
EVP_EncryptFinal(cl->cipher_pktctx, outpkt.data + outlen, &outpad);
outlen += outpad;
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_ERR, _("Sending packet of %d bytes to %s (%s)"),
outlen, cl->name, cl->hostname);
syslog(LOG_ERR, _("Sending packet of %d bytes to %s (%s)"),
outlen, cl->name, cl->hostname);
@@
-127,7
+127,7
@@
int xrecv(vpn_packet_t *inpkt)
vpn_packet_t outpkt;
int outlen, outpad;
cp
vpn_packet_t outpkt;
int outlen, outpad;
cp
- if(debug_lvl >
3
)
+ if(debug_lvl >
DEBUG_TRAFFIC
)
syslog(LOG_ERR, _("Receiving packet of %d bytes"),
inpkt->len);
syslog(LOG_ERR, _("Receiving packet of %d bytes"),
inpkt->len);
@@
-240,7
+240,7
@@
cp
p = next;
}
p = next;
}
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_DEBUG, _("Queue flushed"));
cp
}
syslog(LOG_DEBUG, _("Queue flushed"));
cp
}
@@
-255,7
+255,7
@@
void flush_queues(conn_list_t *cl)
cp
if(cl->sq)
{
cp
if(cl->sq)
{
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_DEBUG, _("Flushing send queue for %s (%s)"),
cl->name, cl->hostname);
flush_queue(cl, &(cl->sq), xsend);
syslog(LOG_DEBUG, _("Flushing send queue for %s (%s)"),
cl->name, cl->hostname);
flush_queue(cl, &(cl->sq), xsend);
@@
-263,7
+263,7
@@
cp
if(cl->rq)
{
if(cl->rq)
{
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_DEBUG, _("Flushing receive queue for %s (%s)"),
cl->name, cl->hostname);
flush_queue(cl, &(cl->rq), xrecv);
syslog(LOG_DEBUG, _("Flushing receive queue for %s (%s)"),
cl->name, cl->hostname);
flush_queue(cl, &(cl->rq), xrecv);
@@
-280,7
+280,7
@@
int send_packet(ip_t to, vpn_packet_t *packet)
cp
if((cl = lookup_conn_list_ipv4(to)) == NULL)
{
cp
if((cl = lookup_conn_list_ipv4(to)) == NULL)
{
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
{
syslog(LOG_NOTICE, _("Trying to look up %d.%d.%d.%d in connection list failed!"),
IP_ADDR_V(to));
{
syslog(LOG_NOTICE, _("Trying to look up %d.%d.%d.%d in connection list failed!"),
IP_ADDR_V(to));
@@
-303,7
+303,7
@@
cp
if(!cl->status.validkey)
{
if(!cl->status.validkey)
{
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_INFO, _("No valid key known yet for %s (%s), queueing packet"),
cl->name, cl->hostname);
add_queue(&(cl->sq), packet, packet->len + 2);
syslog(LOG_INFO, _("No valid key known yet for %s (%s), queueing packet"),
cl->name, cl->hostname);
add_queue(&(cl->sq), packet, packet->len + 2);
@@
-314,7
+314,7
@@
cp
if(!cl->status.active)
{
if(!cl->status.active)
{
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_INFO, _("%s (%s) is not ready, queueing packet"),
cl->name, cl->hostname);
add_queue(&(cl->sq), packet, packet->len + 2);
syslog(LOG_INFO, _("%s (%s) is not ready, queueing packet"),
cl->name, cl->hostname);
add_queue(&(cl->sq), packet, packet->len + 2);
@@
-335,10
+335,8
@@
int setup_tap_fd(void)
const char *tapfname;
config_t const *cfg;
char *envvar;
const char *tapfname;
config_t const *cfg;
char *envvar;
-
-#ifdef HAVE_TUNTAP
struct ifreq ifr;
struct ifreq ifr;
-#endif
+
cp
if((cfg = get_config_val(config, tapdevice)))
tapfname = cfg->data.ptr;
cp
if((cfg = get_config_val(config, tapdevice)))
tapfname = cfg->data.ptr;
@@
-511,7
+509,7
@@
int setup_outgoing_meta_socket(conn_list_t *cl)
struct sockaddr_in a;
config_t const *cfg;
cp
struct sockaddr_in a;
config_t const *cfg;
cp
- if(debug_lvl >
0
)
+ if(debug_lvl >
= DEBUG_CONNECTIONS
)
syslog(LOG_INFO, _("Trying to connect to %s"), cl->hostname);
if((cfg = get_config_val(cl->config, port)) == NULL)
syslog(LOG_INFO, _("Trying to connect to %s"), cl->hostname);
if((cfg = get_config_val(cl->config, port)) == NULL)
@@
-545,7
+543,7
@@
cp
return -1;
}
return -1;
}
- if(debug_lvl >
0
)
+ if(debug_lvl >
= DEBUG_CONNECTIONS
)
syslog(LOG_INFO, _("Connected to %s port %hd"),
cl->hostname, cl->port);
syslog(LOG_INFO, _("Connected to %s port %hd"),
cl->hostname, cl->port);
@@
-865,7
+863,7
@@
int setup_vpn_connection(conn_list_t *cl)
int nfd, flags;
struct sockaddr_in a;
cp
int nfd, flags;
struct sockaddr_in a;
cp
- if(debug_lvl >
0
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_DEBUG, _("Opening UDP socket to %s"), cl->hostname);
nfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
syslog(LOG_DEBUG, _("Opening UDP socket to %s"), cl->hostname);
nfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
@@
-928,7
+926,7
@@
cp
p->last_ping_time = time(NULL);
p->want_ping = 0;
p->last_ping_time = time(NULL);
p->want_ping = 0;
- if(debug_lvl >
0
)
+ if(debug_lvl >
= DEBUG_CONNECTIONS
)
syslog(LOG_NOTICE, _("Connection from %s port %d"),
p->hostname, htons(ci.sin_port));
syslog(LOG_NOTICE, _("Connection from %s port %d"),
p->hostname, htons(ci.sin_port));
@@
-1005,7
+1003,7
@@
cp
if(cl->status.remove)
return;
if(cl->status.remove)
return;
- if(debug_lvl >
0
)
+ if(debug_lvl >
= DEBUG_CONNECTIONS
)
syslog(LOG_NOTICE, _("Closing connection with %s (%s)"),
cl->name, cl->hostname);
syslog(LOG_NOTICE, _("Closing connection with %s (%s)"),
cl->name, cl->hostname);
@@
-1078,7
+1076,7
@@
cp
{
if(p->status.pinged && !p->status.got_pong)
{
{
if(p->status.pinged && !p->status.got_pong)
{
- if(debug_lvl >
1
)
+ if(debug_lvl >
= DEBUG_PROTOCOL
)
syslog(LOG_INFO, _("%s (%s) didn't respond to PING"),
p->name, p->hostname);
p->status.timeout = 1;
syslog(LOG_INFO, _("%s (%s) didn't respond to PING"),
p->name, p->hostname);
p->status.timeout = 1;
@@
-1212,14
+1210,14
@@
cp
ether_type = ntohs(*((unsigned short*)(&vp.data[12])));
if(ether_type != 0x0800)
{
ether_type = ntohs(*((unsigned short*)(&vp.data[12])));
if(ether_type != 0x0800)
{
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_INFO, _("Non-IP ethernet frame %04x from %02x:%02x:%02x:%02x:%02x:%02x"), ether_type, MAC_ADDR_V(vp.data[6]));
return;
}
if(lenin < 32)
{
syslog(LOG_INFO, _("Non-IP ethernet frame %04x from %02x:%02x:%02x:%02x:%02x:%02x"), ether_type, MAC_ADDR_V(vp.data[6]));
return;
}
if(lenin < 32)
{
- if(debug_lvl >
3
)
+ if(debug_lvl >
= DEBUG_TRAFFIC
)
syslog(LOG_INFO, _("Dropping short packet from %02x:%02x:%02x:%02x:%02x:%02x"), MAC_ADDR_V(vp.data[6]));
return;
}
syslog(LOG_INFO, _("Dropping short packet from %02x:%02x:%02x:%02x:%02x:%02x"), MAC_ADDR_V(vp.data[6]));
return;
}