diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-03-23 15:19:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-03-23 15:19:59 +0000 |
commit | e1021601b1c0f17ab7ffd51badecc247902e0e2a (patch) | |
tree | db5d88b00020ea8214e53075797eae5c0c54b706 /src/dns | |
parent | 1bbe97fc3dcf3436e5e07e715c03901e1f18e4b6 (diff) | |
download | gnunet-e1021601b1c0f17ab7ffd51badecc247902e0e2a.tar.gz gnunet-e1021601b1c0f17ab7ffd51badecc247902e0e2a.zip |
-start DNS service to do external evals even if we have no hijacker
Diffstat (limited to 'src/dns')
-rw-r--r-- | src/dns/dns.h | 10 | ||||
-rw-r--r-- | src/dns/gnunet-service-dns.c | 51 |
2 files changed, 37 insertions, 24 deletions
diff --git a/src/dns/dns.h b/src/dns/dns.h index ceaa6f87a..5d0daeac5 100644 --- a/src/dns/dns.h +++ b/src/dns/dns.h | |||
@@ -35,14 +35,14 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
35 | struct GNUNET_DNS_Register | 35 | struct GNUNET_DNS_Register |
36 | { | 36 | { |
37 | /** | 37 | /** |
38 | * Header of type GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT | 38 | * Header of type #GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT |
39 | */ | 39 | */ |
40 | struct GNUNET_MessageHeader header; | 40 | struct GNUNET_MessageHeader header; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * NBO encoding of 'enum GNUNET_DNS_Flags' for the client. | 43 | * NBO encoding of `enum GNUNET_DNS_Flags` for the client. |
44 | */ | 44 | */ |
45 | uint32_t flags; | 45 | uint32_t flags GNUNET_PACKED; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | 48 | ||
@@ -52,7 +52,7 @@ struct GNUNET_DNS_Register | |||
52 | struct GNUNET_DNS_Request | 52 | struct GNUNET_DNS_Request |
53 | { | 53 | { |
54 | /** | 54 | /** |
55 | * Header of type GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST | 55 | * Header of type #GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST |
56 | */ | 56 | */ |
57 | struct GNUNET_MessageHeader header; | 57 | struct GNUNET_MessageHeader header; |
58 | 58 | ||
@@ -77,7 +77,7 @@ struct GNUNET_DNS_Request | |||
77 | struct GNUNET_DNS_Response | 77 | struct GNUNET_DNS_Response |
78 | { | 78 | { |
79 | /** | 79 | /** |
80 | * Header of type GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE | 80 | * Header of type #GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE |
81 | */ | 81 | */ |
82 | struct GNUNET_MessageHeader header; | 82 | struct GNUNET_MessageHeader header; |
83 | 83 | ||
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c index 1759b9003..828231944 100644 --- a/src/dns/gnunet-service-dns.c +++ b/src/dns/gnunet-service-dns.c | |||
@@ -281,8 +281,11 @@ cleanup_task (void *cls GNUNET_UNUSED, | |||
281 | { | 281 | { |
282 | unsigned int i; | 282 | unsigned int i; |
283 | 283 | ||
284 | GNUNET_HELPER_stop (hijacker, GNUNET_NO); | 284 | if (NULL != hijacker) |
285 | hijacker = NULL; | 285 | { |
286 | GNUNET_HELPER_stop (hijacker, GNUNET_NO); | ||
287 | hijacker = NULL; | ||
288 | } | ||
286 | for (i=0;i<7;i++) | 289 | for (i=0;i<7;i++) |
287 | GNUNET_free_non_null (helper_argv[i]); | 290 | GNUNET_free_non_null (helper_argv[i]); |
288 | for (i=0;i<=UINT16_MAX;i++) | 291 | for (i=0;i<=UINT16_MAX;i++) |
@@ -1041,37 +1044,49 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1041 | char *binary; | 1044 | char *binary; |
1042 | 1045 | ||
1043 | cfg = cfg_; | 1046 | cfg = cfg_; |
1044 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-dns"); | ||
1045 | if (GNUNET_YES != | ||
1046 | GNUNET_OS_check_helper_binary (binary, GNUNET_YES, NULL)) // TODO: once we have a windows-testcase, add test parameters here | ||
1047 | { | ||
1048 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1049 | _("`%s' must be installed SUID, refusing to run\n"), | ||
1050 | binary); | ||
1051 | global_ret = 1; | ||
1052 | GNUNET_free (binary); | ||
1053 | return; | ||
1054 | } | ||
1055 | GNUNET_free (binary); | ||
1056 | stats = GNUNET_STATISTICS_create ("dns", cfg); | 1047 | stats = GNUNET_STATISTICS_create ("dns", cfg); |
1057 | nc = GNUNET_SERVER_notification_context_create (server, 1); | 1048 | nc = GNUNET_SERVER_notification_context_create (server, 1); |
1058 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task, | 1049 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
1050 | &cleanup_task, | ||
1059 | cls); | 1051 | cls); |
1060 | dns_exit = NULL; | 1052 | dns_exit = NULL; |
1061 | if ( ( (GNUNET_OK != | 1053 | if ( ( (GNUNET_OK != |
1062 | GNUNET_CONFIGURATION_get_value_string (cfg, "dns", | 1054 | GNUNET_CONFIGURATION_get_value_string (cfg, |
1055 | "dns", | ||
1063 | "DNS_EXIT", | 1056 | "DNS_EXIT", |
1064 | &dns_exit)) || | 1057 | &dns_exit)) || |
1065 | ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) && | 1058 | ( (1 != inet_pton (AF_INET, dns_exit, &dns_exit4)) && |
1066 | (1 != inet_pton (AF_INET6, dns_exit, &dns_exit6)) ) ) ) | 1059 | (1 != inet_pton (AF_INET6, dns_exit, &dns_exit6)) ) ) ) |
1067 | { | 1060 | { |
1068 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "dns", "DNS_EXIT", | 1061 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, |
1062 | "dns", | ||
1063 | "DNS_EXIT", | ||
1069 | _("need a valid IPv4 or IPv6 address\n")); | 1064 | _("need a valid IPv4 or IPv6 address\n")); |
1070 | GNUNET_free_non_null (dns_exit); | 1065 | GNUNET_free_non_null (dns_exit); |
1071 | dns_exit = NULL; | 1066 | dns_exit = NULL; |
1072 | } | 1067 | } |
1073 | dnsstub = GNUNET_DNSSTUB_start (dns_exit); | 1068 | dnsstub = GNUNET_DNSSTUB_start (dns_exit); |
1074 | GNUNET_free_non_null (dns_exit); | 1069 | GNUNET_free_non_null (dns_exit); |
1070 | GNUNET_SERVER_add_handlers (server, | ||
1071 | handlers); | ||
1072 | GNUNET_SERVER_disconnect_notify (server, | ||
1073 | &client_disconnect, | ||
1074 | NULL); | ||
1075 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-dns"); | ||
1076 | if (GNUNET_YES != | ||
1077 | GNUNET_OS_check_helper_binary (binary, | ||
1078 | GNUNET_YES, | ||
1079 | NULL)) // TODO: once we have a windows-testcase, add test parameters here | ||
1080 | { | ||
1081 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1082 | _("`%s' must be installed SUID, will not run DNS interceptor\n"), | ||
1083 | binary); | ||
1084 | global_ret = 1; | ||
1085 | GNUNET_free (binary); | ||
1086 | return; | ||
1087 | } | ||
1088 | GNUNET_free (binary); | ||
1089 | |||
1075 | helper_argv[0] = GNUNET_strdup ("gnunet-dns"); | 1090 | helper_argv[0] = GNUNET_strdup ("gnunet-dns"); |
1076 | if (GNUNET_SYSERR == | 1091 | if (GNUNET_SYSERR == |
1077 | GNUNET_CONFIGURATION_get_value_string (cfg, "dns", "IFNAME", &ifc_name)) | 1092 | GNUNET_CONFIGURATION_get_value_string (cfg, "dns", "IFNAME", &ifc_name)) |
@@ -1129,8 +1144,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1129 | helper_argv, | 1144 | helper_argv, |
1130 | &process_helper_messages, | 1145 | &process_helper_messages, |
1131 | NULL, NULL); | 1146 | NULL, NULL); |
1132 | GNUNET_SERVER_add_handlers (server, handlers); | ||
1133 | GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL); | ||
1134 | } | 1147 | } |
1135 | 1148 | ||
1136 | 1149 | ||