Remove mymac stuff from device.c.
This commit is contained in:
parent
31f17d4334
commit
12de5a8eed
10 changed files with 21 additions and 112 deletions
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.4 2002/09/10 21:29:42 guus Exp $
|
||||
$Id: device.c,v 1.1.2.5 2003/06/11 19:28:36 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -47,8 +47,6 @@ char *device_info;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
extern subnet_t mymac;
|
||||
|
||||
int setup_device(void)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
|
@ -66,15 +64,6 @@ int setup_device(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
device_info = _("Stub device for Cygwin environment");
|
||||
|
||||
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.5 2002/09/10 21:29:42 guus Exp $
|
||||
$Id: device.c,v 1.1.2.6 2003/06/11 19:28:36 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -51,8 +51,6 @@ char *device_info;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
extern subnet_t mymac;
|
||||
|
||||
/*
|
||||
open the local ethertap device
|
||||
*/
|
||||
|
@ -71,15 +69,6 @@ int setup_device(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
device_info = _("MacOS/X tun device");
|
||||
|
||||
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
|
||||
|
@ -110,8 +99,6 @@ int read_packet(vpn_packet_t *packet)
|
|||
return -1;
|
||||
}
|
||||
|
||||
memcpy(packet->data, mymac.net.mac.address.x, 6);
|
||||
memcpy(packet->data + 6, mymac.net.mac.address.x, 6);
|
||||
packet->data[12] = 0x08;
|
||||
packet->data[13] = 0x00;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.8 2002/09/10 21:29:42 guus Exp $
|
||||
$Id: device.c,v 1.1.2.9 2003/06/11 19:28:37 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -51,8 +51,6 @@ char *device_info;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
extern subnet_t mymac;
|
||||
|
||||
/*
|
||||
open the local ethertap device
|
||||
*/
|
||||
|
@ -71,15 +69,6 @@ int setup_device(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
device_info = _("FreeBSD tap device");
|
||||
|
||||
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.14 2003/06/11 19:09:52 guus Exp $
|
||||
$Id: device.c,v 1.1.2.15 2003/06/11 19:28:37 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -68,8 +68,6 @@ char *device_info;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
extern subnet_t mymac;
|
||||
|
||||
/*
|
||||
open the local ethertap device
|
||||
*/
|
||||
|
@ -95,15 +93,6 @@ int setup_device(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
#ifdef HAVE_TUNTAP
|
||||
/* Ok now check if this is an old ethertap or a new tun/tap thingie */
|
||||
|
||||
|
@ -131,6 +120,8 @@ int setup_device(void)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
if(routing_mode == RMODE_ROUTER)
|
||||
overwrite_mac = 1;
|
||||
device_info = _("Linux ethertap device");
|
||||
device_type = DEVICE_TYPE_ETHERTAP;
|
||||
interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.7 2002/09/10 21:29:42 guus Exp $
|
||||
$Id: device.c,v 1.1.2.8 2003/06/11 19:28:37 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -56,8 +56,6 @@ char *device_info;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
extern subnet_t mymac;
|
||||
|
||||
/*
|
||||
open the local ethertap device
|
||||
*/
|
||||
|
@ -75,15 +73,6 @@ int setup_device(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
device_info = _("NetBSD tun device");
|
||||
|
||||
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
|
||||
|
@ -110,8 +99,6 @@ int read_packet(vpn_packet_t *packet)
|
|||
return -1;
|
||||
}
|
||||
|
||||
memcpy(packet->data, mymac.net.mac.address.x, 6);
|
||||
memcpy(packet->data + 6, mymac.net.mac.address.x, 6);
|
||||
packet->data[12] = 0x08;
|
||||
packet->data[13] = 0x00;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.12 2002/09/10 21:29:42 guus Exp $
|
||||
$Id: device.c,v 1.1.2.13 2003/06/11 19:28:37 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -56,8 +56,6 @@ char *device_info;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
extern subnet_t mymac;
|
||||
|
||||
/*
|
||||
open the local ethertap device
|
||||
*/
|
||||
|
@ -75,15 +73,6 @@ int setup_device(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
device_info = _("OpenBSD tun device");
|
||||
|
||||
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
|
||||
|
@ -112,9 +101,6 @@ int read_packet(vpn_packet_t *packet)
|
|||
return -1;
|
||||
}
|
||||
|
||||
memcpy(packet->data, mymac.net.mac.address.x, 6);
|
||||
memcpy(packet->data + 6, mymac.net.mac.address.x, 6);
|
||||
|
||||
switch (ntohl(type)) {
|
||||
case AF_INET:
|
||||
packet->data[12] = 0x8;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.4 2002/09/10 21:29:42 guus Exp $
|
||||
$Id: device.c,v 1.1.2.5 2003/06/11 19:28:38 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -53,8 +53,6 @@ char *device_info;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
extern subnet_t mymac;
|
||||
|
||||
/*
|
||||
open the local ethertap device
|
||||
*/
|
||||
|
@ -99,15 +97,6 @@ int setup_device(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
|
||||
|
||||
return 0;
|
||||
|
|
14
src/route.c
14
src/route.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.
|
||||
|
||||
$Id: route.c,v 1.1.2.49 2003/03/29 22:11:22 guus Exp $
|
||||
$Id: route.c,v 1.1.2.50 2003/06/11 19:28:35 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -67,7 +67,8 @@
|
|||
int routing_mode = RMODE_ROUTER;
|
||||
int priorityinheritance = 0;
|
||||
int macexpire = 600;
|
||||
subnet_t mymac;
|
||||
int overwrite_mac = 0;
|
||||
mac_t mymac = {0xFE, 0xFD, 0, 0, 0, 0};
|
||||
|
||||
/* RFC 1071 */
|
||||
|
||||
|
@ -397,7 +398,8 @@ void route_neighborsol(vpn_packet_t *packet)
|
|||
|
||||
/* First, snatch the source address from the neighbor solicitation packet */
|
||||
|
||||
memcpy(mymac.net.mac.address.x, packet->data + 6, 6);
|
||||
if(overwrite_mac)
|
||||
memcpy(mymac.x, packet->data + 6, 6);
|
||||
|
||||
/* Check if this is a valid neighbor solicitation request */
|
||||
|
||||
|
@ -499,7 +501,8 @@ void route_arp(vpn_packet_t *packet)
|
|||
|
||||
/* First, snatch the source address from the ARP packet */
|
||||
|
||||
memcpy(mymac.net.mac.address.x, packet->data + 6, 6);
|
||||
if(overwrite_mac)
|
||||
memcpy(mymac.x, packet->data + 6, 6);
|
||||
|
||||
/* This routine generates replies to ARP requests.
|
||||
You don't need to set NOARP flag on the interface anymore (which is broken on FreeBSD).
|
||||
|
@ -628,7 +631,8 @@ void route_incoming(node_t *source, vpn_packet_t *packet)
|
|||
|
||||
if(n) {
|
||||
if(n == myself) {
|
||||
memcpy(packet->data, mymac.net.mac.address.x, 6);
|
||||
if(overwrite_mac)
|
||||
memcpy(packet->data, mymac.x, 6);
|
||||
write_packet(packet);
|
||||
} else
|
||||
send_packet(n, packet);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: route.h,v 1.1.2.9 2002/09/09 21:25:07 guus Exp $
|
||||
$Id: route.h,v 1.1.2.10 2003/06/11 19:28:35 guus Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TINC_ROUTE_H__
|
||||
|
@ -30,6 +30,7 @@ enum {
|
|||
};
|
||||
|
||||
extern int routing_mode;
|
||||
extern int overwrite_mac;
|
||||
extern int priorityinheritance;
|
||||
extern int macexpire;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.11 2002/09/10 21:29:42 guus Exp $
|
||||
$Id: device.c,v 1.1.2.12 2003/06/11 19:28:38 guus Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -57,8 +57,6 @@ char *device_info = NULL;
|
|||
int device_total_in = 0;
|
||||
int device_total_out = 0;
|
||||
|
||||
subnet_t mymac;
|
||||
|
||||
int setup_device(void)
|
||||
{
|
||||
int ip_fd = -1, if_fd = -1;
|
||||
|
@ -120,16 +118,6 @@ int setup_device(void)
|
|||
|
||||
device_info = _("Solaris tun device");
|
||||
|
||||
/* 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;
|
||||
|
||||
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
|
||||
|
||||
return 0;
|
||||
|
@ -154,8 +142,6 @@ int read_packet(vpn_packet_t *packet)
|
|||
return -1;
|
||||
}
|
||||
|
||||
memcpy(packet->data, mymac.net.mac.address.x, 6);
|
||||
memcpy(packet->data + 6, mymac.net.mac.address.x, 6);
|
||||
packet->data[12] = 0x08;
|
||||
packet->data[13] = 0x00;
|
||||
|
||||
|
|
Loading…
Reference in a new issue