diff options
-rw-r--r-- | src/dv/gnunet-service-dv.c | 27 | ||||
-rw-r--r-- | src/dv/plugin_transport_dv.c | 5 |
2 files changed, 22 insertions, 10 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 670fbb0d2..4d88d1079 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -651,8 +651,8 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
651 | * @param target where to send the message | 651 | * @param target where to send the message |
652 | * @param distance expected (remaining) distance to the target | 652 | * @param distance expected (remaining) distance to the target |
653 | * @param uid unique ID for the message | 653 | * @param uid unique ID for the message |
654 | * @param actual_target ultimate recipient for the message | ||
655 | * @param sender original sender of the message | 654 | * @param sender original sender of the message |
655 | * @param actual_target ultimate recipient for the message | ||
656 | * @param payload payload of the message | 656 | * @param payload payload of the message |
657 | */ | 657 | */ |
658 | static void | 658 | static void |
@@ -1758,16 +1758,27 @@ handle_dv_route_message (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1758 | struct Route *route; | 1758 | struct Route *route; |
1759 | struct DirectNeighbor *neighbor; | 1759 | struct DirectNeighbor *neighbor; |
1760 | uint32_t distance; | 1760 | uint32_t distance; |
1761 | char me[5]; | ||
1762 | char src[5]; | ||
1763 | char prev[5]; | ||
1764 | char dst[5]; | ||
1761 | 1765 | ||
1762 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1763 | "Handling DV message from %s\n", | ||
1764 | GNUNET_i2s (peer)); | ||
1765 | if (ntohs (message->size) < sizeof (struct RouteMessage) + sizeof (struct GNUNET_MessageHeader)) | 1766 | if (ntohs (message->size) < sizeof (struct RouteMessage) + sizeof (struct GNUNET_MessageHeader)) |
1766 | { | 1767 | { |
1767 | GNUNET_break_op (0); | 1768 | GNUNET_break_op (0); |
1768 | return GNUNET_SYSERR; | 1769 | return GNUNET_SYSERR; |
1769 | } | 1770 | } |
1770 | rm = (const struct RouteMessage *) message; | 1771 | rm = (const struct RouteMessage *) message; |
1772 | strncpy (prev, GNUNET_i2s (peer), 4); | ||
1773 | strncpy (me, GNUNET_i2s (&my_identity), 4); | ||
1774 | strncpy (src, GNUNET_i2s (&rm->sender), 4); | ||
1775 | strncpy (dst, GNUNET_i2s (&rm->target), 4); | ||
1776 | prev[4] = me[4] = src[4] = dst[4] = '\0'; | ||
1777 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1778 | "Handling DV message from %s to %s routed by %s to me (%s)\n", | ||
1779 | src, dst, | ||
1780 | prev, me); | ||
1781 | |||
1771 | payload = (const struct GNUNET_MessageHeader *) &rm[1]; | 1782 | payload = (const struct GNUNET_MessageHeader *) &rm[1]; |
1772 | if (ntohs (message->size) != sizeof (struct RouteMessage) + ntohs (payload->size)) | 1783 | if (ntohs (message->size) != sizeof (struct RouteMessage) + ntohs (payload->size)) |
1773 | { | 1784 | { |
@@ -1806,7 +1817,7 @@ handle_dv_route_message (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1806 | if (NULL == route) | 1817 | if (NULL == route) |
1807 | { | 1818 | { |
1808 | neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, | 1819 | neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, |
1809 | peer); | 1820 | &rm->target); |
1810 | if (NULL == neighbor) | 1821 | if (NULL == neighbor) |
1811 | { | 1822 | { |
1812 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1823 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1837,12 +1848,12 @@ handle_dv_route_message (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1837 | } | 1848 | } |
1838 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1849 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1839 | "Forwarding message to %s\n", | 1850 | "Forwarding message to %s\n", |
1840 | GNUNET_i2s (&rm->target)); | 1851 | GNUNET_i2s (&neighbor->peer)); |
1841 | forward_payload (neighbor, | 1852 | forward_payload (neighbor, |
1842 | distance, | 1853 | distance, |
1843 | 0, | 1854 | 0, |
1844 | &rm->target, | ||
1845 | &rm->sender, | 1855 | &rm->sender, |
1856 | &rm->target, | ||
1846 | payload); | 1857 | payload); |
1847 | return GNUNET_OK; | 1858 | return GNUNET_OK; |
1848 | } | 1859 | } |
@@ -1899,8 +1910,8 @@ handle_dv_send_message (void *cls, struct GNUNET_SERVER_Client *client, | |||
1899 | forward_payload (route->next_hop, | 1910 | forward_payload (route->next_hop, |
1900 | ntohl (route->target.distance), | 1911 | ntohl (route->target.distance), |
1901 | htonl (msg->uid), | 1912 | htonl (msg->uid), |
1902 | &msg->target, | ||
1903 | &my_identity, | 1913 | &my_identity, |
1914 | &msg->target, | ||
1904 | payload); | 1915 | payload); |
1905 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1916 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1906 | } | 1917 | } |
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index 142bfaa3d..646603655 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -329,9 +329,10 @@ handle_dv_connect (void *cls, | |||
329 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 329 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
330 | 330 | ||
331 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 331 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
332 | "Creating new session %p for peer `%s'\n", | 332 | "Creating new DV session %p for peer `%s' at distance %u\n", |
333 | session, | 333 | session, |
334 | GNUNET_i2s (peer)); | 334 | GNUNET_i2s (peer), |
335 | distance); | ||
335 | 336 | ||
336 | /* Notify transport and ats about new connection */ | 337 | /* Notify transport and ats about new connection */ |
337 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 338 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |