diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:44:32 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:44:32 +0000 |
commit | 0cccabf5c6afcff54573de1b4ed761085a27310d (patch) | |
tree | b64756aa7ace520419f102c50f6dbeb771040463 | |
parent | 9ff99f23db620008bc3525f798bc395915c2e68b (diff) | |
download | gnunet-0cccabf5c6afcff54573de1b4ed761085a27310d.tar.gz gnunet-0cccabf5c6afcff54573de1b4ed761085a27310d.zip |
-renaming some fields, fixing byte order issues
-rw-r--r-- | src/dns/gnunet-service-dns.c | 24 | ||||
-rw-r--r-- | src/exit/gnunet-daemon-exit.c | 92 | ||||
-rw-r--r-- | src/include/gnunet_tun_lib.h | 54 | ||||
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 78 |
4 files changed, 131 insertions, 117 deletions
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c index a30c6582b..74d3d25ac 100644 --- a/src/dns/gnunet-service-dns.c +++ b/src/dns/gnunet-service-dns.c | |||
@@ -384,8 +384,8 @@ request_done (struct RequestRecord *rr) | |||
384 | { | 384 | { |
385 | struct GNUNET_MessageHeader *hdr; | 385 | struct GNUNET_MessageHeader *hdr; |
386 | size_t reply_len; | 386 | size_t reply_len; |
387 | uint16_t spt; | 387 | uint16_t source_port; |
388 | uint16_t dpt; | 388 | uint16_t destination_port; |
389 | 389 | ||
390 | GNUNET_array_grow (rr->client_wait_list, | 390 | GNUNET_array_grow (rr->client_wait_list, |
391 | rr->client_wait_list_length, | 391 | rr->client_wait_list_length, |
@@ -455,8 +455,8 @@ request_done (struct RequestRecord *rr) | |||
455 | struct sockaddr_in *src = (struct sockaddr_in *) &rr->src_addr; | 455 | struct sockaddr_in *src = (struct sockaddr_in *) &rr->src_addr; |
456 | struct sockaddr_in *dst = (struct sockaddr_in *) &rr->dst_addr; | 456 | struct sockaddr_in *dst = (struct sockaddr_in *) &rr->dst_addr; |
457 | 457 | ||
458 | spt = dst->sin_port; | 458 | source_port = dst->sin_port; |
459 | dpt = src->sin_port; | 459 | destination_port = src->sin_port; |
460 | GNUNET_TUN_initialize_ipv4_header (&ip4, | 460 | GNUNET_TUN_initialize_ipv4_header (&ip4, |
461 | IPPROTO_UDP, | 461 | IPPROTO_UDP, |
462 | reply_len - off - sizeof (struct GNUNET_TUN_IPv4Header), | 462 | reply_len - off - sizeof (struct GNUNET_TUN_IPv4Header), |
@@ -471,8 +471,8 @@ request_done (struct RequestRecord *rr) | |||
471 | struct sockaddr_in6 *src = (struct sockaddr_in6 *) &rr->src_addr; | 471 | struct sockaddr_in6 *src = (struct sockaddr_in6 *) &rr->src_addr; |
472 | struct sockaddr_in6 *dst = (struct sockaddr_in6 *) &rr->dst_addr; | 472 | struct sockaddr_in6 *dst = (struct sockaddr_in6 *) &rr->dst_addr; |
473 | 473 | ||
474 | spt = dst->sin6_port; | 474 | source_port = dst->sin6_port; |
475 | dpt = src->sin6_port; | 475 | destination_port = src->sin6_port; |
476 | GNUNET_TUN_initialize_ipv6_header (&ip6, | 476 | GNUNET_TUN_initialize_ipv6_header (&ip6, |
477 | IPPROTO_UDP, | 477 | IPPROTO_UDP, |
478 | reply_len - sizeof (struct GNUNET_TUN_IPv6Header), | 478 | reply_len - sizeof (struct GNUNET_TUN_IPv6Header), |
@@ -490,8 +490,8 @@ request_done (struct RequestRecord *rr) | |||
490 | { | 490 | { |
491 | struct GNUNET_TUN_UdpHeader udp; | 491 | struct GNUNET_TUN_UdpHeader udp; |
492 | 492 | ||
493 | udp.spt = spt; | 493 | udp.source_port = source_port; |
494 | udp.dpt = dpt; | 494 | udp.destination_port = destination_port; |
495 | udp.len = htons (reply_len - off); | 495 | udp.len = htons (reply_len - off); |
496 | if (AF_INET == rr->src_addr.ss_family) | 496 | if (AF_INET == rr->src_addr.ss_family) |
497 | GNUNET_TUN_calculate_udp4_checksum (&ip4, | 497 | GNUNET_TUN_calculate_udp4_checksum (&ip4, |
@@ -1235,8 +1235,8 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client, | |||
1235 | dsta4->sin_family = AF_INET; | 1235 | dsta4->sin_family = AF_INET; |
1236 | srca4->sin_addr = ip4->source_address; | 1236 | srca4->sin_addr = ip4->source_address; |
1237 | dsta4->sin_addr = ip4->destination_address; | 1237 | dsta4->sin_addr = ip4->destination_address; |
1238 | srca4->sin_port = udp->spt; | 1238 | srca4->sin_port = udp->source_port; |
1239 | dsta4->sin_port = udp->dpt; | 1239 | dsta4->sin_port = udp->destination_port; |
1240 | #if HAVE_SOCKADDR_IN_SIN_LEN | 1240 | #if HAVE_SOCKADDR_IN_SIN_LEN |
1241 | srca4->sin_len = sizeof (struct sockaddr_in)) | 1241 | srca4->sin_len = sizeof (struct sockaddr_in)) |
1242 | dsta4->sin_len = sizeof (struct sockaddr_in); | 1242 | dsta4->sin_len = sizeof (struct sockaddr_in); |
@@ -1253,8 +1253,8 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client, | |||
1253 | dsta6->sin6_family = AF_INET6; | 1253 | dsta6->sin6_family = AF_INET6; |
1254 | srca6->sin6_addr = ip6->source_address; | 1254 | srca6->sin6_addr = ip6->source_address; |
1255 | dsta6->sin6_addr = ip6->destination_address; | 1255 | dsta6->sin6_addr = ip6->destination_address; |
1256 | srca6->sin6_port = udp->spt; | 1256 | srca6->sin6_port = udp->source_port; |
1257 | dsta6->sin6_port = udp->dpt; | 1257 | dsta6->sin6_port = udp->destination_port; |
1258 | #if HAVE_SOCKADDR_IN_SIN_LEN | 1258 | #if HAVE_SOCKADDR_IN_SIN_LEN |
1259 | srca6->sin6_len = sizeof (struct sockaddr_in6); | 1259 | srca6->sin6_len = sizeof (struct sockaddr_in6); |
1260 | dsta6->sin6_len = sizeof (struct sockaddr_in6); | 1260 | dsta6->sin6_len = sizeof (struct sockaddr_in6); |
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 720a0ade4..99dec5ea0 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -436,17 +436,17 @@ get_redirect_state (int af, | |||
436 | * | 436 | * |
437 | * @param service_map map of services (TCP or UDP) | 437 | * @param service_map map of services (TCP or UDP) |
438 | * @param desc service descriptor | 438 | * @param desc service descriptor |
439 | * @param dpt destination port | 439 | * @param destination_port destination port |
440 | * @return NULL if we are not aware of such a service | 440 | * @return NULL if we are not aware of such a service |
441 | */ | 441 | */ |
442 | static struct LocalService * | 442 | static struct LocalService * |
443 | find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map, | 443 | find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map, |
444 | const GNUNET_HashCode *desc, | 444 | const GNUNET_HashCode *desc, |
445 | uint16_t dpt) | 445 | uint16_t destination_port) |
446 | { | 446 | { |
447 | char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)]; | 447 | char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)]; |
448 | 448 | ||
449 | memcpy (&key[0], &dpt, sizeof (uint16_t)); | 449 | memcpy (&key[0], &destination_port, sizeof (uint16_t)); |
450 | memcpy (&key[sizeof(uint16_t)], desc, sizeof (GNUNET_HashCode)); | 450 | memcpy (&key[sizeof(uint16_t)], desc, sizeof (GNUNET_HashCode)); |
451 | return GNUNET_CONTAINER_multihashmap_get (service_map, | 451 | return GNUNET_CONTAINER_multihashmap_get (service_map, |
452 | (GNUNET_HashCode *) key); | 452 | (GNUNET_HashCode *) key); |
@@ -480,13 +480,13 @@ free_service_record (void *cls, | |||
480 | * | 480 | * |
481 | * @param service_map map of services (TCP or UDP) | 481 | * @param service_map map of services (TCP or UDP) |
482 | * @param name name of the service | 482 | * @param name name of the service |
483 | * @param dpt destination port | 483 | * @param destination_port destination port |
484 | * @param service service information record to store (service->name will be set). | 484 | * @param service service information record to store (service->name will be set). |
485 | */ | 485 | */ |
486 | static void | 486 | static void |
487 | store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map, | 487 | store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map, |
488 | const char *name, | 488 | const char *name, |
489 | uint16_t dpt, | 489 | uint16_t destination_port, |
490 | struct LocalService *service) | 490 | struct LocalService *service) |
491 | { | 491 | { |
492 | char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)]; | 492 | char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)]; |
@@ -494,7 +494,7 @@ store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map, | |||
494 | 494 | ||
495 | GNUNET_CRYPTO_hash (name, strlen (name) + 1, &desc); | 495 | GNUNET_CRYPTO_hash (name, strlen (name) + 1, &desc); |
496 | service->name = GNUNET_strdup (name); | 496 | service->name = GNUNET_strdup (name); |
497 | memcpy (&key[0], &dpt, sizeof (uint16_t)); | 497 | memcpy (&key[0], &destination_port, sizeof (uint16_t)); |
498 | memcpy (&key[sizeof(uint16_t)], &desc, sizeof (GNUNET_HashCode)); | 498 | memcpy (&key[sizeof(uint16_t)], &desc, sizeof (GNUNET_HashCode)); |
499 | if (GNUNET_OK != | 499 | if (GNUNET_OK != |
500 | GNUNET_CONTAINER_multihashmap_put (service_map, | 500 | GNUNET_CONTAINER_multihashmap_put (service_map, |
@@ -506,7 +506,7 @@ store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map, | |||
506 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 506 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
507 | _("Got duplicate service records for `%s:%u'\n"), | 507 | _("Got duplicate service records for `%s:%u'\n"), |
508 | name, | 508 | name, |
509 | (unsigned int) dpt); | 509 | (unsigned int) destination_port); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
@@ -614,8 +614,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, | |||
614 | const struct GNUNET_TUN_IPv6Header *ipv6; | 614 | const struct GNUNET_TUN_IPv6Header *ipv6; |
615 | const struct GNUNET_TUN_UdpHeader *udp; | 615 | const struct GNUNET_TUN_UdpHeader *udp; |
616 | size_t mlen; | 616 | size_t mlen; |
617 | uint16_t spt; | 617 | uint16_t source_port; |
618 | uint16_t dpt; | 618 | uint16_t destination_port; |
619 | uint8_t protocol; | 619 | uint8_t protocol; |
620 | 620 | ||
621 | { | 621 | { |
@@ -640,8 +640,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, | |||
640 | /* Find out if this is an ICMP packet in response to an existing | 640 | /* Find out if this is an ICMP packet in response to an existing |
641 | TCP/UDP packet and if so, figure out ports / protocol of the | 641 | TCP/UDP packet and if so, figure out ports / protocol of the |
642 | existing session from the IP data in the ICMP payload */ | 642 | existing session from the IP data in the ICMP payload */ |
643 | spt = 0; | 643 | source_port = 0; |
644 | dpt = 0; | 644 | destination_port = 0; |
645 | protocol = IPPROTO_ICMP; | 645 | protocol = IPPROTO_ICMP; |
646 | switch (af) | 646 | switch (af) |
647 | { | 647 | { |
@@ -667,8 +667,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, | |||
667 | /* could be TCP or UDP, but both have the ports in the right | 667 | /* could be TCP or UDP, but both have the ports in the right |
668 | place, so that doesn't matter here */ | 668 | place, so that doesn't matter here */ |
669 | udp = (const struct GNUNET_TUN_UdpHeader *) &ipv4[1]; | 669 | udp = (const struct GNUNET_TUN_UdpHeader *) &ipv4[1]; |
670 | spt = ntohs (udp->spt); | 670 | source_port = ntohs (udp->source_port); |
671 | dpt = ntohs (udp->dpt); | 671 | destination_port = ntohs (udp->destination_port); |
672 | /* throw away ICMP payload, won't be useful for the other side anyway */ | 672 | /* throw away ICMP payload, won't be useful for the other side anyway */ |
673 | pktlen = sizeof (struct GNUNET_TUN_IcmpHeader); | 673 | pktlen = sizeof (struct GNUNET_TUN_IcmpHeader); |
674 | break; | 674 | break; |
@@ -699,8 +699,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, | |||
699 | /* could be TCP or UDP, but both have the ports in the right | 699 | /* could be TCP or UDP, but both have the ports in the right |
700 | place, so that doesn't matter here */ | 700 | place, so that doesn't matter here */ |
701 | udp = (const struct GNUNET_TUN_UdpHeader *) &ipv6[1]; | 701 | udp = (const struct GNUNET_TUN_UdpHeader *) &ipv6[1]; |
702 | spt = ntohs (udp->spt); | 702 | source_port = ntohs (udp->source_port); |
703 | dpt = ntohs (udp->dpt); | 703 | destination_port = ntohs (udp->destination_port); |
704 | /* throw away ICMP payload, won't be useful for the other side anyway */ | 704 | /* throw away ICMP payload, won't be useful for the other side anyway */ |
705 | pktlen = sizeof (struct GNUNET_TUN_IcmpHeader); | 705 | pktlen = sizeof (struct GNUNET_TUN_IcmpHeader); |
706 | break; | 706 | break; |
@@ -728,17 +728,17 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, | |||
728 | case IPPROTO_UDP: | 728 | case IPPROTO_UDP: |
729 | state = get_redirect_state (af, IPPROTO_UDP, | 729 | state = get_redirect_state (af, IPPROTO_UDP, |
730 | source_ip, | 730 | source_ip, |
731 | spt, | 731 | source_port, |
732 | destination_ip, | 732 | destination_ip, |
733 | dpt, | 733 | destination_port, |
734 | NULL); | 734 | NULL); |
735 | break; | 735 | break; |
736 | case IPPROTO_TCP: | 736 | case IPPROTO_TCP: |
737 | state = get_redirect_state (af, IPPROTO_TCP, | 737 | state = get_redirect_state (af, IPPROTO_TCP, |
738 | source_ip, | 738 | source_ip, |
739 | spt, | 739 | source_port, |
740 | destination_ip, | 740 | destination_ip, |
741 | dpt, | 741 | destination_port, |
742 | NULL); | 742 | NULL); |
743 | break; | 743 | break; |
744 | default: | 744 | default: |
@@ -800,11 +800,11 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, | |||
800 | inet_ntop (af, | 800 | inet_ntop (af, |
801 | source_ip, | 801 | source_ip, |
802 | sbuf, sizeof (sbuf)), | 802 | sbuf, sizeof (sbuf)), |
803 | (unsigned int) ntohs (udp->spt), | 803 | (unsigned int) ntohs (udp->source_port), |
804 | inet_ntop (af, | 804 | inet_ntop (af, |
805 | destination_ip, | 805 | destination_ip, |
806 | dbuf, sizeof (dbuf)), | 806 | dbuf, sizeof (dbuf)), |
807 | (unsigned int) ntohs (udp->dpt)); | 807 | (unsigned int) ntohs (udp->destination_port)); |
808 | } | 808 | } |
809 | if (pktlen < sizeof (struct GNUNET_TUN_UdpHeader)) | 809 | if (pktlen < sizeof (struct GNUNET_TUN_UdpHeader)) |
810 | { | 810 | { |
@@ -820,9 +820,9 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, | |||
820 | } | 820 | } |
821 | state = get_redirect_state (af, IPPROTO_UDP, | 821 | state = get_redirect_state (af, IPPROTO_UDP, |
822 | source_ip, | 822 | source_ip, |
823 | ntohs (udp->spt), | 823 | ntohs (udp->source_port), |
824 | destination_ip, | 824 | destination_ip, |
825 | ntohs (udp->dpt), | 825 | ntohs (udp->destination_port), |
826 | NULL); | 826 | NULL); |
827 | if (NULL == state) | 827 | if (NULL == state) |
828 | { | 828 | { |
@@ -881,11 +881,11 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, | |||
881 | inet_ntop (af, | 881 | inet_ntop (af, |
882 | source_ip, | 882 | source_ip, |
883 | sbuf, sizeof (sbuf)), | 883 | sbuf, sizeof (sbuf)), |
884 | (unsigned int) ntohs (tcp->spt), | 884 | (unsigned int) ntohs (tcp->source_port), |
885 | inet_ntop (af, | 885 | inet_ntop (af, |
886 | destination_ip, | 886 | destination_ip, |
887 | dbuf, sizeof (dbuf)), | 887 | dbuf, sizeof (dbuf)), |
888 | (unsigned int) ntohs (tcp->dpt)); | 888 | (unsigned int) ntohs (tcp->destination_port)); |
889 | } | 889 | } |
890 | if (pktlen < sizeof (struct GNUNET_TUN_TcpHeader)) | 890 | if (pktlen < sizeof (struct GNUNET_TUN_TcpHeader)) |
891 | { | 891 | { |
@@ -895,9 +895,9 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, | |||
895 | } | 895 | } |
896 | state = get_redirect_state (af, IPPROTO_TCP, | 896 | state = get_redirect_state (af, IPPROTO_TCP, |
897 | source_ip, | 897 | source_ip, |
898 | ntohs (tcp->spt), | 898 | ntohs (tcp->source_port), |
899 | destination_ip, | 899 | destination_ip, |
900 | ntohs (tcp->dpt), | 900 | ntohs (tcp->destination_port), |
901 | NULL); | 901 | NULL); |
902 | if (NULL == state) | 902 | if (NULL == state) |
903 | { | 903 | { |
@@ -910,8 +910,8 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, | |||
910 | sender will need to lookup the correct values anyway */ | 910 | sender will need to lookup the correct values anyway */ |
911 | memcpy (buf, tcp, pktlen); | 911 | memcpy (buf, tcp, pktlen); |
912 | mtcp = (struct GNUNET_TUN_TcpHeader *) buf; | 912 | mtcp = (struct GNUNET_TUN_TcpHeader *) buf; |
913 | mtcp->spt = 0; | 913 | mtcp->source_port = 0; |
914 | mtcp->dpt = 0; | 914 | mtcp->destination_port = 0; |
915 | mtcp->crc = 0; | 915 | mtcp->crc = 0; |
916 | 916 | ||
917 | mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) + (pktlen - sizeof (struct GNUNET_TUN_TcpHeader)); | 917 | mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) + (pktlen - sizeof (struct GNUNET_TUN_TcpHeader)); |
@@ -1316,8 +1316,8 @@ prepare_ipv4_packet (const void *payload, size_t payload_length, | |||
1316 | { | 1316 | { |
1317 | struct GNUNET_TUN_UdpHeader *pkt4_udp = (struct GNUNET_TUN_UdpHeader *) &pkt4[1]; | 1317 | struct GNUNET_TUN_UdpHeader *pkt4_udp = (struct GNUNET_TUN_UdpHeader *) &pkt4[1]; |
1318 | 1318 | ||
1319 | pkt4_udp->spt = htons (src_address->port); | 1319 | pkt4_udp->source_port = htons (src_address->port); |
1320 | pkt4_udp->dpt = htons (dst_address->port); | 1320 | pkt4_udp->destination_port = htons (dst_address->port); |
1321 | pkt4_udp->len = htons ((uint16_t) payload_length); | 1321 | pkt4_udp->len = htons ((uint16_t) payload_length); |
1322 | GNUNET_TUN_calculate_udp4_checksum (pkt4, | 1322 | GNUNET_TUN_calculate_udp4_checksum (pkt4, |
1323 | pkt4_udp, | 1323 | pkt4_udp, |
@@ -1330,8 +1330,8 @@ prepare_ipv4_packet (const void *payload, size_t payload_length, | |||
1330 | struct GNUNET_TUN_TcpHeader *pkt4_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt4[1]; | 1330 | struct GNUNET_TUN_TcpHeader *pkt4_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt4[1]; |
1331 | 1331 | ||
1332 | *pkt4_tcp = *tcp_header; | 1332 | *pkt4_tcp = *tcp_header; |
1333 | pkt4_tcp->spt = htons (src_address->port); | 1333 | pkt4_tcp->source_port = htons (src_address->port); |
1334 | pkt4_tcp->dpt = htons (dst_address->port); | 1334 | pkt4_tcp->destination_port = htons (dst_address->port); |
1335 | GNUNET_TUN_calculate_tcp4_checksum (pkt4, | 1335 | GNUNET_TUN_calculate_tcp4_checksum (pkt4, |
1336 | pkt4_tcp, | 1336 | pkt4_tcp, |
1337 | payload, | 1337 | payload, |
@@ -1403,8 +1403,8 @@ prepare_ipv6_packet (const void *payload, size_t payload_length, | |||
1403 | { | 1403 | { |
1404 | struct GNUNET_TUN_UdpHeader *pkt6_udp = (struct GNUNET_TUN_UdpHeader *) &pkt6[1]; | 1404 | struct GNUNET_TUN_UdpHeader *pkt6_udp = (struct GNUNET_TUN_UdpHeader *) &pkt6[1]; |
1405 | 1405 | ||
1406 | pkt6_udp->spt = htons (src_address->port); | 1406 | pkt6_udp->source_port = htons (src_address->port); |
1407 | pkt6_udp->dpt = htons (dst_address->port); | 1407 | pkt6_udp->destination_port = htons (dst_address->port); |
1408 | pkt6_udp->len = htons ((uint16_t) payload_length); | 1408 | pkt6_udp->len = htons ((uint16_t) payload_length); |
1409 | GNUNET_TUN_calculate_udp6_checksum (pkt6, | 1409 | GNUNET_TUN_calculate_udp6_checksum (pkt6, |
1410 | pkt6_udp, | 1410 | pkt6_udp, |
@@ -1419,8 +1419,8 @@ prepare_ipv6_packet (const void *payload, size_t payload_length, | |||
1419 | 1419 | ||
1420 | /* memcpy first here as some TCP header fields are initialized this way! */ | 1420 | /* memcpy first here as some TCP header fields are initialized this way! */ |
1421 | *pkt6_tcp = *tcp_header; | 1421 | *pkt6_tcp = *tcp_header; |
1422 | pkt6_tcp->spt = htons (src_address->port); | 1422 | pkt6_tcp->source_port = htons (src_address->port); |
1423 | pkt6_tcp->dpt = htons (dst_address->port); | 1423 | pkt6_tcp->destination_port = htons (dst_address->port); |
1424 | GNUNET_TUN_calculate_tcp6_checksum (pkt6, | 1424 | GNUNET_TUN_calculate_tcp6_checksum (pkt6, |
1425 | pkt6_tcp, | 1425 | pkt6_tcp, |
1426 | payload, | 1426 | payload, |
@@ -1584,14 +1584,14 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1584 | "Received data from %s for forwarding to TCP service %s on port %u\n", | 1584 | "Received data from %s for forwarding to TCP service %s on port %u\n", |
1585 | GNUNET_i2s (sender), | 1585 | GNUNET_i2s (sender), |
1586 | GNUNET_h2s (&start->service_descriptor), | 1586 | GNUNET_h2s (&start->service_descriptor), |
1587 | (unsigned int) ntohs (start->tcp_header.dpt)); | 1587 | (unsigned int) ntohs (start->tcp_header.destination_port)); |
1588 | if (NULL == (state->serv = find_service (tcp_services, &start->service_descriptor, | 1588 | if (NULL == (state->serv = find_service (tcp_services, &start->service_descriptor, |
1589 | ntohs (start->tcp_header.dpt)))) | 1589 | ntohs (start->tcp_header.destination_port)))) |
1590 | { | 1590 | { |
1591 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1591 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1592 | _("No service found for %s on port %d!\n"), | 1592 | _("No service found for %s on port %d!\n"), |
1593 | "TCP", | 1593 | "TCP", |
1594 | ntohs (start->tcp_header.dpt)); | 1594 | ntohs (start->tcp_header.destination_port)); |
1595 | GNUNET_STATISTICS_update (stats, | 1595 | GNUNET_STATISTICS_update (stats, |
1596 | gettext_noop ("# TCP requests dropped (no such service)"), | 1596 | gettext_noop ("# TCP requests dropped (no such service)"), |
1597 | 1, GNUNET_NO); | 1597 | 1, GNUNET_NO); |
@@ -1707,10 +1707,10 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1707 | inet_ntop (af, | 1707 | inet_ntop (af, |
1708 | &state->ri.remote_address.address, | 1708 | &state->ri.remote_address.address, |
1709 | buf, sizeof (buf)), | 1709 | buf, sizeof (buf)), |
1710 | (unsigned int) ntohs (start->tcp_header.dpt)); | 1710 | (unsigned int) ntohs (start->tcp_header.destination_port)); |
1711 | } | 1711 | } |
1712 | state->ri.remote_address.proto = IPPROTO_TCP; | 1712 | state->ri.remote_address.proto = IPPROTO_TCP; |
1713 | state->ri.remote_address.port = ntohs (start->tcp_header.dpt); | 1713 | state->ri.remote_address.port = ntohs (start->tcp_header.destination_port); |
1714 | setup_state_record (state); | 1714 | setup_state_record (state); |
1715 | send_tcp_packet_via_tun (&state->ri.remote_address, | 1715 | send_tcp_packet_via_tun (&state->ri.remote_address, |
1716 | &state->ri.local_address, | 1716 | &state->ri.local_address, |
@@ -1913,8 +1913,8 @@ make_up_icmpv4_payload (struct TunnelState *state, | |||
1913 | sizeof (struct GNUNET_TUN_TcpHeader), | 1913 | sizeof (struct GNUNET_TUN_TcpHeader), |
1914 | &state->ri.remote_address.address.ipv4, | 1914 | &state->ri.remote_address.address.ipv4, |
1915 | &state->ri.local_address.address.ipv4); | 1915 | &state->ri.local_address.address.ipv4); |
1916 | udp->spt = htons (state->ri.remote_address.port); | 1916 | udp->source_port = htons (state->ri.remote_address.port); |
1917 | udp->dpt = htons (state->ri.local_address.port); | 1917 | udp->destination_port = htons (state->ri.local_address.port); |
1918 | udp->len = htons (0); | 1918 | udp->len = htons (0); |
1919 | udp->crc = htons (0); | 1919 | udp->crc = htons (0); |
1920 | } | 1920 | } |
@@ -1939,8 +1939,8 @@ make_up_icmpv6_payload (struct TunnelState *state, | |||
1939 | sizeof (struct GNUNET_TUN_TcpHeader), | 1939 | sizeof (struct GNUNET_TUN_TcpHeader), |
1940 | &state->ri.remote_address.address.ipv6, | 1940 | &state->ri.remote_address.address.ipv6, |
1941 | &state->ri.local_address.address.ipv6); | 1941 | &state->ri.local_address.address.ipv6); |
1942 | udp->spt = htons (state->ri.remote_address.port); | 1942 | udp->source_port = htons (state->ri.remote_address.port); |
1943 | udp->dpt = htons (state->ri.local_address.port); | 1943 | udp->destination_port = htons (state->ri.local_address.port); |
1944 | udp->len = htons (0); | 1944 | udp->len = htons (0); |
1945 | udp->crc = htons (0); | 1945 | udp->crc = htons (0); |
1946 | } | 1946 | } |
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index 61eb86389..fd5d70a3d 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h | |||
@@ -70,13 +70,13 @@ struct GNUNET_TUN_Layer2PacketHeader | |||
70 | */ | 70 | */ |
71 | struct GNUNET_TUN_IPv4Header | 71 | struct GNUNET_TUN_IPv4Header |
72 | { | 72 | { |
73 | unsigned header_length:4 GNUNET_PACKED; | 73 | unsigned int header_length:4 GNUNET_PACKED; |
74 | unsigned version:4 GNUNET_PACKED; | 74 | unsigned int version:4 GNUNET_PACKED; |
75 | uint8_t diff_serv; | 75 | uint8_t diff_serv; |
76 | uint16_t total_length GNUNET_PACKED; | 76 | uint16_t total_length GNUNET_PACKED; |
77 | uint16_t identification GNUNET_PACKED; | 77 | uint16_t identification GNUNET_PACKED; |
78 | unsigned flags:3 GNUNET_PACKED; | 78 | unsigned int flags:3 GNUNET_PACKED; |
79 | unsigned fragmentation_offset:13 GNUNET_PACKED; | 79 | unsigned int fragmentation_offset:13 GNUNET_PACKED; |
80 | uint8_t ttl; | 80 | uint8_t ttl; |
81 | uint8_t protocol; | 81 | uint8_t protocol; |
82 | uint16_t checksum GNUNET_PACKED; | 82 | uint16_t checksum GNUNET_PACKED; |
@@ -90,10 +90,10 @@ struct GNUNET_TUN_IPv4Header | |||
90 | */ | 90 | */ |
91 | struct GNUNET_TUN_IPv6Header | 91 | struct GNUNET_TUN_IPv6Header |
92 | { | 92 | { |
93 | unsigned traffic_class_h:4 GNUNET_PACKED; | 93 | unsigned int traffic_class_h:4 GNUNET_PACKED; |
94 | unsigned version:4 GNUNET_PACKED; | 94 | unsigned int version:4 GNUNET_PACKED; |
95 | unsigned traffic_class_l:4 GNUNET_PACKED; | 95 | unsigned int traffic_class_l:4 GNUNET_PACKED; |
96 | unsigned flow_label:20 GNUNET_PACKED; | 96 | unsigned int flow_label:20 GNUNET_PACKED; |
97 | uint16_t payload_length GNUNET_PACKED; | 97 | uint16_t payload_length GNUNET_PACKED; |
98 | uint8_t next_header; | 98 | uint8_t next_header; |
99 | uint8_t hop_limit; | 99 | uint8_t hop_limit; |
@@ -107,28 +107,42 @@ struct GNUNET_TUN_IPv6Header | |||
107 | */ | 107 | */ |
108 | struct GNUNET_TUN_TcpHeader | 108 | struct GNUNET_TUN_TcpHeader |
109 | { | 109 | { |
110 | unsigned spt:16 GNUNET_PACKED; | 110 | uint16_t source_port GNUNET_PACKED; |
111 | unsigned dpt:16 GNUNET_PACKED; | 111 | uint16_t destination_port GNUNET_PACKED; |
112 | unsigned seq:32 GNUNET_PACKED; | 112 | uint32_t seq GNUNET_PACKED; |
113 | unsigned ack:32 GNUNET_PACKED; | 113 | uint32_t ack GNUNET_PACKED; |
114 | #if __BYTE_ORDER == __LITTLE_ENDIAN | ||
114 | /** | 115 | /** |
115 | * Reserved. | 116 | * Reserved. |
116 | */ | 117 | */ |
117 | unsigned rsv:4 GNUNET_PACKED; | 118 | unsigned int reserved : 4 GNUNET_PACKED; |
118 | /** | 119 | /** |
119 | * Number of 32-bit words in TCP header. | 120 | * Number of 32-bit words in TCP header. |
120 | */ | 121 | */ |
121 | unsigned off:4 GNUNET_PACKED; | 122 | unsigned int off : 4 GNUNET_PACKED; |
122 | unsigned flg:8 GNUNET_PACKED; | 123 | #elif __BYTE_ORDER == __BIG_ENDIAN |
124 | /** | ||
125 | * Number of 32-bit words in TCP header. | ||
126 | */ | ||
127 | unsigned int off : 4 GNUNET_PACKED; | ||
128 | /** | ||
129 | * Reserved. | ||
130 | */ | ||
131 | unsigned int reserved : 4 GNUNET_PACKED; | ||
132 | #endif | ||
133 | uint8_t flags; | ||
134 | |||
123 | /** | 135 | /** |
124 | * Window size. | 136 | * Window size. |
125 | */ | 137 | */ |
126 | unsigned wsz:16 GNUNET_PACKED; | 138 | uint16_t window_size GNUNET_PACKED; |
127 | unsigned crc:16 GNUNET_PACKED; | 139 | |
140 | uint16_t crc GNUNET_PACKED; | ||
141 | |||
128 | /** | 142 | /** |
129 | * Urgent pointer. | 143 | * Urgent pointer. |
130 | */ | 144 | */ |
131 | unsigned urg:16 GNUNET_PACKED; | 145 | uint16_t urgent_pointer GNUNET_PACKED; |
132 | }; | 146 | }; |
133 | 147 | ||
134 | 148 | ||
@@ -137,8 +151,8 @@ struct GNUNET_TUN_TcpHeader | |||
137 | */ | 151 | */ |
138 | struct GNUNET_TUN_UdpHeader | 152 | struct GNUNET_TUN_UdpHeader |
139 | { | 153 | { |
140 | uint16_t spt GNUNET_PACKED; | 154 | uint16_t source_port GNUNET_PACKED; |
141 | uint16_t dpt GNUNET_PACKED; | 155 | uint16_t destination_port GNUNET_PACKED; |
142 | uint16_t len GNUNET_PACKED; | 156 | uint16_t len GNUNET_PACKED; |
143 | uint16_t crc GNUNET_PACKED; | 157 | uint16_t crc GNUNET_PACKED; |
144 | }; | 158 | }; |
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index a32e739d2..8e6ae655d 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -881,8 +881,8 @@ route_packet (struct DestinationEntry *destination, | |||
881 | const struct GNUNET_TUN_UdpHeader *udp; | 881 | const struct GNUNET_TUN_UdpHeader *udp; |
882 | const struct GNUNET_TUN_TcpHeader *tcp; | 882 | const struct GNUNET_TUN_TcpHeader *tcp; |
883 | const struct GNUNET_TUN_IcmpHeader *icmp; | 883 | const struct GNUNET_TUN_IcmpHeader *icmp; |
884 | uint16_t spt; | 884 | uint16_t source_port; |
885 | uint16_t dpt; | 885 | uint16_t destination_port; |
886 | 886 | ||
887 | switch (protocol) | 887 | switch (protocol) |
888 | { | 888 | { |
@@ -900,14 +900,14 @@ route_packet (struct DestinationEntry *destination, | |||
900 | GNUNET_break_op (0); | 900 | GNUNET_break_op (0); |
901 | return; | 901 | return; |
902 | } | 902 | } |
903 | spt = ntohs (udp->spt); | 903 | source_port = ntohs (udp->source_port); |
904 | dpt = ntohs (udp->dpt); | 904 | destination_port = ntohs (udp->destination_port); |
905 | get_tunnel_key_from_ips (af, | 905 | get_tunnel_key_from_ips (af, |
906 | IPPROTO_UDP, | 906 | IPPROTO_UDP, |
907 | source_ip, | 907 | source_ip, |
908 | spt, | 908 | source_port, |
909 | destination_ip, | 909 | destination_ip, |
910 | dpt, | 910 | destination_port, |
911 | &key); | 911 | &key); |
912 | } | 912 | } |
913 | break; | 913 | break; |
@@ -925,14 +925,14 @@ route_packet (struct DestinationEntry *destination, | |||
925 | GNUNET_break_op (0); | 925 | GNUNET_break_op (0); |
926 | return; | 926 | return; |
927 | } | 927 | } |
928 | spt = ntohs (tcp->spt); | 928 | source_port = ntohs (tcp->source_port); |
929 | dpt = ntohs (tcp->dpt); | 929 | destination_port = ntohs (tcp->destination_port); |
930 | get_tunnel_key_from_ips (af, | 930 | get_tunnel_key_from_ips (af, |
931 | IPPROTO_TCP, | 931 | IPPROTO_TCP, |
932 | source_ip, | 932 | source_ip, |
933 | spt, | 933 | source_port, |
934 | destination_ip, | 934 | destination_ip, |
935 | dpt, | 935 | destination_port, |
936 | &key); | 936 | &key); |
937 | } | 937 | } |
938 | break; | 938 | break; |
@@ -945,8 +945,8 @@ route_packet (struct DestinationEntry *destination, | |||
945 | return; | 945 | return; |
946 | } | 946 | } |
947 | icmp = payload; | 947 | icmp = payload; |
948 | spt = 0; | 948 | source_port = 0; |
949 | dpt = 0; | 949 | destination_port = 0; |
950 | get_tunnel_key_from_ips (af, | 950 | get_tunnel_key_from_ips (af, |
951 | IPPROTO_ICMP, | 951 | IPPROTO_ICMP, |
952 | source_ip, | 952 | source_ip, |
@@ -986,13 +986,13 @@ route_packet (struct DestinationEntry *destination, | |||
986 | "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", | 986 | "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", |
987 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", | 987 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", |
988 | inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), | 988 | inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), |
989 | spt, | 989 | source_port, |
990 | inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)), | 990 | inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)), |
991 | dpt, | 991 | destination_port, |
992 | inet_ntop (destination->details.exit_destination.af, | 992 | inet_ntop (destination->details.exit_destination.af, |
993 | &destination->details.exit_destination.ip, | 993 | &destination->details.exit_destination.ip, |
994 | xbuf, sizeof (xbuf)), | 994 | xbuf, sizeof (xbuf)), |
995 | dpt); | 995 | destination_port); |
996 | } | 996 | } |
997 | } | 997 | } |
998 | else | 998 | else |
@@ -1007,9 +1007,9 @@ route_packet (struct DestinationEntry *destination, | |||
1007 | "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", | 1007 | "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", |
1008 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", | 1008 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", |
1009 | inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), | 1009 | inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), |
1010 | spt, | 1010 | source_port, |
1011 | inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)), | 1011 | inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)), |
1012 | dpt, | 1012 | destination_port, |
1013 | GNUNET_h2s (&destination->details.service_destination.service_descriptor), | 1013 | GNUNET_h2s (&destination->details.service_destination.service_descriptor), |
1014 | GNUNET_i2s (&destination->details.service_destination.target)); | 1014 | GNUNET_i2s (&destination->details.service_destination.target)); |
1015 | } | 1015 | } |
@@ -1045,8 +1045,8 @@ route_packet (struct DestinationEntry *destination, | |||
1045 | ts->source_ip.v6 = * (const struct in6_addr *) source_ip; | 1045 | ts->source_ip.v6 = * (const struct in6_addr *) source_ip; |
1046 | ts->destination_ip.v6 = * (const struct in6_addr *) destination_ip; | 1046 | ts->destination_ip.v6 = * (const struct in6_addr *) destination_ip; |
1047 | } | 1047 | } |
1048 | ts->source_port = spt; | 1048 | ts->source_port = source_port; |
1049 | ts->destination_port = dpt; | 1049 | ts->destination_port = destination_port; |
1050 | ts->heap_node = GNUNET_CONTAINER_heap_insert (tunnel_heap, | 1050 | ts->heap_node = GNUNET_CONTAINER_heap_insert (tunnel_heap, |
1051 | ts, | 1051 | ts, |
1052 | GNUNET_TIME_absolute_get ().abs_value); | 1052 | GNUNET_TIME_absolute_get ().abs_value); |
@@ -1093,8 +1093,8 @@ route_packet (struct DestinationEntry *destination, | |||
1093 | usm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE); | 1093 | usm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE); |
1094 | /* if the source port is below 32000, we assume it has a special | 1094 | /* if the source port is below 32000, we assume it has a special |
1095 | meaning; if not, we pick a random port (this is a heuristic) */ | 1095 | meaning; if not, we pick a random port (this is a heuristic) */ |
1096 | usm->source_port = (ntohs (udp->spt) < 32000) ? udp->spt : 0; | 1096 | usm->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0; |
1097 | usm->destination_port = udp->dpt; | 1097 | usm->destination_port = udp->destination_port; |
1098 | usm->service_descriptor = destination->details.service_destination.service_descriptor; | 1098 | usm->service_descriptor = destination->details.service_destination.service_descriptor; |
1099 | memcpy (&usm[1], | 1099 | memcpy (&usm[1], |
1100 | &udp[1], | 1100 | &udp[1], |
@@ -1122,8 +1122,8 @@ route_packet (struct DestinationEntry *destination, | |||
1122 | uim->header.size = htons ((uint16_t) mlen); | 1122 | uim->header.size = htons ((uint16_t) mlen); |
1123 | uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); | 1123 | uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); |
1124 | uim->af = htonl (destination->details.exit_destination.af); | 1124 | uim->af = htonl (destination->details.exit_destination.af); |
1125 | uim->source_port = (ntohs (udp->spt) < 32000) ? udp->spt : 0; | 1125 | uim->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0; |
1126 | uim->destination_port = udp->dpt; | 1126 | uim->destination_port = udp->destination_port; |
1127 | switch (destination->details.exit_destination.af) | 1127 | switch (destination->details.exit_destination.af) |
1128 | { | 1128 | { |
1129 | case AF_INET: | 1129 | case AF_INET: |
@@ -1630,8 +1630,8 @@ make_up_icmpv4_payload (struct TunnelState *ts, | |||
1630 | sizeof (struct GNUNET_TUN_TcpHeader), | 1630 | sizeof (struct GNUNET_TUN_TcpHeader), |
1631 | &ts->source_ip.v4, | 1631 | &ts->source_ip.v4, |
1632 | &ts->destination_ip.v4); | 1632 | &ts->destination_ip.v4); |
1633 | udp->spt = htons (ts->source_port); | 1633 | udp->source_port = htons (ts->source_port); |
1634 | udp->dpt = htons (ts->destination_port); | 1634 | udp->destination_port = htons (ts->destination_port); |
1635 | udp->len = htons (0); | 1635 | udp->len = htons (0); |
1636 | udp->crc = htons (0); | 1636 | udp->crc = htons (0); |
1637 | } | 1637 | } |
@@ -1656,8 +1656,8 @@ make_up_icmpv6_payload (struct TunnelState *ts, | |||
1656 | sizeof (struct GNUNET_TUN_TcpHeader), | 1656 | sizeof (struct GNUNET_TUN_TcpHeader), |
1657 | &ts->source_ip.v6, | 1657 | &ts->source_ip.v6, |
1658 | &ts->destination_ip.v6); | 1658 | &ts->destination_ip.v6); |
1659 | udp->spt = htons (ts->source_port); | 1659 | udp->source_port = htons (ts->source_port); |
1660 | udp->dpt = htons (ts->destination_port); | 1660 | udp->destination_port = htons (ts->destination_port); |
1661 | udp->len = htons (0); | 1661 | udp->len = htons (0); |
1662 | udp->crc = htons (0); | 1662 | udp->crc = htons (0); |
1663 | } | 1663 | } |
@@ -2085,13 +2085,13 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
2085 | &ts->destination_ip.v4, | 2085 | &ts->destination_ip.v4, |
2086 | &ts->source_ip.v4); | 2086 | &ts->source_ip.v4); |
2087 | if (0 == ntohs (reply->source_port)) | 2087 | if (0 == ntohs (reply->source_port)) |
2088 | udp->spt = htons (ts->destination_port); | 2088 | udp->source_port = htons (ts->destination_port); |
2089 | else | 2089 | else |
2090 | udp->spt = reply->source_port; | 2090 | udp->source_port = reply->source_port; |
2091 | if (0 == ntohs (reply->destination_port)) | 2091 | if (0 == ntohs (reply->destination_port)) |
2092 | udp->dpt = htons (ts->source_port); | 2092 | udp->destination_port = htons (ts->source_port); |
2093 | else | 2093 | else |
2094 | udp->dpt = reply->destination_port; | 2094 | udp->destination_port = reply->destination_port; |
2095 | udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader)); | 2095 | udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader)); |
2096 | GNUNET_TUN_calculate_udp4_checksum (ipv4, | 2096 | GNUNET_TUN_calculate_udp4_checksum (ipv4, |
2097 | udp, | 2097 | udp, |
@@ -2130,13 +2130,13 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
2130 | &ts->destination_ip.v6, | 2130 | &ts->destination_ip.v6, |
2131 | &ts->source_ip.v6); | 2131 | &ts->source_ip.v6); |
2132 | if (0 == ntohs (reply->source_port)) | 2132 | if (0 == ntohs (reply->source_port)) |
2133 | udp->spt = htons (ts->destination_port); | 2133 | udp->source_port = htons (ts->destination_port); |
2134 | else | 2134 | else |
2135 | udp->spt = reply->source_port; | 2135 | udp->source_port = reply->source_port; |
2136 | if (0 == ntohs (reply->destination_port)) | 2136 | if (0 == ntohs (reply->destination_port)) |
2137 | udp->dpt = htons (ts->source_port); | 2137 | udp->destination_port = htons (ts->source_port); |
2138 | else | 2138 | else |
2139 | udp->dpt = reply->destination_port; | 2139 | udp->destination_port = reply->destination_port; |
2140 | udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader)); | 2140 | udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader)); |
2141 | GNUNET_TUN_calculate_udp6_checksum (ipv6, | 2141 | GNUNET_TUN_calculate_udp6_checksum (ipv6, |
2142 | udp, | 2142 | udp, |
@@ -2243,8 +2243,8 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
2243 | &ts->destination_ip.v4, | 2243 | &ts->destination_ip.v4, |
2244 | &ts->source_ip.v4); | 2244 | &ts->source_ip.v4); |
2245 | *tcp = data->tcp_header; | 2245 | *tcp = data->tcp_header; |
2246 | tcp->spt = htons (ts->destination_port); | 2246 | tcp->source_port = htons (ts->destination_port); |
2247 | tcp->dpt = htons (ts->source_port); | 2247 | tcp->destination_port = htons (ts->source_port); |
2248 | GNUNET_TUN_calculate_tcp4_checksum (ipv4, | 2248 | GNUNET_TUN_calculate_tcp4_checksum (ipv4, |
2249 | tcp, | 2249 | tcp, |
2250 | &data[1], | 2250 | &data[1], |
@@ -2282,8 +2282,8 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
2282 | &ts->destination_ip.v6, | 2282 | &ts->destination_ip.v6, |
2283 | &ts->source_ip.v6); | 2283 | &ts->source_ip.v6); |
2284 | *tcp = data->tcp_header; | 2284 | *tcp = data->tcp_header; |
2285 | tcp->spt = htons (ts->destination_port); | 2285 | tcp->source_port = htons (ts->destination_port); |
2286 | tcp->dpt = htons (ts->source_port); | 2286 | tcp->destination_port = htons (ts->source_port); |
2287 | GNUNET_TUN_calculate_tcp6_checksum (ipv6, | 2287 | GNUNET_TUN_calculate_tcp6_checksum (ipv6, |
2288 | tcp, | 2288 | tcp, |
2289 | &data[1], | 2289 | &data[1], |