ac->label = resolver_lookup_get_next_label (rh);
/* tigger shortening */
if (NULL != rh->shorten_key)
+ {
+ GNUNET_break (0); /* FIXME suggested label*/
GNS_shorten_start (rh->ac_tail->label,
+ NULL,
&ac->authority_info.gns_authority,
rh->shorten_key);
+ }
/* add AC to tail */
GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
rh->ac_tail,
size_t sa_len;
/* find suitable A/AAAA record */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received %u results for IP address of DNS server for GNS2DNS transition\n",
+ rd_count);
+ /* enable cleanup of 'rh' handle that comes next... */
+ GNUNET_CONTAINER_DLL_insert (rlh_head,
+ rlh_tail,
+ rh->g2dc->rh);
rh->g2dc->rh = NULL;
sa = NULL;
sa_len = 0;
GNUNET_free (rh->g2dc->ns);
GNUNET_free (rh->g2dc);
rh->g2dc = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Will continue resolution using DNS server `%s' to resolve `%s'\n",
+ GNUNET_a2s (sa, sa_len),
+ ac->label);
GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
rh->ac_tail,
ac);
struct VpnContext *vpn_ctx;
const struct GNUNET_TUN_GnsVpnRecord *vpn;
const char *vname;
+ const char *suggested_label;
struct GNUNET_HashCode vhash;
int af;
char scratch[UINT16_MAX];
size_t scratch_off;
size_t scratch_start;
size_t off;
+ int c2;
struct GNUNET_GNSRECORD_Data rd_new[rd_count];
unsigned int rd_off;
/* tigger shortening */
if (NULL != rh->shorten_key)
{
- GNS_shorten_start (rh->ac_tail->label,
+ suggested_label = NULL;
+ for (c2 = 0; c2< rd_count; c2++)
+ {
+ if ((GNUNET_GNSRECORD_TYPE_NICK ==rd[c2].record_type) &&
+ (rd[i].data_size > 0) &&
+ (((const char *) rd[c2].data)[rd[c2].data_size -1] == '\0'))
+ suggested_label = (const char *) rd->data;
+ }
+ if (NULL != suggested_label)
+ GNS_shorten_start (rh->ac_tail->label,
+ suggested_label,
&pub,
rh->shorten_key);
}
ac->label = resolver_lookup_get_next_label (rh);
/* tigger shortening */
if (NULL != rh->shorten_key)
- GNS_shorten_start (rh->ac_tail->label,
+ {
+ suggested_label = NULL;
+ for (c2 = 0; c2< rd_count; c2++)
+ {
+ if ((GNUNET_GNSRECORD_TYPE_NICK ==rd[c2].record_type) &&
+ (rd[c2].data_size > 0) &&
+ ((const char *) rd[c2].data)[rd[c2].data_size -1] == '\0')
+ suggested_label = (const char *) rd[c2].data;
+ }
+ if (NULL != suggested_label)
+ GNS_shorten_start (rh->ac_tail->label,
+ suggested_label,
&ac->authority_info.gns_authority,
rh->shorten_key);
+ }
/* add AC to tail */
GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
rh->ac_tail,
/* resolution continues within DNS */
struct Gns2DnsContext *g2dc;
char *ip;
- char *at;
- char *cp;
char *ns;
- cp = GNUNET_strndup (rd[i].data,
- rd[i].data_size);
- at = strchr (cp, '@');
- if (NULL == at)
- {
- GNUNET_break_op (0);
- rh->proc (rh->proc_cls, 0, NULL);
- GNS_resolver_lookup_cancel (rh);
- return;
- }
- *at = '\0';
off = 0;
- ns = GNUNET_DNSPARSER_parse_name (cp,
- strlen (cp),
+ ns = GNUNET_DNSPARSER_parse_name (rd[i].data,
+ rd[i].data_size,
&off);
- if ( (NULL == ns) ||
- (off != strlen (cp)) )
- {
- GNUNET_break_op (0); /* record not well-formed */
- rh->proc (rh->proc_cls, 0, NULL);
- GNS_resolver_lookup_cancel (rh);
- GNUNET_free (cp);
- return;
- }
- off++; /* skip '@' */
- ip = GNUNET_DNSPARSER_parse_name (cp,
- strlen (at + 1),
+ ip = GNUNET_DNSPARSER_parse_name (rd[i].data,
+ rd[i].data_size,
&off);
- if ( (NULL == ip) ||
+ if ( (NULL == ns) ||
+ (NULL == ip) ||
(off != rd[i].data_size) )
{
- GNUNET_break_op (0); /* record not well-formed */
- rh->proc (rh->proc_cls, 0, NULL);
- GNS_resolver_lookup_cancel (rh);
- GNUNET_free (ns);
- GNUNET_free (cp);
+ GNUNET_break_op (0);
+ GNUNET_free_non_null (ns);
+ GNUNET_free_non_null (ip);
+ rh->proc (rh->proc_cls, 0, NULL);
+ GNS_resolver_lookup_cancel (rh);
return;
}
- GNUNET_free (cp);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Resolving `%s' to determine IP address of DNS server for GNS2DNS transition\n",
+ ip);
/* resolve 'ip' to determine the IP(s) of the DNS
resolver to use */
g2dc = GNUNET_new (struct Gns2DnsContext);
g2dc->ns = ns;
g2dc->rh = GNUNET_new (struct GNS_ResolverHandle);
g2dc->rh->authority_zone = rh->ac_tail->authority_info.gns_authority;
+ ip = translate_dot_plus (rh, ip);
g2dc->rh->name = ip;
g2dc->rh->name_resolution_pos = strlen (ip);
g2dc->rh->proc = &handle_gns2dns_result;