[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33564 - in gnunet: . src/dht src/include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33564 - in gnunet: . src/dht src/include |
Date: |
Fri, 6 Jun 2014 14:01:32 +0200 |
Author: harsha
Date: 2014-06-06 14:01:32 +0200 (Fri, 06 Jun 2014)
New Revision: 33564
Modified:
gnunet/configure.ac
gnunet/src/dht/dht.h
gnunet/src/dht/gnunet-service-xdht.c
gnunet/src/dht/gnunet-service-xdht_clients.c
gnunet/src/include/gnunet_dht_service.h
gnunet/src/include/gnunet_protocols.h
Log:
Enable (X)DHT service to be compiled with malicious code.
Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2014-06-06 11:55:14 UTC (rev 33563)
+++ gnunet/configure.ac 2014-06-06 12:01:32 UTC (rev 33564)
@@ -1209,6 +1209,23 @@
AC_MSG_RESULT($enable_experimental)
AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
+# should malicious code be compiled (should only be used for testing)?
+AC_MSG_CHECKING(whether to compile malicious code)
+AC_ARG_ENABLE([malicious],
+ [AS_HELP_STRING([--enable-malicious], [enable compiling malicious code])],
+ [if test "x$enableval" = "xno"
+ then
+ malicious=0
+ else
+ malicious=1
+ fi],
+ [malicious=0
+ enable_malicious=no])
+AC_MSG_RESULT($enable_malicious)
+AM_CONDITIONAL([ENABLE_MALICIOUS], [$malicious])
+AC_DEFINE_UNQUOTED([ENABLE_MALICIOUS], [$malicious],
+ [enable compilation of malicious code])
+
# should services be started by default when a peer starts? Some services may
# choose to never start by default and it is upto the service/module developer
to
# decide it by having "AUTOSTART = NO" instead of "AUTOSTART = @AUTOSTART" in
Modified: gnunet/src/dht/dht.h
===================================================================
--- gnunet/src/dht/dht.h 2014-06-06 11:55:14 UTC (rev 33563)
+++ gnunet/src/dht/dht.h 2014-06-06 12:01:32 UTC (rev 33564)
@@ -441,6 +441,24 @@
};
+#if ENABLE_MALICIOUS
+/**
+ * Message to turn the service malicious
+ */
+struct GNUNET_DHT_ActMaliciousMessage
+{
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_ACT_MALICIOUS
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Type of malicious behaviour expected; 0 turning peer benign
+ */
+ uint32_t action;
+};
+#endif
+
GNUNET_NETWORK_STRUCT_END
#endif
Modified: gnunet/src/dht/gnunet-service-xdht.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht.c 2014-06-06 11:55:14 UTC (rev
33563)
+++ gnunet/src/dht/gnunet-service-xdht.c 2014-06-06 12:01:32 UTC (rev
33564)
@@ -77,7 +77,14 @@
*/
struct GNUNET_TIME_Relative hello_expiration;
+#if ENABLE_MALICIOUS
+/**
+ * Should this peer act malicious?
+ */
+unsigned int malicious;
+#endif
+
/**
* Receive the HELLO from transport service, free current and replace
* if necessary.
Modified: gnunet/src/dht/gnunet-service-xdht_clients.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_clients.c 2014-06-06 11:55:14 UTC
(rev 33563)
+++ gnunet/src/dht/gnunet-service-xdht_clients.c 2014-06-06 12:01:32 UTC
(rev 33564)
@@ -43,7 +43,14 @@
#define LOG(kind,...) GNUNET_log_from (kind, "dht-clients",__VA_ARGS__)
+#if ENABLE_MALICIOUS
/**
+ * Should this peer act malicious?
+ */
+extern unsigned int malicious;
+#endif
+
+/**
* Linked list of messages to send to clients.
*/
struct PendingMessage
@@ -1303,7 +1310,26 @@
}
+#if ENABLE_MALICIOUS
/**
+ * Handler for monitor stop messages
+ *
+ * @param cls closure for the service
+ * @param client the client we received this message from
+ * @param message the actual message received
+ *
+ */
+static void
+handle_dht_act_malicious (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
+{
+ /* FIXME: parse message and set malicious */
+ malicious = 1;
+}
+#endif
+
+
+/**
* Functions with this signature are called whenever a client
* is disconnected on the network level.
*
@@ -1378,6 +1404,11 @@
sizeof (struct GNUNET_DHT_MonitorStartStopMessage)},
{&handle_dht_local_get_result_seen, NULL,
GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN, 0},
+ #if ENABLE_MALICIOUS
+ {&handle_dht_act_malicious, NULL,
+ GNUNET_MESSAGE_TYPE_DHT_ACT_MALICIOUS,
+ sizeof (struct GNUNET_DHT_ActMaliciousMessage)},
+ #endif
{NULL, NULL, 0, 0}
};
forward_map = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO);
Modified: gnunet/src/include/gnunet_dht_service.h
===================================================================
--- gnunet/src/include/gnunet_dht_service.h 2014-06-06 11:55:14 UTC (rev
33563)
+++ gnunet/src/include/gnunet_dht_service.h 2014-06-06 12:01:32 UTC (rev
33564)
@@ -391,6 +391,19 @@
GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle);
+#if ENABLE_MALICIOUS
+/**
+ * Turn the DHT service to act malicious depending on @a flag
+ *
+ * @param handle the DHT handle
+ * @param action 1 to make the service malicious; 0 to make it benign
+ FIXME: perhaps make this an enum of known malicious behaviors?
+ */
+void
+GNUNET_DHT_malicious (struct GNUNET_DHT_Handle *handle, unsigned int action);
+#endif
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h 2014-06-06 11:55:14 UTC (rev
33563)
+++ gnunet/src/include/gnunet_protocols.h 2014-06-06 12:01:32 UTC (rev
33564)
@@ -611,54 +611,9 @@
#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN 156
/**
- * Trail setup request is received by a peer.
+ * Further X-VINE DHT messages continued from 880
*/
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP 157
-/**
- * Trail to a particular peer is returned to this peer.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_RESULT 158
-
-/**
- * Verify if your immediate successor is still your immediate successor.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR 159
-
-/**
- * Notify your new immediate successor that you are its new predecessor.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_NOTIFY_NEW_SUCCESSOR 160
-
-/**
- * Message which contains the immediate predecessor of requested successor
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR_RESULT 161
-
-/**
- * Message which contains the get result.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_GET_RESULT 162
-
-/**
- * Trail Rejection Message.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_REJECTION 163
-
-/**
- * Trail Tear down Message.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_TEARDOWN 164
-
-/**
- * Routing table add message.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_ADD_TRAIL 165
-
-/**
- * Trail compression message.
- */
-#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_COMPRESSION 166
/*******************************************************************************
* HOSTLIST message types
******************************************************************************/
@@ -2537,13 +2492,74 @@
/** C->S->P: decision about a join request */
#define GNUNET_MESSAGE_TYPE_SOCIAL_JOIN_DECISION 848
+/*******************************************************************************
+ * X-VINE DHT messages
+
******************************************************************************/
/**
- * Next available: 880
+ * Trail setup request is received by a peer.
*/
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP 880
+/**
+ * Trail to a particular peer is returned to this peer.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_RESULT 881
/**
+ * Verify if your immediate successor is still your immediate successor.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR 882
+
+/**
+ * Notify your new immediate successor that you are its new predecessor.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_NOTIFY_NEW_SUCCESSOR 883
+
+/**
+ * Message which contains the immediate predecessor of requested successor
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR_RESULT 884
+
+/**
+ * Message which contains the get result.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_GET_RESULT 885
+
+/**
+ * Trail Rejection Message.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_REJECTION 886
+
+/**
+ * Trail Tear down Message.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_TEARDOWN 887
+
+/**
+ * Routing table add message.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_ADD_TRAIL 888
+
+/**
+ * Trail compression message.
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_COMPRESSION 889
+
+#if ENABLE_MALICIOUS
+/**
+ * Turn X-VINE DHT service malicious
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_ACT_MALICIOUS 890
+#endif
+
+/*******************************************************************************/
+
+/**
+ * Next available: 900
+ */
+
+/**
* Type used to match 'all' message types.
*/
#define GNUNET_MESSAGE_TYPE_ALL 65535
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33564 - in gnunet: . src/dht src/include,
gnunet <=