aboutsummaryrefslogtreecommitdiff
path: root/src/tun
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-08-25 12:51:21 +0000
committerChristian Grothoff <christian@grothoff.org>2016-08-25 12:51:21 +0000
commitccf6004e61a5379954aed85be6ed49ab7e886a7d (patch)
tree31b63266ea85235a126aa618126e2f836eb4eef2 /src/tun
parent182fae1b29eafe14018d45beb9613725651a779c (diff)
downloadgnunet-ccf6004e61a5379954aed85be6ed49ab7e886a7d.tar.gz
gnunet-ccf6004e61a5379954aed85be6ed49ab7e886a7d.zip
ensure binding multiple ports to the same service descriptor works (again) with the correct mapping of ports
Diffstat (limited to 'src/tun')
-rw-r--r--src/tun/regex.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tun/regex.c b/src/tun/regex.c
index f1ebb85f4..d48fe1da8 100644
--- a/src/tun/regex.c
+++ b/src/tun/regex.c
@@ -810,4 +810,27 @@ GNUNET_TUN_service_name_to_hash (const char *service_name,
810} 810}
811 811
812 812
813/**
814 * Compute the CADET port given a service descriptor
815 * (returned from #GNUNET_TUN_service_name_to_hash) and
816 * a TCP/UDP port @a ip_port.
817 *
818 * @param desc service shared secret
819 * @param ip_port TCP/UDP port, use 0 for ICMP
820 * @param[out] cadet_port CADET port to use
821 */
822void
823GNUNET_TUN_compute_service_cadet_port (const struct GNUNET_HashCode *desc,
824 uint16_t ip_port,
825 struct GNUNET_HashCode *cadet_port)
826{
827 uint16_t be_port = htons (ip_port);
828
829 *cadet_port = *desc;
830 GNUNET_memcpy (cadet_port,
831 &be_port,
832 sizeof (uint16_t));
833}
834
835
813/* end of regex.c */ 836/* end of regex.c */