--- gvpe/src/device-tincd.C 2004/01/17 01:18:36 1.9 +++ gvpe/src/device-tincd.C 2005/03/17 23:59:37 1.13 @@ -1,8 +1,10 @@ /* device-tincd.C -- include one of the tincd low level implementations. - Copyright (C) 2003-2004 Marc Lehmann + Copyright (C) 2003-2005 Marc Lehmann - This program is free software; you can redistribute it and/or modify + This file is part of GVPE. + + GVPE is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -13,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with gvpe; if not, write to the Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -96,14 +98,15 @@ # include "tincd/freebsd/device.c" #elif IF_netbsd -#define IF_istun 1 +# define IF_istun 1 # include "tincd/netbsd/device.c" #elif IF_openbsd -#define IF_istun 1 +# define IF_istun 1 # include "tincd/openbsd/device.c" #elif IF_solaris +# define IF_istun 1 # include "tincd/solaris/device.c" #elif IF_cygwin @@ -113,13 +116,16 @@ # include "tincd/mingw/device.c" #elif IF_darwin -#define IF_istun 1 +# define IF_istun 1 # include "tincd/darwin/device.c" #elif IF_raw_socket -#define IF_istun 1 +# define IF_istun 1 # include "tincd/raw_socket/device.c" +#elif IF_uml_socket +# include "tincd/uml_socket/device.c" + #else # error No interface implementation for your IFTYPE/IFSUBTYPE combination. #endif @@ -138,7 +144,12 @@ { device = "(null)"; - if (setup_device ()) + bool ok = setup_device (); + + if (device_info) + device = device_info; + + if (ok) { slog (L_DEBUG, _("interface %s on %s initialized"), info (), device); fd = device_fd; @@ -147,7 +158,7 @@ else { slog (L_ERR, _("error while configuring tincd device %s on %s"), info (), device); - exit (1); + exit (EXIT_FAILURE); } } @@ -164,7 +175,7 @@ if (!read_packet (reinterpret_cast(pkt))) { delete pkt; - slog (L_ERR, _("can't read from to %s %s: %s"), info (), DEFAULT_DEVICE, + slog (L_ERR, _("can't read from to %s %s: %s"), info (), device, strerror (errno)); return 0; } @@ -192,7 +203,7 @@ ether_emu.tap_to_tun (pkt) && #endif !write_packet (reinterpret_cast(pkt))) - slog (L_ERR, _("can't write to %s %s: %s"), info (), DEFAULT_DEVICE, + slog (L_ERR, _("can't write to %s %s: %s"), info (), device, strerror (errno)); }