… | |
… | |
53 | |
53 | |
54 | struct configuration conf; |
54 | struct configuration conf; |
55 | |
55 | |
56 | u8 best_protocol (u8 protset) |
56 | u8 best_protocol (u8 protset) |
57 | { |
57 | { |
58 | if (protset & PROT_IPv4) |
58 | if (protset & PROT_IPv4 ) return PROT_IPv4; |
59 | return PROT_IPv4; |
59 | if (protset & PROT_UDPv4) return PROT_UDPv4; |
|
|
60 | if (protset & PROT_TCPv4) return PROT_TCPv4; |
60 | |
61 | |
61 | return PROT_UDPv4; |
62 | return 0; |
62 | } |
63 | } |
63 | |
64 | |
64 | const char *strprotocol (u8 protocol) |
65 | const char *strprotocol (u8 protocol) |
65 | { |
66 | { |
66 | if (protocol & PROT_IPv4 ) return "rawip"; |
67 | if (protocol & PROT_IPv4 ) return "rawip"; |
… | |
… | |
87 | keepalive = DEFAULT_KEEPALIVE; |
88 | keepalive = DEFAULT_KEEPALIVE; |
88 | llevel = L_INFO; |
89 | llevel = L_INFO; |
89 | ip_proto = IPPROTO_GRE; |
90 | ip_proto = IPPROTO_GRE; |
90 | |
91 | |
91 | default_node.udp_port = DEFAULT_UDPPORT; |
92 | default_node.udp_port = DEFAULT_UDPPORT; |
|
|
93 | default_node.tcp_port = DEFAULT_UDPPORT; |
92 | default_node.connectmode = conf_node::C_ALWAYS; |
94 | default_node.connectmode = conf_node::C_ALWAYS; |
93 | default_node.compress = true; |
95 | default_node.compress = true; |
94 | default_node.protocols = PROT_UDPv4; |
96 | default_node.protocols = PROT_UDPv4; |
95 | } |
97 | } |
96 | |
98 | |
… | |
… | |
280 | } |
282 | } |
281 | |
283 | |
282 | /* node-specific, defaultable */ |
284 | /* node-specific, defaultable */ |
283 | else if (!strcmp (var, "udp-port")) |
285 | else if (!strcmp (var, "udp-port")) |
284 | node->udp_port = atoi (val); |
286 | node->udp_port = atoi (val); |
|
|
287 | else if (!strcmp (var, "tcp-port")) |
|
|
288 | node->tcp_port = atoi (val); |
285 | else if (!strcmp (var, "router-priority")) |
289 | else if (!strcmp (var, "router-priority")) |
286 | node->routerprio = atoi (val); |
290 | node->routerprio = atoi (val); |
287 | else if (!strcmp (var, "connect")) |
291 | else if (!strcmp (var, "connect")) |
288 | { |
292 | { |
289 | if (!strcmp (val, "ondemand")) |
293 | if (!strcmp (val, "ondemand")) |
… | |
… | |
306 | else if (!strcmp (var, "compress")) |
310 | else if (!strcmp (var, "compress")) |
307 | { |
311 | { |
308 | parse_bool (node->compress, "compress", true, false); |
312 | parse_bool (node->compress, "compress", true, false); |
309 | } |
313 | } |
310 | // all these bool options really really cost a lot of executable size! |
314 | // all these bool options really really cost a lot of executable size! |
|
|
315 | else if (!strcmp (var, "enable-tcp")) |
|
|
316 | { |
|
|
317 | u8 v; parse_bool (v, "enable-tcp" , PROT_TCPv4, 0); node->protocols = (node->protocols & ~PROT_TCPv4) | v; |
|
|
318 | } |
311 | else if (!strcmp (var, "enable-udp")) |
319 | else if (!strcmp (var, "enable-udp")) |
312 | { |
320 | { |
313 | u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v; |
321 | u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v; |
314 | } |
322 | } |
315 | else if (!strcmp (var, "enable-rawip")) |
323 | else if (!strcmp (var, "enable-rawip")) |