… | |
… | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
15 | GNU General Public License for more details. |
16 | |
16 | |
17 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
18 | along with gvpe; if not, write to the Free Software |
18 | along with gvpe; if not, write to the Free Software |
19 | Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | */ |
20 | */ |
21 | |
21 | |
22 | #include <cstdio> |
22 | #include <cstdio> |
23 | #include <cstring> |
23 | #include <cstring> |
24 | #include <cerrno> |
24 | #include <cerrno> |
… | |
… | |
78 | { |
78 | { |
79 | if (!strcmp (key, "Interface")) |
79 | if (!strcmp (key, "Interface")) |
80 | *res = conf.ifname; |
80 | *res = conf.ifname; |
81 | else if (!strcmp (key, "Device")) |
81 | else if (!strcmp (key, "Device")) |
82 | *res = 0; |
82 | *res = 0; |
|
|
83 | else if (!strcmp (key, "DeviceType")) |
|
|
84 | *res = "tap"; |
83 | else |
85 | else |
84 | { |
86 | { |
85 | slog (L_ERR, _("tincd layer asking for unknown config '%s'"), key); |
87 | slog (L_ERR, _("tincd layer asking for unknown config '%s'"), key); |
86 | *res = 0; |
88 | *res = 0; |
87 | } |
89 | } |
… | |
… | |
91 | |
93 | |
92 | #define netname conf.ifname |
94 | #define netname conf.ifname |
93 | |
95 | |
94 | #if IF_linux |
96 | #if IF_linux |
95 | # include "tincd/linux/device.c" |
97 | # include "tincd/linux/device.c" |
96 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME hw ether $MAC mtu $MTU up"; } |
98 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME hw ether $MAC mtu $MTU"; } |
|
|
99 | |
|
|
100 | #elif IF_bsd |
|
|
101 | # include "tincd/bsd/device.c" |
|
|
102 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; } |
97 | |
103 | |
98 | #elif IF_freebsd |
104 | #elif IF_freebsd |
99 | # include "tincd/freebsd/device.c" |
105 | # include "tincd/freebsd/device.c" |
100 | // 5.2.1' ifconfig _first_ sets the if up then changes mtu, which can be deadly due to ipv6 kicking in |
|
|
101 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU && /sbin/ifconfig $IFNAME up"; } |
106 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; } |
102 | |
107 | |
103 | #elif IF_netbsd |
108 | #elif IF_netbsd |
104 | # define IF_istun 1 |
109 | # define IF_istun 1 |
105 | # include "tincd/netbsd/device.c" |
110 | # include "tincd/netbsd/device.c" |
106 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU up"; } |
111 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU"; } |
107 | |
112 | |
108 | #elif IF_openbsd |
113 | #elif IF_openbsd |
109 | # define IF_istun 1 |
114 | # define IF_istun 1 |
110 | # include "tincd/openbsd/device.c" |
115 | # include "tincd/openbsd/device.c" |
111 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU up"; } |
116 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME mtu $MTU"; } |
112 | |
117 | |
113 | #elif IF_solaris |
118 | #elif IF_solaris |
114 | # define IF_istun 1 |
119 | # define IF_istun 1 |
115 | # include "tincd/solaris/device.c" |
120 | # include "tincd/solaris/device.c" |
116 | const char * tap_device::if_up () { return ""; } |
121 | const char * tap_device::if_up () { return ""; } |
… | |
… | |
124 | const char * tap_device::if_up () { return ""; } |
129 | const char * tap_device::if_up () { return ""; } |
125 | |
130 | |
126 | #elif IF_darwin |
131 | #elif IF_darwin |
127 | # define IF_istun 1 |
132 | # define IF_istun 1 |
128 | # include "tincd/darwin/device.c" |
133 | # include "tincd/darwin/device.c" |
129 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU up"; } |
134 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; } |
130 | |
135 | |
131 | #elif IF_raw_socket |
136 | #elif IF_raw_socket |
132 | # include "tincd/raw_socket/device.c" |
137 | # include "tincd/raw_socket/device.c" |
133 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU up"; } |
138 | const char * tap_device::if_up () { return "/sbin/ifconfig $IFNAME ether $MAC mtu $MTU"; } |
134 | |
139 | |
135 | #elif IF_uml_socket |
140 | #elif IF_uml_socket |
136 | # include "tincd/uml_socket/device.c" |
141 | # include "tincd/uml_socket/device.c" |
137 | const char * tap_device::if_up () { return 0; } |
142 | const char * tap_device::if_up () { return 0; } |
138 | |
143 | |