diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-28 13:26:19 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-28 13:26:19 +0000 |
commit | 80a7c5fe311c13c34411440a98d6d0398c7d3fe6 (patch) | |
tree | 2673db997a6a88e6f392afd06f0c8efbffb42087 | |
parent | 566fc18ca04fabe5bba4c697666bafa61b7fc000 (diff) | |
download | gnunet-80a7c5fe311c13c34411440a98d6d0398c7d3fe6.tar.gz gnunet-80a7c5fe311c13c34411440a98d6d0398c7d3fe6.zip |
docu
-rw-r--r-- | src/transport/gnunet-service-transport_blacklist.c | 34 | ||||
-rw-r--r-- | src/transport/test_transport_blacklisting.c | 10 |
2 files changed, 37 insertions, 7 deletions
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index b1a0047f7..8599f6f24 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c | |||
@@ -21,7 +21,38 @@ | |||
21 | /** | 21 | /** |
22 | * @file transport/gnunet-service-transport_blacklist.c | 22 | * @file transport/gnunet-service-transport_blacklist.c |
23 | * @brief blacklisting implementation | 23 | * @brief blacklisting implementation |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff, Matthias Wachs |
25 | * @details This is the blacklisting component of transport service. With | ||
26 | * blacklisting it is possible to deny connections to specific peers of | ||
27 | * to use a specific plugin to a specific peer. Peers can be blacklisted using | ||
28 | * the configuration or a blacklist client can be asked. | ||
29 | * | ||
30 | * To blacklist peers using the configuration you have to add a section to your | ||
31 | * configuration containing the peer id of the peer to blacklist and the plugin | ||
32 | * if required. | ||
33 | * | ||
34 | * Example: | ||
35 | * To blacklist connections to P565... on peer AG2P... using tcp add: | ||
36 | * [transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520] | ||
37 | * P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp | ||
38 | * | ||
39 | * To blacklist connections to P565... on peer AG2P... using all plugins add: | ||
40 | * [transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520] | ||
41 | * P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = | ||
42 | * | ||
43 | * You can also add a blacklist client usign the blacklist api. On a blacklist | ||
44 | * check, blacklisting first checks internally if the peer is blacklisted and | ||
45 | * if not, it asks the blacklisting clients. Clients are asked if it is OK to | ||
46 | * connect to a peer ID, the plugin is omitted. | ||
47 | * | ||
48 | * On blacklist check for (peer, plugin) | ||
49 | * - Do we have a local blacklist entry for this peer and this plugin? | ||
50 | * - YES: disallow connection | ||
51 | * - Do we have a local blacklist entry for this peer and all plugins? | ||
52 | * - YES: disallow connection | ||
53 | * - Does one of the clients disallow? | ||
54 | * - YES: disallow connection | ||
55 | * | ||
25 | */ | 56 | */ |
26 | #include "platform.h" | 57 | #include "platform.h" |
27 | #include "gnunet-service-transport.h" | 58 | #include "gnunet-service-transport.h" |
@@ -29,7 +60,6 @@ | |||
29 | #include "gnunet-service-transport_neighbours.h" | 60 | #include "gnunet-service-transport_neighbours.h" |
30 | #include "transport.h" | 61 | #include "transport.h" |
31 | 62 | ||
32 | |||
33 | /** | 63 | /** |
34 | * Size of the blacklist hash map. | 64 | * Size of the blacklist hash map. |
35 | */ | 65 | */ |
diff --git a/src/transport/test_transport_blacklisting.c b/src/transport/test_transport_blacklisting.c index b75da26d1..f0f5a2b63 100644 --- a/src/transport/test_transport_blacklisting.c +++ b/src/transport/test_transport_blacklisting.c | |||
@@ -158,7 +158,7 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | |||
158 | static void | 158 | static void |
159 | connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 159 | connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
160 | { | 160 | { |
161 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers not connected, next stage\n"); | 161 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peers not connected, next stage\n"); |
162 | timeout_task = GNUNET_SCHEDULER_NO_TASK; | 162 | timeout_task = GNUNET_SCHEDULER_NO_TASK; |
163 | stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL); | 163 | stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL); |
164 | } | 164 | } |
@@ -178,7 +178,7 @@ start_cb (struct PeerContext *p, void *cls) | |||
178 | 178 | ||
179 | char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); | 179 | char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); |
180 | 180 | ||
181 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 181 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
182 | "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n", | 182 | "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n", |
183 | p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id)); | 183 | p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id)); |
184 | GNUNET_free (sender_c); | 184 | GNUNET_free (sender_c); |
@@ -195,7 +195,7 @@ run_stage (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
195 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | 195 | if (GNUNET_SCHEDULER_NO_TASK != die_task) |
196 | GNUNET_SCHEDULER_cancel (die_task); | 196 | GNUNET_SCHEDULER_cancel (die_task); |
197 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | 197 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); |
198 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Running stage %u\n", stage); | 198 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Running stage %u\n", stage); |
199 | 199 | ||
200 | if (0 == stage) | 200 | if (0 == stage) |
201 | { | 201 | { |
@@ -282,7 +282,7 @@ run_stage (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
282 | p2 = NULL; | 282 | p2 = NULL; |
283 | } | 283 | } |
284 | 284 | ||
285 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Done in stage %u: Peers %s and %s!\n", stage, | 285 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done in stage %u: Peers %s and %s!\n", stage, |
286 | (GNUNET_NO == started) ? "NOT STARTED" : "STARTED", | 286 | (GNUNET_NO == started) ? "NOT STARTED" : "STARTED", |
287 | (GNUNET_YES == connected) ? "CONNECTED" : "NOT CONNECTED"); | 287 | (GNUNET_YES == connected) ? "CONNECTED" : "NOT CONNECTED"); |
288 | 288 | ||
@@ -315,7 +315,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
315 | { | 315 | { |
316 | connected = GNUNET_NO; | 316 | connected = GNUNET_NO; |
317 | stage = 0; | 317 | stage = 0; |
318 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Running test `%s'!\n", test_name); | 318 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running test `%s'!\n", test_name); |
319 | stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL); | 319 | stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL); |
320 | } | 320 | } |
321 | 321 | ||