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.12 by pcg, Thu Mar 3 16:54:34 2005 UTC vs.
Revision 1.13 by pcg, Thu Mar 17 23:59:37 2005 UTC

121 121
122#elif IF_raw_socket 122#elif IF_raw_socket
123# define IF_istun 1 123# define IF_istun 1
124# include "tincd/raw_socket/device.c" 124# include "tincd/raw_socket/device.c"
125 125
126#elif IF_uml_socket
127# include "tincd/uml_socket/device.c"
128
126#else 129#else
127# error No interface implementation for your IFTYPE/IFSUBTYPE combination. 130# error No interface implementation for your IFTYPE/IFSUBTYPE combination.
128#endif 131#endif
129 132
130#if IF_istun 133#if IF_istun
139 142
140tap_device::tap_device () 143tap_device::tap_device ()
141{ 144{
142 device = "(null)"; 145 device = "(null)";
143 146
144 if (setup_device ()) 147 bool ok = setup_device ();
148
149 if (device_info)
150 device = device_info;
151
152 if (ok)
145 { 153 {
146 slog (L_DEBUG, _("interface %s on %s initialized"), info (), device); 154 slog (L_DEBUG, _("interface %s on %s initialized"), info (), device);
147 fd = device_fd; 155 fd = device_fd;
148 strcpy (ifrname, iface); 156 strcpy (ifrname, iface);
149 } 157 }
165 tap_packet *pkt = new tap_packet; 173 tap_packet *pkt = new tap_packet;
166 174
167 if (!read_packet (reinterpret_cast<vpn_packet_t *>(pkt))) 175 if (!read_packet (reinterpret_cast<vpn_packet_t *>(pkt)))
168 { 176 {
169 delete pkt; 177 delete pkt;
170 slog (L_ERR, _("can't read from to %s %s: %s"), info (), DEFAULT_DEVICE, 178 slog (L_ERR, _("can't read from to %s %s: %s"), info (), device,
171 strerror (errno)); 179 strerror (errno));
172 return 0; 180 return 0;
173 } 181 }
174 182
175#if IF_istun 183#if IF_istun
193 if ( 201 if (
194#if IF_istun 202#if IF_istun
195 ether_emu.tap_to_tun (pkt) && 203 ether_emu.tap_to_tun (pkt) &&
196#endif 204#endif
197 !write_packet (reinterpret_cast<vpn_packet_t *>(pkt))) 205 !write_packet (reinterpret_cast<vpn_packet_t *>(pkt)))
198 slog (L_ERR, _("can't write to %s %s: %s"), info (), DEFAULT_DEVICE, 206 slog (L_ERR, _("can't write to %s %s: %s"), info (), device,
199 strerror (errno)); 207 strerror (errno));
200} 208}
201 209
202 210

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines