ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/device-tincd.C
(Generate patch)

Comparing gvpe/src/device-tincd.C (file contents):
Revision 1.16 by pcg, Fri Mar 25 13:56:25 2005 UTC vs.
Revision 1.20 by pcg, Sun Dec 2 00:45:42 2007 UTC

14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with gvpe; if not, write to the Free Software 18 along with gvpe; if not, write to the Free Software
19 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/ 20*/
21 21
22#include <cstdio> 22#include <cstdio>
23#include <cstring> 23#include <cstring>
24#include <cerrno> 24#include <cerrno>
65 65
66#define MTU MAX_MTU 66#define MTU MAX_MTU
67 67
68// BIGGEST hack of 'em all 68// BIGGEST hack of 'em all
69// will be casted to data_packet, due to structural similarity 69// will be casted to data_packet, due to structural similarity
70struct vpn_packet_t : net_packet { 70struct vpn_packet_t : net_packet
71{
71 u8 data[MAXSIZE]; 72 u8 data[MAXSIZE];
72}; 73};
73 74
74static bool overwrite_mac; 75static bool overwrite_mac;
75 76
78{ 79{
79 if (!strcmp (key, "Interface")) 80 if (!strcmp (key, "Interface"))
80 *res = conf.ifname; 81 *res = conf.ifname;
81 else if (!strcmp (key, "Device")) 82 else if (!strcmp (key, "Device"))
82 *res = 0; 83 *res = 0;
84 else if (!strcmp (key, "DeviceType"))
85 *res = "tap";
83 else 86 else
84 { 87 {
85 slog (L_ERR, _("tincd layer asking for unknown config '%s'"), key); 88 slog (L_ERR, _("tincd layer asking for unknown config '%s'"), key);
86 *res = 0; 89 *res = 0;
87 } 90 }
91 94
92#define netname conf.ifname 95#define netname conf.ifname
93 96
94#if IF_linux 97#if IF_linux
95# include "tincd/linux/device.c" 98# include "tincd/linux/device.c"
96const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME hw ether $MAC mtu $MTU up"; } 99const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME hw ether $MAC mtu $MTU"; }
100
101#elif IF_bsd
102# include "tincd/bsd/device.c"
103const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; }
97 104
98#elif IF_freebsd 105#elif IF_freebsd
99# include "tincd/freebsd/device.c" 106# include "tincd/freebsd/device.c"
100// 5.2.1' ifconfig _first_ sets the if up then changes mtu, which can be deadly due to ipv6 kicking in
101const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU && /sbin/ifconfig $IFNAME up"; } 107const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; }
102 108
103#elif IF_netbsd 109#elif IF_netbsd
104# define IF_istun 1 110# define IF_istun 1
105# include "tincd/netbsd/device.c" 111# include "tincd/netbsd/device.c"
106const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU up"; } 112const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU"; }
107 113
108#elif IF_openbsd 114#elif IF_openbsd
109# define IF_istun 1 115# define IF_istun 1
110# include "tincd/openbsd/device.c" 116# include "tincd/openbsd/device.c"
111const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU up"; } 117const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU"; }
112 118
113#elif IF_solaris 119#elif IF_solaris
114# define IF_istun 1 120# define IF_istun 1
115# include "tincd/solaris/device.c" 121# include "tincd/solaris/device.c"
116const char * tap_device::if_up () { return ""; } 122const char * tap_device::if_up () { return ""; }
124const char * tap_device::if_up () { return ""; } 130const char * tap_device::if_up () { return ""; }
125 131
126#elif IF_darwin 132#elif IF_darwin
127# define IF_istun 1 133# define IF_istun 1
128# include "tincd/darwin/device.c" 134# include "tincd/darwin/device.c"
129const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU up"; } 135const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; }
130 136
131#elif IF_raw_socket 137#elif IF_raw_socket
132# include "tincd/raw_socket/device.c" 138# include "tincd/raw_socket/device.c"
133const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU up"; } 139const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; }
134 140
135#elif IF_uml_socket 141#elif IF_uml_socket
136# include "tincd/uml_socket/device.c" 142# include "tincd/uml_socket/device.c"
137const char * tap_device::if_up () { return 0; } 143const char * tap_device::if_up () { return 0; }
138 144

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines