… | |
… | |
60 | struct configuration conf; |
60 | struct configuration conf; |
61 | |
61 | |
62 | u8 |
62 | u8 |
63 | best_protocol (u8 protset) |
63 | best_protocol (u8 protset) |
64 | { |
64 | { |
|
|
65 | #if 1//D2 |
|
|
66 | if (protset & PROT_IPv42 ) return PROT_IPv42; |
|
|
67 | #endif |
65 | if (protset & PROT_IPv4 ) return PROT_IPv4; |
68 | if (protset & PROT_IPv4 ) return PROT_IPv4; |
66 | if (protset & PROT_ICMPv4) return PROT_ICMPv4; |
69 | if (protset & PROT_ICMPv4) return PROT_ICMPv4; |
67 | if (protset & PROT_UDPv4 ) return PROT_UDPv4; |
70 | if (protset & PROT_UDPv4 ) return PROT_UDPv4; |
68 | if (protset & PROT_TCPv4 ) return PROT_TCPv4; |
71 | if (protset & PROT_TCPv4 ) return PROT_TCPv4; |
69 | if (protset & PROT_DNSv4 ) return PROT_DNSv4; |
72 | if (protset & PROT_DNSv4 ) return PROT_DNSv4; |
… | |
… | |
72 | } |
75 | } |
73 | |
76 | |
74 | const char * |
77 | const char * |
75 | strprotocol (u8 protocol) |
78 | strprotocol (u8 protocol) |
76 | { |
79 | { |
|
|
80 | #if 1//D2 |
|
|
81 | if (protocol & PROT_IPv42 ) return "rawip2"; |
|
|
82 | #endif |
77 | if (protocol & PROT_IPv4 ) return "rawip"; |
83 | if (protocol & PROT_IPv4 ) return "rawip"; |
78 | if (protocol & PROT_ICMPv4) return "icmp"; |
84 | if (protocol & PROT_ICMPv4) return "icmp"; |
79 | if (protocol & PROT_UDPv4 ) return "udp"; |
85 | if (protocol & PROT_UDPv4 ) return "udp"; |
80 | if (protocol & PROT_TCPv4 ) return "tcp"; |
86 | if (protocol & PROT_TCPv4 ) return "tcp"; |
81 | if (protocol & PROT_DNSv4 ) return "dns"; |
87 | if (protocol & PROT_DNSv4 ) return "dns"; |
… | |
… | |
134 | nfmark = 0; |
140 | nfmark = 0; |
135 | rekey = DEFAULT_REKEY; |
141 | rekey = DEFAULT_REKEY; |
136 | keepalive = DEFAULT_KEEPALIVE; |
142 | keepalive = DEFAULT_KEEPALIVE; |
137 | llevel = L_INFO; |
143 | llevel = L_INFO; |
138 | ip_proto = IPPROTO_GRE; |
144 | ip_proto = IPPROTO_GRE; |
|
|
145 | #if 1 //D2 |
|
|
146 | ip2_proto = 7; |
|
|
147 | #endif |
139 | #if ENABLE_ICMP |
148 | #if ENABLE_ICMP |
140 | icmp_type = ICMP_ECHOREPLY; |
149 | icmp_type = ICMP_ECHOREPLY; |
141 | #endif |
150 | #endif |
142 | |
151 | |
143 | default_node.udp_port = DEFAULT_UDPPORT; |
152 | default_node.udp_port = DEFAULT_UDPPORT; |
… | |
… | |
267 | if (l == L_NONE) |
276 | if (l == L_NONE) |
268 | return _("unknown loglevel, ignored"); |
277 | return _("unknown loglevel, ignored"); |
269 | } |
278 | } |
270 | else if (!strcmp (var, "ip-proto")) |
279 | else if (!strcmp (var, "ip-proto")) |
271 | conf.ip_proto = atoi (val); |
280 | conf.ip_proto = atoi (val); |
|
|
281 | #if 1 //D2 |
|
|
282 | else if (!strcmp (var, "ip2-proto")) |
|
|
283 | conf.ip2_proto = atoi (val); |
|
|
284 | #endif |
272 | else if (!strcmp (var, "icmp-type")) |
285 | else if (!strcmp (var, "icmp-type")) |
273 | { |
286 | { |
274 | #if ENABLE_ICMP |
287 | #if ENABLE_ICMP |
275 | conf.icmp_type = atoi (val); |
288 | conf.icmp_type = atoi (val); |
276 | #endif |
289 | #endif |
… | |
… | |
482 | } |
495 | } |
483 | else if (!strcmp (var, "enable-rawip")) |
496 | else if (!strcmp (var, "enable-rawip")) |
484 | { |
497 | { |
485 | u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v; |
498 | u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v; |
486 | } |
499 | } |
|
|
500 | #if 1//D2 |
|
|
501 | else if (!strcmp (var, "enable-rawip2")) |
|
|
502 | { |
|
|
503 | u8 v; parse_bool (v, "enable-rawip2", PROT_IPv42, 0); node->protocols = (node->protocols & ~PROT_IPv42 ) | v; |
|
|
504 | } |
|
|
505 | #endif |
487 | else if (!strcmp (var, "allow-direct")) |
506 | else if (!strcmp (var, "allow-direct")) |
488 | node->allow_direct.push_back (strdup (val)); |
507 | node->allow_direct.push_back (strdup (val)); |
489 | else if (!strcmp (var, "deny-direct")) |
508 | else if (!strcmp (var, "deny-direct")) |
490 | node->deny_direct.push_back (strdup (val)); |
509 | node->deny_direct.push_back (strdup (val)); |
491 | else if (!strcmp (var, "max-ttl")) |
510 | else if (!strcmp (var, "max-ttl")) |