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.2 by pcg, Sat Mar 8 10:48:41 2003 UTC vs.
Revision 1.3 by pcg, Tue Oct 14 03:22:09 2003 UTC

28#include <fcntl.h> 28#include <fcntl.h>
29#include <net/if.h> 29#include <net/if.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <sys/ioctl.h> 31#include <sys/ioctl.h>
32 32
33#include <net/if.h>
34
33#ifdef LINUX_IF_TUN_H 35#ifdef LINUX_IF_TUN_H
34#include LINUX_IF_TUN_H 36# include LINUX_IF_TUN_H
35#else 37#else
36#include <linux/if_tun.h> 38#include <linux/if_tun.h>
37#endif 39#endif
38#define DEFAULT_DEVICE "/dev/net/tun" 40#define DEFAULT_DEVICE "/dev/net/tun"
39 41
40#include "gettext.h" 42#include "gettext.h"
41 43
42#include "conf.h" 44#include "conf.h"
45
46const char *
47tap_device::info ()
48{
49 return _("Linux tun/tap device");
50}
43 51
44tap_device::tap_device () 52tap_device::tap_device ()
45{ 53{
46 struct ifreq ifr; 54 struct ifreq ifr;
47 55
92 100
93 pkt->len = read (fd, &((*pkt)[0]), MAX_MTU); 101 pkt->len = read (fd, &((*pkt)[0]), MAX_MTU);
94 102
95 if (pkt->len <= 0) 103 if (pkt->len <= 0)
96 { 104 {
105 delete pkt;
97 slog (L_ERR, _("error while reading from %s %s: %s"), 106 slog (L_ERR, _("error while reading from %s %s: %s"),
98 info (), DEFAULT_DEVICE, strerror (errno)); 107 info (), DEFAULT_DEVICE, strerror (errno));
99 free (pkt);
100 return 0; 108 return 0;
101 } 109 }
102 110
103 return pkt; 111 return pkt;
104} 112}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines