aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2010-11-17 08:55:34 +0000
committerPhilipp Tölke <toelke@in.tum.de>2010-11-17 08:55:34 +0000
commitc067a0511a17c0aae8f978f45d6160f480655028 (patch)
tree0805ea1b7e48e82b6fd3ec1cbe705454e05e84fd /src
parent4c2e35606e6c4cd5d51428bf0a4ee9c62d8e2f20 (diff)
downloadgnunet-c067a0511a17c0aae8f978f45d6160f480655028.tar.gz
gnunet-c067a0511a17c0aae8f978f45d6160f480655028.zip
Refactored the creation of fake-addresses
Diffstat (limited to 'src')
-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