aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vpn/gnunet-daemon-vpn.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c
index a2d43fb2f..c92508a78 100644
--- a/src/vpn/gnunet-daemon-vpn.c
+++ b/src/vpn/gnunet-daemon-vpn.c
@@ -495,6 +495,18 @@ connect_to_service_dns (void *cls,
495} 495}
496 496
497/** 497/**
498 * Create a new Address from an answer-packet
499 * {{{
500 */
501void
502new_ip6addr(char* buf, struct answer_packet* pkt) {
503 memcpy(buf, (int[]){htons(0x1234)}, 2);
504 memcpy(buf+2, &pkt->service_descriptor, 6);
505 memcpy(buf+8, &pkt->peer, 8);
506}
507/*}}}*/
508
509/**
498 * This gets scheduled with cls pointing to an answer_packet and does everything 510 * This gets scheduled with cls pointing to an answer_packet and does everything
499 * needed in order to send it to the helper. 511 * needed in order to send it to the helper.
500 * 512 *
@@ -514,14 +526,9 @@ process_answer(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tc) {
514 //FIXME htons? 526 //FIXME htons?
515 if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_SERVICE) 527 if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_SERVICE)
516 { 528 {
517 unsigned char ip6addr[16];
518
519 pkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP; 529 pkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP;
520 memcpy(ip6addr, (int[]){htons(0x1234)}, 2);
521 memcpy(ip6addr+2, &pkt->peer, 7);
522 memcpy(ip6addr+9, &pkt->service_descriptor, 7);
523 530
524 memcpy(((char*)pkt)+ntohs(pkt->addroffset), ip6addr, 16); 531 new_ip6addr(((char*)pkt)+ntohs(pkt->addroffset), pkt);
525 532
526 /*FIXME: 533 /*FIXME:
527 * -save DNS_Record into hashmap, pointed to by ip 534 * -save DNS_Record into hashmap, pointed to by ip