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. |
… | |
… | |
67 | // will be casted to data_packet, due to structural similarity |
67 | // will be casted to data_packet, due to structural similarity |
68 | struct vpn_packet_t : net_packet { |
68 | struct vpn_packet_t : net_packet { |
69 | u8 data[MAXSIZE]; |
69 | u8 data[MAXSIZE]; |
70 | }; |
70 | }; |
71 | |
71 | |
72 | static tap_device *self; |
|
|
73 | |
|
|
74 | static bool overwrite_mac; |
72 | static bool overwrite_mac; |
75 | |
73 | |
76 | static bool |
74 | static bool |
77 | get_config_string(const char *key, char **res) |
75 | get_config_string(const char *key, char **res) |
78 | { |
76 | { |
… | |
… | |
136 | return _("tincd compatibility layer"); |
134 | return _("tincd compatibility layer"); |
137 | } |
135 | } |
138 | |
136 | |
139 | tap_device::tap_device () |
137 | tap_device::tap_device () |
140 | { |
138 | { |
141 | self = this; |
139 | device = "(null)"; |
142 | |
140 | |
143 | if (setup_device ()) |
141 | if (setup_device ()) |
144 | { |
142 | { |
145 | //slog (L_DEBUG, _("%s is a %s"), device, info ()); |
143 | slog (L_DEBUG, _("interface %s on %s initialized"), info (), device); |
146 | fd = device_fd; |
144 | fd = device_fd; |
147 | strcpy (ifrname, iface); |
145 | strcpy (ifrname, iface); |
148 | } |
146 | } |
149 | else |
147 | else |
150 | { |
148 | { |
151 | slog (L_ERR, _("error while configuring tincd device (%s/%s)"), device, info ()); |
149 | slog (L_ERR, _("error while configuring tincd device %s on %s"), info (), device); |
152 | exit (1); |
150 | exit (EXIT_FAILURE); |
153 | } |
151 | } |
154 | } |
152 | } |
155 | |
153 | |
156 | tap_device::~tap_device () |
154 | tap_device::~tap_device () |
157 | { |
155 | { |