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

Comparing gvpe/src/device-linux.C (file contents):
Revision 1.5 by pcg, Thu Oct 16 02:41:21 2003 UTC vs.
Revision 1.8 by pcg, Thu Jan 29 18:55:10 2004 UTC

1/* 1/*
2 device-linux.C -- Interaction with Linux tun/tap device 2 device-linux.C -- Interaction with Linux tun/tap device
3 Copyright (C) 2003 Marc Lehmann <pcg@goof.com> 3 Copyright (C) 2003-2004 Marc Lehmann <pcg@goof.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
43#include "gettext.h" 43#include "gettext.h"
44 44
45#include "conf.h" 45#include "conf.h"
46 46
47#if TEST_ETHEREMU 47#if TEST_ETHEREMU
48# define IF_istun
48# include "ether_emu.C" 49# include "ether_emu.C"
49#endif 50#endif
50 51
51const char * 52const char *
52tap_device::info () 53tap_device::info ()
63 fd = open (device, O_RDWR); 64 fd = open (device, O_RDWR);
64 65
65 if (fd < 0) 66 if (fd < 0)
66 { 67 {
67 slog (L_ERR, _("could not open device %s: %s"), device, strerror (errno)); 68 slog (L_ERR, _("could not open device %s: %s"), device, strerror (errno));
68 exit (1); 69 exit (EXIT_FAILURE);
69 } 70 }
70 71
71 memset (&ifr, 0, sizeof (ifr)); 72 memset (&ifr, 0, sizeof (ifr));
72#if TEST_ETHEREMU 73#if TEST_ETHEREMU
73 ifr.ifr_flags = IFF_TUN | IFF_NO_PI; 74 ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
86 ifrname [IFNAMSIZ] = 0; 87 ifrname [IFNAMSIZ] = 0;
87 } 88 }
88 else 89 else
89 { 90 {
90 slog (L_CRIT, _("unable to configure tun/tap interface: %s"), strerror (errno)); 91 slog (L_CRIT, _("unable to configure tun/tap interface: %s"), strerror (errno));
91 exit (1); 92 exit (EXIT_FAILURE);
92 } 93 }
93 94
94 if (ioctl (fd, TUNSETPERSIST, conf.ifpersist ? 1 : 0)) 95 if (ioctl (fd, TUNSETPERSIST, conf.ifpersist ? 1 : 0))
95 slog (L_WARN, _("cannot set persistency mode for device %s: %s"), ifrname, strerror (errno)); 96 slog (L_WARN, _("cannot set persistency mode for device %s: %s"), ifrname, strerror (errno));
96 97

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines