1 | /* |
1 | /* |
2 | device-tincd.C -- include one of the tincd low level implementations. |
2 | device-tincd.C -- include one of the tincd low level implementations. |
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. |
… | |
… | |
94 | |
94 | |
95 | #elif IF_freebsd |
95 | #elif IF_freebsd |
96 | # include "tincd/freebsd/device.c" |
96 | # include "tincd/freebsd/device.c" |
97 | |
97 | |
98 | #elif IF_netbsd |
98 | #elif IF_netbsd |
99 | #define IF_istun 1 |
99 | # define IF_istun 1 |
100 | # include "tincd/netbsd/device.c" |
100 | # include "tincd/netbsd/device.c" |
101 | |
101 | |
102 | #elif IF_openbsd |
102 | #elif IF_openbsd |
103 | #define IF_istun 1 |
103 | # define IF_istun 1 |
104 | # include "tincd/openbsd/device.c" |
104 | # include "tincd/openbsd/device.c" |
105 | |
105 | |
106 | #elif IF_solaris |
106 | #elif IF_solaris |
|
|
107 | # define IF_istun 1 |
107 | # include "tincd/solaris/device.c" |
108 | # include "tincd/solaris/device.c" |
108 | |
109 | |
109 | #elif IF_cygwin |
110 | #elif IF_cygwin |
110 | # include "tincd/cygwin/device.c" |
111 | # include "tincd/cygwin/device.c" |
111 | |
112 | |
112 | #elif IF_mingw |
113 | #elif IF_mingw |
113 | # include "tincd/mingw/device.c" |
114 | # include "tincd/mingw/device.c" |
114 | |
115 | |
115 | #elif IF_darwin |
116 | #elif IF_darwin |
116 | #define IF_istun 1 |
117 | # define IF_istun 1 |
117 | # include "tincd/darwin/device.c" |
118 | # include "tincd/darwin/device.c" |
118 | |
119 | |
119 | #elif IF_raw_socket |
120 | #elif IF_raw_socket |
120 | #define IF_istun 1 |
121 | # define IF_istun 1 |
121 | # include "tincd/raw_socket/device.c" |
122 | # include "tincd/raw_socket/device.c" |
122 | |
123 | |
123 | #else |
124 | #else |
124 | # error No interface implementation for your IFTYPE/IFSUBTYPE combination. |
125 | # error No interface implementation for your IFTYPE/IFSUBTYPE combination. |
125 | #endif |
126 | #endif |
… | |
… | |
134 | return _("tincd compatibility layer"); |
135 | return _("tincd compatibility layer"); |
135 | } |
136 | } |
136 | |
137 | |
137 | tap_device::tap_device () |
138 | tap_device::tap_device () |
138 | { |
139 | { |
|
|
140 | device = "(null)"; |
|
|
141 | |
139 | if (setup_device ()) |
142 | if (setup_device ()) |
140 | { |
143 | { |
141 | slog (L_DEBUG, _("interface %s initialized"), info ()); |
144 | slog (L_DEBUG, _("interface %s on %s initialized"), info (), device); |
142 | fd = device_fd; |
145 | fd = device_fd; |
143 | strcpy (ifrname, iface); |
146 | strcpy (ifrname, iface); |
144 | } |
147 | } |
145 | else |
148 | else |
146 | { |
149 | { |
147 | slog (L_ERR, _("error while configuring tincd device (%s)"), info ()); |
150 | slog (L_ERR, _("error while configuring tincd device %s on %s"), info (), device); |
148 | exit (1); |
151 | exit (EXIT_FAILURE); |
149 | } |
152 | } |
150 | } |
153 | } |
151 | |
154 | |
152 | tap_device::~tap_device () |
155 | tap_device::~tap_device () |
153 | { |
156 | { |