aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-18 20:47:51 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-18 20:47:51 +0000
commit83fc4b5ec139300250383fc3c6577b9333a309c6 (patch)
tree2f5ea9b335e77f36a007c72170f5ff7aa546f83d
parent7558e4b478bd48158bff9d211837ad81314543a0 (diff)
downloadgnunet-83fc4b5ec139300250383fc3c6577b9333a309c6.tar.gz
gnunet-83fc4b5ec139300250383fc3c6577b9333a309c6.zip
-implementing handling of VPN records in new GNS
-rw-r--r--src/gns/gnunet-service-gns_resolver.c344
-rw-r--r--src/include/gnunet_namestore_service.h1
-rw-r--r--src/include/gnunet_tun_lib.h2
-rw-r--r--src/namestore/namestore_api_common.c4
4 files changed, 191 insertions, 160 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index c36fa8d17..4f7f56d21 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -26,7 +26,6 @@
26 * 26 *
27 * TODO: 27 * TODO:
28 * - GNS: handle CNAME records (idea: manipulate rh->name) 28 * - GNS: handle CNAME records (idea: manipulate rh->name)
29 * - GNS: handle VPN records (easy)
30 * - GNS: handle special SRV names --- no delegation, direct lookup; 29 * - GNS: handle special SRV names --- no delegation, direct lookup;
31 * can likely be done in 'resolver_lookup_get_next_label'. 30 * can likely be done in 'resolver_lookup_get_next_label'.
32 * - recursive DNS resolution 31 * - recursive DNS resolution
@@ -77,6 +76,11 @@
77#define DNS_LOOKUP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 76#define DNS_LOOKUP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
78 77
79/** 78/**
79 * Default timeout for VPN redirections.
80 */
81#define VPN_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30)
82
83/**
80 * DHT replication level 84 * DHT replication level
81 */ 85 */
82#define DHT_GNS_REPLICATION_LEVEL 5 86#define DHT_GNS_REPLICATION_LEVEL 5
@@ -241,6 +245,39 @@ struct DnsResult
241 245
242 246
243/** 247/**
248 * Closure for #vpn_allocation_cb.
249 */
250struct VpnContext
251{
252
253 /**
254 * Which resolution process are we processing.
255 */
256 struct GNS_ResolverHandle *rh;
257
258 /**
259 * Handle to the VPN request that we were performing.
260 */
261 struct GNUNET_VPN_RedirectionRequest *vpn_request;
262
263 /**
264 * Number of records serialized in 'rd_data'.
265 */
266 unsigned int rd_count;
267
268 /**
269 * Serialized records.
270 */
271 char *rd_data;
272
273 /**
274 * Number of bytes in 'rd_data'.
275 */
276 size_t rd_data_size;
277};
278
279
280/**
244 * Handle to a currenty pending resolution. On result (positive or 281 * Handle to a currenty pending resolution. On result (positive or
245 * negative) the #GNS_ResultProcessor is called. 282 * negative) the #GNS_ResultProcessor is called.
246 */ 283 */
@@ -280,7 +317,7 @@ struct GNS_ResolverHandle
280 /** 317 /**
281 * Handle to a VPN request, NULL if none is active. 318 * Handle to a VPN request, NULL if none is active.
282 */ 319 */
283 struct GNUNET_VPN_RedirectionRequest *vpn_handle; 320 struct VpnContext *vpn_ctx;
284 321
285 /** 322 /**
286 * Socket for a DNS request, NULL if none is active. 323 * Socket for a DNS request, NULL if none is active.
@@ -963,160 +1000,6 @@ start_shorten (const char *original_label,
963#if 0 1000#if 0
964 1001
965 1002
966/**
967 * VPN redirect result callback
968 *
969 * @param cls the resolver handle
970 * @param af the requested address family
971 * @param address in_addr(6) respectively
972 */
973static void
974process_record_result_vpn (void* cls, int af, const void *address)
975{
976 struct ResolverHandle *rh = cls;
977 struct RecordLookupHandle *rlh = rh->proc_cls;
978 struct GNUNET_NAMESTORE_RecordData rd;
979
980 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
981 "GNS_PHASE_REC_VPN-%llu: Got answer from VPN to query!\n",
982 rh->id);
983 if (AF_INET == af)
984 {
985 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
986 "GNS_PHASE_REC-%llu: Answer is IPv4!\n",
987 rh->id);
988 if (GNUNET_DNSPARSER_TYPE_A != rlh->record_type)
989 {
990 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
991 "GNS_PHASE_REC-%llu: Requested record is not IPv4!\n",
992 rh->id);
993 rh->proc (rh->proc_cls, rh, 0, NULL);
994 return;
995 }
996 rd.record_type = GNUNET_DNSPARSER_TYPE_A;
997 rd.expiration_time = UINT64_MAX; /* FIXME: should probably pick something shorter... */
998 rd.data = address;
999 rd.data_size = sizeof (struct in_addr);
1000 rd.flags = 0;
1001 rh->proc (rh->proc_cls, rh, 1, &rd);
1002 return;
1003 }
1004 else if (AF_INET6 == af)
1005 {
1006 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1007 "GNS_PHASE_REC-%llu: Answer is IPv6!\n",
1008 rh->id);
1009 if (GNUNET_DNSPARSER_TYPE_AAAA != rlh->record_type)
1010 {
1011 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1012 "GNS_PHASE_REC-%llu: Requested record is not IPv6!\n",
1013 rh->id);
1014 rh->proc (rh->proc_cls, rh, 0, NULL);
1015 return;
1016 }
1017 rd.record_type = GNUNET_DNSPARSER_TYPE_AAAA;
1018 rd.expiration_time = UINT64_MAX; /* FIXME: should probably pick something shorter... */
1019 rd.data = address;
1020 rd.data_size = sizeof (struct in6_addr);
1021 rd.flags = 0;
1022 rh->proc (rh->proc_cls, rh, 1, &rd);
1023 return;
1024 }
1025
1026 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1027 "GNS_PHASE_REC-%llu: Got garbage from VPN!\n",
1028 rh->id);
1029 rh->proc (rh->proc_cls, rh, 0, NULL);
1030}
1031
1032
1033
1034
1035
1036/**
1037 * The final phase of resoution.
1038 * We found a VPN RR and want to request an IPv4/6 address
1039 *
1040 * @param rh the pending lookup handle
1041 * @param rd_count length of record data
1042 * @param rd record data containing VPN RR
1043 */
1044static void
1045resolve_record_vpn (struct ResolverHandle *rh,
1046 unsigned int rd_count,
1047 const struct GNUNET_NAMESTORE_RecordData *rd)
1048{
1049 struct RecordLookupHandle *rlh = rh->proc_cls;
1050 struct GNUNET_HashCode serv_desc;
1051 struct GNUNET_TUN_GnsVpnRecord* vpn;
1052 int af;
1053
1054 /* We cancel here as to not include the ns lookup in the timeout */
1055 if (GNUNET_SCHEDULER_NO_TASK != rh->timeout_task)
1056 {
1057 GNUNET_SCHEDULER_cancel(rh->timeout_task);
1058 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1059 }
1060 /* Start shortening */
1061 if ((NULL != rh->priv_key) &&
1062 (GNUNET_YES == is_canonical (rh->name)))
1063 {
1064 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1065 "GNS_PHASE_REC_VPN-%llu: Trying to shorten authority chain\n",
1066 rh->id);
1067 start_shorten (rh->authority_chain_head,
1068 rh->priv_key);
1069 }
1070
1071 vpn = (struct GNUNET_TUN_GnsVpnRecord*)rd->data;
1072 GNUNET_CRYPTO_hash ((char*)&vpn[1],
1073 strlen ((char*)&vpn[1]) + 1,
1074 &serv_desc);
1075 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1076 "GNS_PHASE_REC_VPN-%llu: proto %hu peer %s!\n",
1077 rh->id,
1078 ntohs (vpn->proto),
1079 GNUNET_h2s (&vpn->peer));
1080
1081 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1082 "GNS_PHASE_REC_VPN-%llu: service %s -> %s!\n",
1083 rh->id,
1084 (char*)&vpn[1],
1085 GNUNET_h2s (&serv_desc));
1086 rh->proc = &handle_record_vpn;
1087 if (GNUNET_DNSPARSER_TYPE_A == rlh->record_type)
1088 af = AF_INET;
1089 else
1090 af = AF_INET6;
1091#ifndef WINDOWS
1092 if (NULL == vpn_handle)
1093 {
1094 vpn_handle = GNUNET_VPN_connect (cfg);
1095 if (NULL == vpn_handle)
1096 {
1097 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1098 "GNS_PHASE_INIT: Error connecting to VPN!\n");
1099 finish_lookup (rh, rh->proc_cls, 0, NULL);
1100 return;
1101 }
1102 }
1103
1104 rh->vpn_handle = GNUNET_VPN_redirect_to_peer (vpn_handle,
1105 af, ntohs (vpn->proto),
1106 (struct GNUNET_PeerIdentity *)&vpn->peer,
1107 &serv_desc,
1108 GNUNET_NO, //nac
1109 GNUNET_TIME_UNIT_FOREVER_ABS, //FIXME
1110 &process_record_result_vpn,
1111 rh);
1112#else
1113 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1114 "Error connecting to VPN (not available on W32 yet)\n");
1115 finish_lookup (rh, rh->proc_cls, 0, NULL);
1116#endif
1117}
1118
1119
1120//FIXME maybe define somewhere else? 1003//FIXME maybe define somewhere else?
1121#define MAX_SOA_LENGTH sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t)\ 1004#define MAX_SOA_LENGTH sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t)\
1122 +(GNUNET_DNSPARSER_MAX_NAME_LENGTH*2) 1005 +(GNUNET_DNSPARSER_MAX_NAME_LENGTH*2)
@@ -1326,10 +1209,12 @@ fail_resolution (void *cls,
1326 1209
1327#ifdef WINDOWS 1210#ifdef WINDOWS
1328/* Don't have this on W32, here's a naive implementation */ 1211/* Don't have this on W32, here's a naive implementation */
1329void *memrchr (const void *s, int c, size_t n) 1212void *
1213memrchr (const void *s, int c, size_t n)
1330{ 1214{
1331 size_t i; 1215 size_t i;
1332 unsigned char *ucs = (unsigned char *) s; 1216 unsigned char *ucs = (unsigned char *) s;
1217
1333 for (i = n - 1; i >= 0; i--) 1218 for (i = n - 1; i >= 0; i--)
1334 if (ucs[i] == c) 1219 if (ucs[i] == c)
1335 return (void *) &ucs[i]; 1220 return (void *) &ucs[i];
@@ -1650,6 +1535,85 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1650static void 1535static void
1651handle_gns_resolution_result (void *cls, 1536handle_gns_resolution_result (void *cls,
1652 unsigned int rd_count, 1537 unsigned int rd_count,
1538 const struct GNUNET_NAMESTORE_RecordData *rd);
1539
1540
1541/**
1542 * Callback invoked from the VPN service once a redirection is
1543 * available. Provides the IP address that can now be used to
1544 * reach the requested destination. Replaces the "VPN" record
1545 * with the respective A/AAAA record and continues processing.
1546 *
1547 * @param cls closure
1548 * @param af address family, AF_INET or AF_INET6; AF_UNSPEC on error;
1549 * will match 'result_af' from the request
1550 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
1551 * that the VPN allocated for the redirection;
1552 * traffic to this IP will now be redirected to the
1553 * specified target peer; NULL on error
1554 */
1555static void
1556vpn_allocation_cb (void *cls,
1557 int af,
1558 const void *address)
1559{
1560 struct VpnContext *vpn_ctx = cls;
1561 struct GNS_ResolverHandle *rh = vpn_ctx->rh;
1562 struct GNUNET_NAMESTORE_RecordData rd[vpn_ctx->rd_count];
1563 unsigned int i;
1564
1565 vpn_ctx->vpn_request = NULL;
1566 rh->vpn_ctx = NULL;
1567 GNUNET_assert (GNUNET_OK ==
1568 GNUNET_NAMESTORE_records_deserialize (vpn_ctx->rd_data_size,
1569 vpn_ctx->rd_data,
1570 vpn_ctx->rd_count,
1571 rd));
1572 for (i=0;i<vpn_ctx->rd_count;i++)
1573 {
1574 if (GNUNET_NAMESTORE_TYPE_VPN == rd[i].record_type)
1575 {
1576 switch (af)
1577 {
1578 case AF_INET:
1579 rd[i].record_type = GNUNET_DNSPARSER_TYPE_A;
1580 rd[i].data_size = sizeof (struct in_addr);
1581 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT).abs_value_us;
1582 rd[i].flags = 0;
1583 rd[i].data = address;
1584 break;
1585 case AF_INET6:
1586 rd[i].record_type = GNUNET_DNSPARSER_TYPE_AAAA;
1587 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT).abs_value_us;
1588 rd[i].flags = 0;
1589 rd[i].data = address;
1590 rd[i].data_size = sizeof (struct in6_addr);
1591 break;
1592 default:
1593 GNUNET_assert (0);
1594 }
1595 break;
1596 }
1597 }
1598 GNUNET_assert (i < vpn_ctx->rd_count);
1599 handle_gns_resolution_result (rh,
1600 vpn_ctx->rd_count,
1601 rd);
1602 GNUNET_free (vpn_ctx->rd_data);
1603 GNUNET_free (vpn_ctx);
1604}
1605
1606
1607/**
1608 * Process a records that were decrypted from a block.
1609 *
1610 * @param cls closure with the 'struct GNS_ResolverHandle'
1611 * @param rd_count number of entries in @a rd array
1612 * @param rd array of records with data to store
1613 */
1614static void
1615handle_gns_resolution_result (void *cls,
1616 unsigned int rd_count,
1653 const struct GNUNET_NAMESTORE_RecordData *rd) 1617 const struct GNUNET_NAMESTORE_RecordData *rd)
1654{ 1618{
1655 struct GNS_ResolverHandle *rh = cls; 1619 struct GNS_ResolverHandle *rh = cls;
@@ -1661,6 +1625,11 @@ handle_gns_resolution_result (void *cls,
1661 struct sockaddr_in6 v6; 1625 struct sockaddr_in6 v6;
1662 size_t sa_len; 1626 size_t sa_len;
1663 char *cname; 1627 char *cname;
1628 struct VpnContext *vpn_ctx;
1629 const struct GNUNET_TUN_GnsVpnRecord *vpn;
1630 const char *vname;
1631 struct GNUNET_HashCode vhash;
1632 int af;
1664 1633
1665 if (0 == rh->name_resolution_pos) 1634 if (0 == rh->name_resolution_pos)
1666 { 1635 {
@@ -1678,6 +1647,57 @@ handle_gns_resolution_result (void *cls,
1678 } 1647 }
1679 /* FIXME: if A/AAAA was requested, but we got a VPN 1648 /* FIXME: if A/AAAA was requested, but we got a VPN
1680 record, we should interact with GNUnet VPN here */ 1649 record, we should interact with GNUnet VPN here */
1650 if ( (GNUNET_DNSPARSER_TYPE_A == rh->record_type) ||
1651 (GNUNET_DNSPARSER_TYPE_AAAA == rh->record_type) )
1652 {
1653 for (i=0;i<rd_count;i++)
1654 {
1655 if (GNUNET_NAMESTORE_TYPE_VPN == rd[i].record_type)
1656 {
1657 af = (GNUNET_DNSPARSER_TYPE_A == rh->record_type) ? AF_INET : AF_INET6;
1658 if (sizeof (struct GNUNET_TUN_GnsVpnRecord) <
1659 rd[i].data_size)
1660 {
1661 GNUNET_break_op (0);
1662 rh->proc (rh->proc_cls, 0, NULL);
1663 GNS_resolver_lookup_cancel (rh);
1664 return;
1665 }
1666 vpn = (const struct GNUNET_TUN_GnsVpnRecord *) rd[i].data;
1667 vname = (const char *) &vpn[1];
1668 if ('\0' != vname[rd[i].data_size - 1 - sizeof (struct GNUNET_TUN_GnsVpnRecord)])
1669 {
1670 GNUNET_break_op (0);
1671 rh->proc (rh->proc_cls, 0, NULL);
1672 GNS_resolver_lookup_cancel (rh);
1673 return;
1674 }
1675 GNUNET_CRYPTO_hash (vname,
1676 strlen (vname), // FIXME: +1?
1677 &vhash);
1678 vpn_ctx = GNUNET_new (struct VpnContext);
1679 rh->vpn_ctx = vpn_ctx;
1680 vpn_ctx->rh = rh;
1681 vpn_ctx->rd_data_size = GNUNET_NAMESTORE_records_get_size (rd_count,
1682 rd);
1683 vpn_ctx->rd_data = GNUNET_malloc (vpn_ctx->rd_data_size);
1684 (void) GNUNET_NAMESTORE_records_serialize (rd_count,
1685 rd,
1686 vpn_ctx->rd_data_size,
1687 vpn_ctx->rd_data);
1688 vpn_ctx->vpn_request = GNUNET_VPN_redirect_to_peer (vpn_handle,
1689 af,
1690 ntohs (vpn->proto),
1691 &vpn->peer,
1692 &vhash,
1693 GNUNET_NO,
1694 GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT),
1695 &vpn_allocation_cb,
1696 rh);
1697 return;
1698 }
1699 }
1700 }
1681 1701
1682 /* yes, we are done, return result */ 1702 /* yes, we are done, return result */
1683 rh->proc (rh->proc_cls, rd_count, rd); 1703 rh->proc (rh->proc_cls, rd_count, rd);
@@ -2167,6 +2187,7 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh)
2167{ 2187{
2168 struct DnsResult *dr; 2188 struct DnsResult *dr;
2169 struct AuthorityChain *ac; 2189 struct AuthorityChain *ac;
2190 struct VpnContext *vpn_ctx;
2170 2191
2171 GNUNET_CONTAINER_DLL_remove (rlh_head, 2192 GNUNET_CONTAINER_DLL_remove (rlh_head,
2172 rlh_tail, 2193 rlh_tail,
@@ -2194,6 +2215,12 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh)
2194 GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node); 2215 GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node);
2195 rh->dht_heap_node = NULL; 2216 rh->dht_heap_node = NULL;
2196 } 2217 }
2218 if (NULL != (vpn_ctx = rh->vpn_ctx))
2219 {
2220 GNUNET_VPN_cancel_request (vpn_ctx->vpn_request);
2221 GNUNET_free (vpn_ctx->rd_data);
2222 GNUNET_free (vpn_ctx);
2223 }
2197 if (NULL != rh->dns_request) 2224 if (NULL != rh->dns_request)
2198 { 2225 {
2199 GNUNET_DNSSTUB_resolve_cancel (rh->dns_request); 2226 GNUNET_DNSSTUB_resolve_cancel (rh->dns_request);
@@ -2258,6 +2285,7 @@ GNS_resolver_init (struct GNUNET_NAMESTORE_Handle *nh,
2258 } 2285 }
2259 dns_handle = GNUNET_DNSSTUB_start (dns_ip); 2286 dns_handle = GNUNET_DNSSTUB_start (dns_ip);
2260 GNUNET_free (dns_ip); 2287 GNUNET_free (dns_ip);
2288 vpn_handle = GNUNET_VPN_connect (cfg);
2261} 2289}
2262 2290
2263 2291
@@ -2282,6 +2310,8 @@ GNS_resolver_done ()
2282 dht_lookup_heap = NULL; 2310 dht_lookup_heap = NULL;
2283 GNUNET_DNSSTUB_stop (dns_handle); 2311 GNUNET_DNSSTUB_stop (dns_handle);
2284 dns_handle = NULL; 2312 dns_handle = NULL;
2313 GNUNET_VPN_disconnect (vpn_handle);
2314 vpn_handle = NULL;
2285} 2315}
2286 2316
2287 2317
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index 853352109..75e9224ef 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -1,3 +1,4 @@
1
1/* 2/*
2 This file is part of GNUnet 3 This file is part of GNUnet
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors) 4 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h
index 683910d93..e0725a75c 100644
--- a/src/include/gnunet_tun_lib.h
+++ b/src/include/gnunet_tun_lib.h
@@ -578,7 +578,7 @@ struct GNUNET_TUN_GnsVpnRecord
578 /** 578 /**
579 * The peer to contact 579 * The peer to contact
580 */ 580 */
581 struct GNUNET_HashCode peer; 581 struct GNUNET_PeerIdentity peer;
582 582
583 /** 583 /**
584 * The protocol to use 584 * The protocol to use
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c
index f0f061d0f..73af0ead5 100644
--- a/src/namestore/namestore_api_common.c
+++ b/src/namestore/namestore_api_common.c
@@ -590,7 +590,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
590 ('\0' != cdata[data_size - 1]) ) 590 ('\0' != cdata[data_size - 1]) )
591 return NULL; /* malformed */ 591 return NULL; /* malformed */
592 vpn = data; 592 vpn = data;
593 GNUNET_CRYPTO_hash_to_enc (&vpn->peer, &s_peer); 593 GNUNET_CRYPTO_hash_to_enc (&vpn->peer.hashPubKey, &s_peer);
594 if (0 == GNUNET_asprintf (&vpn_str, "%u %s %s", 594 if (0 == GNUNET_asprintf (&vpn_str, "%u %s %s",
595 (unsigned int) ntohs (vpn->proto), 595 (unsigned int) ntohs (vpn->proto),
596 (const char*) &s_peer, 596 (const char*) &s_peer,
@@ -797,7 +797,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
797 *data_size = sizeof (struct GNUNET_TUN_GnsVpnRecord) + strlen (s_serv) + 1; 797 *data_size = sizeof (struct GNUNET_TUN_GnsVpnRecord) + strlen (s_serv) + 1;
798 *data = vpn = GNUNET_malloc (*data_size); 798 *data = vpn = GNUNET_malloc (*data_size);
799 if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char*)&s_peer, 799 if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char*)&s_peer,
800 &vpn->peer)) 800 &vpn->peer.hashPubKey))
801 { 801 {
802 GNUNET_free (vpn); 802 GNUNET_free (vpn);
803 *data_size = 0; 803 *data_size = 0;