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.111 2001/06/05 16:09:55 guus Exp $
+ $Id: net.c,v 1.35.4.115 2001/06/21 16:16:31 guus Exp $
*/
#include "config.h"
# include <pem.h>
#endif
+#warning oi1
#ifdef HAVE_TUNTAP
+#warning oi2
#include LINUX_IF_TUN_H
#endif
+#warning oi3
#include <utils.h>
#include <xalloc.h>
int total_socket_out = 0;
config_t *upstreamcfg;
-static int seconds_till_retry;
+int seconds_till_retry = 5;
int keylifetime = 0;
int keyexpires = 0;
outlen += outpad;
outpkt.len = outlen - sizeof(outpkt.salt);
+ total_socket_in += outlen;
+
receive_packet(cl, &outpkt);
cp
}
/* Set default MAC address for ethertap devices */
mymac.type = SUBNET_MAC;
- mymac.net.mac.address.x[0] = 0xfe;
- mymac.net.mac.address.x[1] = 0xfd;
- mymac.net.mac.address.x[2] = 0x00;
- mymac.net.mac.address.x[3] = 0x00;
- mymac.net.mac.address.x[4] = 0x00;
- mymac.net.mac.address.x[5] = 0x00;
+ mymac.net.mac.address.x[0] = 0xff;
+ mymac.net.mac.address.x[1] = 0xff;
+ mymac.net.mac.address.x[2] = 0xff;
+ mymac.net.mac.address.x[3] = 0xff;
+ mymac.net.mac.address.x[4] = 0xff;
+ mymac.net.mac.address.x[5] = 0xff;
#ifdef HAVE_LINUX
#ifdef HAVE_TUNTAP
else
myself->port = cfg->data.val;
- if((cfg = get_config_val(myself->config, config_indirectdata)))
- if(cfg->data.val == stupid_true)
- myself->options |= OPTION_INDIRECT;
-
- if((cfg = get_config_val(myself->config, config_tcponly)))
- if(cfg->data.val == stupid_true)
- myself->options |= OPTION_TCPONLY;
-
/* Read in all the subnets specified in the host configuration file */
for(next = myself->config; (cfg = get_config_val(next, config_subnet)); next = cfg->next)
subnet_add(myself, net);
}
+cp
+ /* Check some options */
+
+ if((cfg = get_config_val(config, config_indirectdata)))
+ if(cfg->data.val == stupid_true)
+ myself->options |= OPTION_INDIRECT;
+
+ if((cfg = get_config_val(config, config_tcponly)))
+ if(cfg->data.val == stupid_true)
+ myself->options |= OPTION_TCPONLY;
+
+ if((cfg = get_config_val(myself->config, config_indirectdata)))
+ if(cfg->data.val == stupid_true)
+ myself->options |= OPTION_INDIRECT;
+
+ if((cfg = get_config_val(myself->config, config_tcponly)))
+ if(cfg->data.val == stupid_true)
+ myself->options |= OPTION_TCPONLY;
+
+ if(myself->options & OPTION_TCPONLY)
+ myself->options |= OPTION_INDIRECT;
+
+ if((cfg = get_config_val(config, config_mode)))
+ {
+ if(!strcasecmp(cfg->data.ptr, "router"))
+ routing_mode = RMODE_ROUTER;
+ else if (!strcasecmp(cfg->data.ptr, "switch"))
+ routing_mode = RMODE_SWITCH;
+ else if (!strcasecmp(cfg->data.ptr, "hub"))
+ routing_mode = RMODE_HUB;
+ else
+ {
+ syslog(LOG_ERR, _("Invalid routing mode!"));
+ return -1;
+ }
+ }
+ else
+ routing_mode = RMODE_ROUTER;
+
+cp
+ /* Open sockets */
+
if((myself->meta_socket = setup_listen_meta_socket(myself->port)) < 0)
{
syslog(LOG_ERR, _("Unable to set up a listening TCP socket!"));
keyexpires = time(NULL) + keylifetime;
cp
- /* Check some options */
-
- if((cfg = get_config_val(config, config_indirectdata)))
- {
- if(cfg->data.val == stupid_true)
- myself->options |= OPTION_INDIRECT;
- }
-
- if((cfg = get_config_val(config, config_tcponly)))
- {
- if(cfg->data.val == stupid_true)
- myself->options |= OPTION_TCPONLY;
- }
-
- if(myself->options & OPTION_TCPONLY)
- myself->options |= OPTION_INDIRECT;
/* Activate ourselves */
{
cl->status.outgoing = 0;
signal(SIGALRM, sigalrm_handler);
- seconds_till_retry = 5;
alarm(seconds_till_retry);
- syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in 5 seconds"));
+ syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in %d seconds"), seconds_till_retry);
}
/* Deactivate */