… | |
… | |
32 | #include <sys/stat.h> |
32 | #include <sys/stat.h> |
33 | #include <sys/types.h> |
33 | #include <sys/types.h> |
34 | #include <unistd.h> |
34 | #include <unistd.h> |
35 | |
35 | |
36 | #include <netinet/in.h> |
36 | #include <netinet/in.h> |
|
|
37 | #include <arpa/inet.h> |
|
|
38 | #ifdef ENABLE_ICMP |
|
|
39 | # ifdef HAVE_NETINET_IN_SYSTM_H |
|
|
40 | # include <netinet/in_systm.h> |
|
|
41 | # endif |
|
|
42 | # ifdef HAVE_NETINET_IP_H |
|
|
43 | # include <netinet/ip.h> |
|
|
44 | # endif |
37 | #include <netinet/ip_icmp.h> |
45 | # include <netinet/ip_icmp.h> |
|
|
46 | #endif |
38 | |
47 | |
39 | #include <openssl/err.h> |
48 | #include <openssl/err.h> |
40 | #include <openssl/pem.h> |
49 | #include <openssl/pem.h> |
41 | #include <openssl/rsa.h> |
50 | #include <openssl/rsa.h> |
42 | #include <openssl/rand.h> |
51 | #include <openssl/rand.h> |
… | |
… | |
106 | |
115 | |
107 | rekey = DEFAULT_REKEY; |
116 | rekey = DEFAULT_REKEY; |
108 | keepalive = DEFAULT_KEEPALIVE; |
117 | keepalive = DEFAULT_KEEPALIVE; |
109 | llevel = L_INFO; |
118 | llevel = L_INFO; |
110 | ip_proto = IPPROTO_GRE; |
119 | ip_proto = IPPROTO_GRE; |
|
|
120 | #if ENABLE_ICMP |
111 | icmp_type = ICMP_ECHOREPLY; |
121 | icmp_type = ICMP_ECHOREPLY; |
|
|
122 | #endif |
112 | |
123 | |
113 | default_node.udp_port = DEFAULT_UDPPORT; |
124 | default_node.udp_port = DEFAULT_UDPPORT; |
114 | default_node.tcp_port = DEFAULT_UDPPORT; |
125 | default_node.tcp_port = DEFAULT_UDPPORT; |
115 | default_node.connectmode = conf_node::C_ALWAYS; |
126 | default_node.connectmode = conf_node::C_ALWAYS; |
116 | default_node.compress = true; |
127 | default_node.compress = true; |
… | |
… | |
227 | else |
238 | else |
228 | slog (L_WARN, "'%s': %s, at '%s' line %d", val, UNKNOWN_LOGLEVEL, fname, line); |
239 | slog (L_WARN, "'%s': %s, at '%s' line %d", val, UNKNOWN_LOGLEVEL, fname, line); |
229 | } |
240 | } |
230 | else if (!strcmp (var, "ip-proto")) |
241 | else if (!strcmp (var, "ip-proto")) |
231 | ip_proto = atoi (val); |
242 | ip_proto = atoi (val); |
|
|
243 | #if ENABLE_ICMP |
|
|
244 | //TODO: error message |
232 | else if (!strcmp (var, "icmp-type")) |
245 | else if (!strcmp (var, "icmp-type")) |
233 | icmp_type = atoi (val); |
246 | icmp_type = atoi (val); |
|
|
247 | #endif |
234 | |
248 | |
235 | // per config |
249 | // per config |
236 | else if (!strcmp (var, "node")) |
250 | else if (!strcmp (var, "node")) |
237 | { |
251 | { |
238 | default_node.id++; |
252 | default_node.id++; |
… | |
… | |
438 | printf (_("MTU: %d\n"), mtu); |
452 | printf (_("MTU: %d\n"), mtu); |
439 | printf (_("rekeying interval: %d\n"), rekey); |
453 | printf (_("rekeying interval: %d\n"), rekey); |
440 | printf (_("keepalive interval: %d\n"), keepalive); |
454 | printf (_("keepalive interval: %d\n"), keepalive); |
441 | printf (_("interface: %s\n"), ifname); |
455 | printf (_("interface: %s\n"), ifname); |
442 | printf (_("primary rsa key: %s\n"), prikeyfile ? prikeyfile : "<default>"); |
456 | printf (_("primary rsa key: %s\n"), prikeyfile ? prikeyfile : "<default>"); |
443 | printf (_("rsa key size: %d\n"), rsa_key ? RSA_size (rsa_key) : -1); |
457 | printf (_("rsa key size: %d\n"), rsa_key ? RSA_size (rsa_key) * 8 : -1); |
444 | printf ("\n"); |
458 | printf ("\n"); |
445 | |
459 | |
446 | printf ("%4s %-17s %s %-8.8s %-10.10s %s\n", |
460 | printf ("%4s %-17s %s %-8.8s %-10.10s %s\n", |
447 | _("ID#"), _("MAC"), _("Com"), _("Conmode"), _("Node"), _("Host:Port")); |
461 | _("ID#"), _("MAC"), _("Com"), _("Conmode"), _("Node"), _("Host:Port")); |
448 | |
462 | |